Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / i need help loading and playing a sound/music file

Author
Message
bobbyd
17
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 22nd Jan 2009 16:51
hi
i need help loading and playing music/sound because every time i try to load and play music or sound it says it cannot be loaded
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jan 2009 17:06
You will need to show us some code in order to help you

Bluestar4
20
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 22nd Jan 2009 17:34
the sound/music file must be in the same directory as the source file
use load sound for wav files and mp3 files
use load music for midi files

bluestar4~
bobbyd
17
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 22nd Jan 2009 20:53
here is the code [rem Load a wav sound file into number one
load music "Slayer_Dance_2.mid",1

rem Play sound number
play music 1

rem Will wait for you to press any key
suspend for key

rem Stop sound
stop sound 1

rem Delete sound
delete sound 1

rem End the program
end ]
Hangar18
19
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 23rd Jan 2009 02:16 Edited at: 23rd Jan 2009 02:17
I believe the latest version of DBC no longer supports 'mids'. I think it used to as a number of the old programs that came with DBC enhancement pack try to load in mids but I get the same problem as you. If you can convert it to "Slayer_dance2" to mp3 or wav it should work fine.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Jan 2009 03:13
DBC 1.20 supports mids, it's just in conjunction with the newer windows installs and directx that midi usually isn't set up properly.

Enjoy your day.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 23rd Jan 2009 13:22 Edited at: 23rd Jan 2009 13:23
I've had trouble with midi's too. I found I could load and play a midi in DB1.20, but when the midi stopped playing the whole program frozefor a moment or two. Loop Midi was a nightmare, every time the midi went back to the beginning it made the program freeze.

If you really want to use Midi files, try this function written by Latch. It plays the midi file you specify by opening it through windows directly, rather than through DarkBasic (but don't worry if you can't understand it)



Your best bit really is to track down a mid to mp3 converter - let me know if you find one, I could sure use it!

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Jan 2009 18:42
Quote: "Your best bit really is to track down a mid to mp3 converter - let me know if you find one, I could sure use it!"


There's an awesome one I used to use in Linux all the time called Timidity++ . There's a port for windows with a Gui but I don't think it's been updated in years. Still works great though! And with a good set of sound fonts (.sf2), you can get some great sounding results! I'm attaching a bare bones Beethoven midi excerpt I just did now using timidity++ . No fancy settings - just right out of the box to mp3 in windows. I like this one mainly because the sound quality I get in Linux is superior to Windows, but as an app, you have to like command line stuff if you want to use more advanced features.

Here's a link :
Timidity++

Another great one is SynthFont though I never encoded an mp3 with it. It does have that option. It has a lot of great functions and allows the use of VSTi plugins for effects and such. As a midi package and Sound Font player, this is top notch. You can edit the midi stuff directly, arrange tracks and instruments... I highly recommend this one!

SynthFont

Enjoy your day.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 24th Jan 2009 11:59
Thanks for the links, Latch - I'm impressed with the results you got from Timidity++, I can't wait to try it out!

One thing though - I've not really heard of sound fonts before, and I don't think I'vegot any. Can you recommend any sites where I could download them from?

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th Jan 2009 17:12 Edited at: 24th Jan 2009 17:15
This one - not all free, but has professional grade soundfonts for purchase. Never tried it though:

SF2

The next links are free... And you'll find good quality.

Just a quick background... SoundFont (.sf2) is a sample format developed by Creative for it's EMU, Audigy, and SoundBlaster series of sound cards. The technology allowed specifically configured samples to be loaded into a wave table or into system memory so that midi files could be played using real sounding(or as real sounding as a sample allows) instruments. Machines that didn't have the Creative hardware were out of luck until some clever and gracious folks developed sound font players Timidity++, SynthFont (and others) - where you could take advantage of the sf2 technology without having dedicated hardware.

The following site has some HUGE sound font files. What that means is the samples that make up the sounds are generally of pretty good quality. It also means that it takes a lot of memory to load in the sound font. But that's only to produce good midi sound. When you create your wave or mp3, they will be the appropriate size - as if they were normal wave or mp3 files. Also, both of those sound font players/converters will create OGG files. Those tend to be of comparable or smaller size and better sound quality than mp3. But I don't know of any way yet to play those in DBC.

BIG Sound Fonts

Here is an old link I had with tons of soundfonts. I'm not sure if it's maintained or if it has changed but on first look it seems ok...

HammerSound

Enjoy your day.

Login to post a reply

Server time is: 2026-07-05 00:01:43
Your offset time is: 2026-07-05 00:01:43