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 Professional Discussion / MP3 instead of WAV

Author
Message
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 21st Aug 2010 22:27
I'm trying to make my programs a bit smaller by using mp3 instead of wav (I already read about .ogg, I can do that if it is better.) Whether it is ogg or mp3, is there a way to use them with the sound command? The music command sets a BG music, so I can only play one osund at a time with it. I want to have a music file running in the background and then play mp3 sound effects over it. WAV files can be played simultaneously via SOUND, but whehn I use SOUND it doesn't load my MP3.

I also saw some plugin by Torrey. Do I need it and if so where do I get it? There was no link to it in the post. I'd rather stick to my standard DBPro installation if possible. Too new to this to start messing with DLL files.

www.dustinmcmurry.com
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 22nd Aug 2010 00:11
I've played more than one file at a time using Music commands. Give that a try.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Aug 2010 00:53
So you are saying this doesn't work?



TheComet

Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 22nd Aug 2010 01:55
I figured out that it will play them at the same time, but I have to include a stop music command for each one. I don't WANT them to loop; I want to use them as sound effects. But they don't reset. If I put in "play music 1; wait 3000; play music 1" it only plays once. I have to include a stop command that I don't need with "play sound"

www.dustinmcmurry.com
Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 22nd Aug 2010 20:56
There's been some posts about a possible bug with playing or looping music. The "sync" command seems to update the music commands, so you might try putting a sync command after your play music command.

I know that, in Quickhack, my music would not loop if the player was in a menu that didn't have a sync command in the menu code loop. Once I added a sync to the loop, then my music (mp3) would continue to loop properly.

Hope this helps...

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 22nd Aug 2010 21:27 Edited at: 22nd Aug 2010 21:28
Try this: http://forum.thegamecreators.com/?m=forum_view&t=170129&b=6

Use music snippet!

Quote: "
I want to have a music file running in the background and then play mp3 sound effects over it."

You can do it!You can play as many sounds in the same time with this as you want.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 23rd Aug 2010 00:01
I have them working, I was just hoping I could get around including a STOP MUSIC command for each one.

www.dustinmcmurry.com
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Aug 2010 09:14
MP3 files use up a lot more processor power than .WAV, so it's probably not a good idea to replace all your sound effects with MP3, file size has to be a secondary concern.

Health, Ammo, and bacon and eggs!
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 23rd Aug 2010 15:29
How is that? They are waaaaaay smaller. I'm talking 20k each compared to 600k+

www.dustinmcmurry.com
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Aug 2010 15:42
Because DX has to decode the MP3 as it's playing it, rather than just playing through a block of memory which doesn't need to be decoded. If you play just 1 MP3 then the performance drag would be negligible, but if you try playing several MP3's, then all that extra processing will drag performance down.

It's kinda like the difference between playing a recording, and playing an instrument - it takes brain power to play the instrument, and trying to play several instruments at once quickly becomes a burdon - but just playing a recording takes no brain power.

I would only use MP3's for backdrop music, ambient sounds etc - not for spot effects that you'll be playing several times, or playing lots of sounds at the same time.

Health, Ammo, and bacon and eggs!
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2010 17:32
I agree, if you really want to compress your wavs, you may be better off down sampling them a little. Game devs used to use that technique when mp3's didn't exist and memory was scarce. Instead of having 16 or higher samples try 8 bit. Dependant on what the sound is you can get away with quite low sample rate settings. Games like It came from the Desert and many others used very low sample rates to achieve stunning results at the time.
So get Audacity or Goldwave and resample your wavs down as much as you can
You can even get rid of media entirely if you use the technique I used in my 20 line Space Invaders entry, the sound version I posted afterwards as people seemed to want it. Large sounds would be rather a big data file though. But no media would be needed in your program apart from models and such then.

http://s6.bitefight.org/c.php?uid=103081
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 24th Aug 2010 06:21
I'm not worried about file size right now. It's going on machines I have access to and they have plenty of space. Maybe if I ever get to a point I can be commercial it will be more important.

As for making my own sounds, I have Ableton Live, and it's awesome. [href]myspace.com/igglepud[/href]

I love making game music.

www.dustinmcmurry.com
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 24th Aug 2010 06:22
@Van B: Great analogy. Ableton has a "freeze" function for all my instruments. It basically takes the VST instrument track and makes it a wave, so it doesn't have to play the instrument live. When you said that, it made perfect sense.

