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 / Playing music as a 'sound' file or 'music' file

Author
Message
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 29th Sep 2008 11:18
I gather from some oldish posts that the command set music volume doesnt work. In fact I know it doesnt work as I've just checked it out myself. The workaround seems to be to load a music file as a sound and set the sound volume. However are there any pitfalls to be aware of when you load music as sound (e.g. slower performance etc).
Satchmo
19
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 29th Sep 2008 14:12
No Midi support, thats it.

Yodaman Jer
User Banned
Posted: 29th Sep 2008 17:18
Most computers nowadays don't support MIDIs. Mine doesn't!
I've found that using the Microsoft .Wav format makes the game sound crisper (because the music doesn't sound like a cheesy synthesized brass instrument) and it doesn't slow it down at all.

So, rather than use MIDIs, use .Wavs and load them through the load sound command. You then can do whatever you want to it!

Yodaman Jer

That guy with no idea of what to say here. Except that he is a geek, and likes cheese. And pickles. But mostly cheese.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 29th Sep 2008 23:58 Edited at: 30th Sep 2008 09:16
Quote: "However are there any pitfalls to be aware of when you load music as sound "


Just size and memory. Use a compressed format like mp3 - works with DBC. Or use a DLL and use .ogg or flac. Ogg has great compression and sound quality (seems to have less high-end loss than mp3). Flac is supposed to be loss-less compression.

If you want a bit of direct control over the music you play, try using winmm.dll and the mciSendString command.

Enjoy your day.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 30th Sep 2008 00:29
Thanks all! I think the midi problem is DBC specific because I can still play and hear midi files through media player but loading them to play in DBC either results in silence or "file not found".
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th Sep 2008 09:20
For midis in DBC try this (you may have to include the full path to the midi file if it is not in your working directory; and make sure you include the Chr$(34) before and after. The filename$ needs to have the quotes included with it.):



Enjoy your day.
Yodaman Jer
User Banned
Posted: 30th Sep 2008 19:35
Yeah. My computer does play them (only in Windows Media, though...), so I just took it for granted that my computer just didn't support them.

Yodaman Jer

That guy with no idea of what to say here. Except that he is a geek, and likes cheese. And pickles. But mostly cheese.
Ed222
17
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 30th Sep 2008 21:27 Edited at: 30th Sep 2008 21:34
you could try tell all the users that download your program to turn their SW SYNTH up by themselfs



Attachments

Login to view attachments
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 5th Jan 2009 01:45 Edited at: 5th Jan 2009 01:47
I've encountered a problem with loading music as "sound". Its weird but for some MP3s the load sound command doesnt work, yet for those same problem MP3 it does work if you use the load music command. Can anyone tell me what the problem might be and how (if possible) to fix it? Is it to do with the MP3 kbtz rate?

Sorry I should have said that when I load the mp3 as sound, the error message is "sound file not found", but it definitely exists because if I change the load "sound" to load "music" DB somehow recognises it.
Yodaman Jer
User Banned
Posted: 5th Jan 2009 02:12
Odd, I've consistently used MP3 since this topic started (after another user suggested it) and I've had no problems with it. In fact, I've had nothing but benefits from it!


But my guess would be that it would in fact have something to do with the kbtz rate, but I don't know enough about that stuff to tell you how it could cause it or how to fix it. Sorry!

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Jan 2009 08:35
@Hangar18

I think it has to do with the mp3 encoding. I think it should be MPEG1 and not MPEG2 for use with DBC. Depending on what you are using to make your mp3s, there should be an option. Use lame if you don't have an application to control this when creating your mp3.

Enjoy your day.
chunks chunks
18
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 5th Jan 2009 15:19
try my mp3 plugin it`s got some cool features + a nifty echo processor , i also confirm it works with dbc .

http://forum.thegamecreators.com/?m=forum_view&t=139418&b=18

if ya do try it let me know how it goes ,if it has any problems with dbc.

nvidia geforce 8600gt + amd athlon 64
windows xp pro.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 5th Jan 2009 22:31 Edited at: 5th Jan 2009 22:31
@ Latch and Chunk Chunks: Thanks guys for your help! I will definitely check out your mp3 plug in chunks chunks and let you know if it works - thanks very much for this!
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 5th Jan 2009 22:39
@ chunks chunks: I've downloaded your rar and extracted the files. I've not used a plug in in DBC before - what do I do next to make use of the plug in? Do I copy the folders into the root DBC directory and then the commands in the text file into the actual DBC code? Sorry for being a bit techno challenged.
chunks chunks
18
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 8th Jan 2009 15:28
sorry i missed your post , to use this in dbc you need to use the call dll command .



dont forget to put the dll in your project folder with the exe.

keywords don`t work with dbc , there is a list of commands in the thread in dll talk .

also to get the decorated names eg (getpositionmp3@@YAHH@Z) you open up the dll with notepad and search them or use dllexp viewer.

hope that helps

chunks

nvidia geforce 8600gt + amd athlon 64
windows xp pro.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 23rd Jan 2009 02:11
Hi Chunks, yes I managed to get your DLL to work but when I hit escape it crashes. I also managed to fix the mp3 problem by using a different WAV-MP3 converter. However sometimes when the sound plays it crackles, other times it doesnt. Do you know what causes this?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Jan 2009 03:16
@Hangar
Just curious, did you try just changing the mp3's encoding to MPEG1 and use the native DBC commands?

Enjoy your day.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 27th Jan 2009 02:34
Hi Latch, no I just used a different Wav-MP3 converter and in fact only solved the problem for 3 of the problem files (so now 8 of the 11 tracks work but 3 still do not). I dont think the problem relates to the MPEG1/2 issue because if I try loading the remaining problem 3 files before I convert them (and all are in their original wavs format) as sound they dont work, but loading as music does! Do you know if the wav format suffers from a similar issue as MPEG1/2

Cheers.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 28th Jan 2009 20:41 Edited at: 28th Jan 2009 20:46
Quote: "because if I try loading the remaining problem 3 files before I convert them (and all are in their original wavs format) as sound they dont work, but loading as music does"


That's odd! The only thing I can think of that may be applicable in both cases (though in tests mp3s not encoded as MPEG1 layer 3 don't work on my machine with DBC) is that the header of the files is corrupt. What you could try is loading your wav files into sound editing software, and saving them as wav files (with a different name).

There's a super basic program that used to come with all windows distributions called Sound Recorder (sndrec32.exe). Very easy to use, load one of the wav files that won't load as sound, save as, choose the format - depending on the codecs installed on your computer and the abilities of your sound card, there should be many options - and voila! For the sake of the test and for use with DBC, save the file at 44100 hz, 16 bit, MONO for a wave file.

If they can be loaded as sound in DBC, then try converting those new wavs to mp3.

Enjoy your day.
Hangar18
18
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 2nd Feb 2009 07:13
Thanks Latch, thats fixed it!

I couldnt find the sndrec32 program but used another and having saved the originals as wav's (diff name) and then converted to mp3 the music loads as sound no problem.

Cheers!

Login to post a reply

Server time is: 2025-05-18 21:52:31
Your offset time is: 2025-05-18 21:52:31