www.dustinmcmurry.com
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 24th Aug 2010 15:48 Edited at: 24th Aug 2010 15:54
Quote "I'm trying to make my programs a bit smaller by using mp3 instead of wav (I already read about .ogg, I can do that if it is better.)"

So why the post then?

Edit - oh and if you are planning to sell anything in future.. Mp3's I think have some issue with license, so I would stick to .wavs and .ogg files.

http://s6.bitefight.org/c.php?uid=103081
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 24th Aug 2010 21:02
Stick to wav files. If you compress your game when distributing it, the wav files will be about the same size as an mp3 anyway...

TheComet

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Aug 2010 21:47
Quote: "If you compress your game when distributing it, the wav files will be about the same size as an mp3 anyway..."

And the program will take 5 times as long to start as all wav's are decompressed before the program runs and take up a huge amount of space.

Just use mp3's and the free enhanced audio plugin.

My signature is NOT a moderator plaything! Stop changing it!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 24th Aug 2010 21:52
Quote: "And the program will take 5 times as long to start as all wav's are decompressed before the program runs and take up a huge amount of space."


You only have to decompress it once...

TheComet

Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 25th Aug 2010 00:53
@DVader: My first post had a question about coding.

@Mobiius: How do I use these plugins? I have extends and a bunch of others. Does it just mean that since they are active that I now have access to the new commands?

@TheComet: Yes, I don't care how long it takes to fire up at start as long as it runs smoothe when loaded. Plus, my program is sitting on a whole 3 megabytes right now. Pretty sure speed isn't going to be an issue whichever way I go.

www.dustinmcmurry.com
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 25th Aug 2010 02:48
Quote: "You only have to decompress it once..."

Not true, it'll decompress each and every time you run it, to a new random temporary location.

Quote: "How do I use these plugins?"

You mean this plugin? First off, download it. then copy it into the correct folder. Then use it. You don't need to activate it as it's a free plugin. A quick search on the forum will reveal example programs using this plugin. (I highly recommend it to everyone)

My signature is NOT a moderator plaything! Stop changing it!
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 25th Aug 2010 05:07
What I mean by "use it" is "how do I use it?" Once it is installed properly, I just use the new commands (assuming I know them)?

www.dustinmcmurry.com
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Aug 2010 11:28
Quote: "Not true, it'll decompress each and every time you run it, to a new random temporary location."


You seem to misunderstand my point. I am talking about a compressed file of the game, which you decompress to a folder so you can run the game. The compressed version of the game is no longer needed, since you can always go back to that folder you decompressed to, to run the game. More like an installer.

Imagine playing Half Life 2 or something and having to decompress and install it every time you want to play

TheComet

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 25th Aug 2010 11:53
That's not the way that DBP compresses it's games. You're not talking about compressing it, rather than packaging it.

I imagined (since we weren't talking about installers) that you were talking about DBP's built in compression system. Which extracts each file on start up as I've explained.

No we understand you were on about an installer then everything's cool.

And yes,
Quote: "Once it is installed properly, I just use the new commands"


They're allmost exactly the same as the standard DBP ones, but instead of load music, or play music, you use load audio, and play audio. (You don't even need to use all the cool ass things which it can do. I'm using it to create an in car pc media player frontend. video linked here)

My signature is NOT a moderator plaything! Stop changing it!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Aug 2010 12:18
Oh, you were talking about the built in compression? Now I see

TheComet

The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 25th Aug 2010 12:31
@Igglepud:
If you really want smaller files, then simply use .ogg files with the SOUND commands. I do, and it works perfect.

Cheers

Slayer rules!!! Yeaaah, man!
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 26th Aug 2010 02:39
OK, if .ogg files work with sound, I will. Size isn't so much my concern as saving myself from writing a billion stop commands.

www.dustinmcmurry.com
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 17:52 Edited at: 26th Aug 2010 17:53
Quote: "What I mean by "use it" is "how do I use it?" Once it is installed properly, I just use the new commands (assuming I know them)?"


Yes

Quote: "saving myself from writing a billion stop commands."


If you use PLAY SOUND then the sound will automatically stop itself when it's done playing. If you use LOOP SOUND, then the sound will play over and over again.


Guns, cinematics, stealth, items and more!
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 27th Aug 2010 02:00
Thanks!

www.dustinmcmurry.com

Login to post a reply

Server time is: 2026-07-23 12:55:40
Your offset time is: 2026-07-23 12:55:40