Scrolling Game Development Kit Forum

SGDK Version 1 => Help/FAQ => Topic started by: eric22222 on 2006-01-07, 02:40:18 PM

Title: media clip
Post by: eric22222 on 2006-01-07, 02:40:18 PM
Hi, I've been working on my first project with gamedev (loving it), and I'm having some trouble with media clips. I have it set up that you can collect 100 music notes for an extra life (I know, very cliche'). Using a sheet music program, I made a very quick midi for the item: a single note on a marimba. The problem is, whenever the player gets an item, it'll play the sound, but the game lags first...

I've got "keep loaded" and "allow interrupt/restart" checked. I've tried turning the midi into wav file, but that really didn't do anything but make it laggy with a low quality sound.

Any ideas? I'm running 1.4.6, if that helps at all... Thanks!
Title: Re: media clip
Post by: Dr Obvious on 2006-01-07, 02:53:00 PM
What's the size of the file?  I don't know about midi's, but I didn't have problems running .wav's (even decent sized ones) without lag except for maybe the first time it was played.

Have you maybe tried it without music to see if it still lags and it maybe something else?
Title: Re: media clip
Post by: bluemonkmn on 2006-01-07, 11:05:04 PM
Do you have anything else checked for the sound?  Suspend other media would certainly cause a delay if that's checked.  Do other games lag when they play sounds on your system?
Title: Re: media clip
Post by: eric22222 on 2006-01-08, 12:18:16 PM
Title: Re: media clip
Post by: bluemonkmn on 2006-01-08, 05:54:56 PM
Can you find another game that is doing something similar to what you want to do as far as sounds?  Try using the same sound file formats as another project that's working correctly.  I think if you have everything in WAV format, you should be OK, but you said you already tried that.  Maybe you should try it again.  It might lag on the first play, but after that it shouldn't lag... at least not if you see other projects working correctly.
Title: Re: media clip
Post by: eric22222 on 2006-01-08, 08:13:55 PM
Okay, I tried putting all my sounds in wav format; still no good...

The sample "dungeon" project has the sound the way it should work. So I tried redefining my note sound as the "get key" sound from the dungeon project, but it still lags. I'm going to try making a quick test project to see if it's just this one...
Title: Re: media clip
Post by: eric22222 on 2006-01-08, 08:45:51 PM
Even on an extremely simple test project, I'm still getting lag on the sound! I've set everything exactly as it is in the sample project, except for one thing: "raise an event for this interaction," which I'm fairly certain is just for script, which I don't think I'm going to try to learn.

This almost makes it seem like it's not worth it...  :(
Title: Re: media clip
Post by: durnurd on 2006-01-08, 10:50:23 PM
It may be a problem with the format of the wave file itself.  The delay my be in the wave file itself or in the decoding that has to be done before playing the sound.  You used the sound directly from the sample project and still it lagged?  Do you know the format of wave files you're creating (bit rate, encoding, etc)?
Title: Re: media clip
Post by: bluemonkmn on 2006-01-09, 07:03:45 AM
Would you be interested in posting your project someplace so I can investigate?
Title: Re: media clip
Post by: eric22222 on 2006-01-09, 06:32:19 PM
The wav files I'm creating are 44 kHz; I just grabbed a trial version of a midi to wav convertor from the internet... I'm not sure if this usually happens, but it's making a huge file in comparison...

And I'm not sure what small enough would be, but here's a trimmed version, at under 250 kb:

http://eric22222.tripod.com/id39.html (http://eric22222.tripod.com/id39.html)
Title: Re: media clip
Post by: durnurd on 2006-01-09, 08:14:51 PM
Wave files are generally always, always much, much bigger than their MIDI counterpart, so that's nothing to worry about.

Looking at the wave file, I notice that, like I thought, there is a small delay at the beginning before the sound begins (about .15 seconds).  Looking at the MIDI file as well, I noticed that there are two notes starting at the same time within it.  If this is because you wanted it to be louder, you could just increase the volume of the note (which I've done)  I've attached fixed versions of both files directly to this post.  I tested the game, and it seems to work just fine.

I also trimmed the wav file so it takes up less space.  I would have saved it compressed, but that begins to add a hiss if I save it as 8-bit PCM.  I did also include an MP3 version of the file (compressed), but a problem with MP3 is that it inherently has a delay at the beginning that you can't get rid of (only .02 seconds though, much better).  Take whichever one you want (my suggestion would be to go with the MIDI file frankly).

If there is still a delay when you play the game, the problem may be with your computer or sound card or version of DirectX.
Title: Re: media clip
Post by: bluemonkmn on 2006-01-09, 08:54:03 PM
I downloaded it, and managed to play it after fixing a couple things.  But none of the sound effects were set up.  So I added some of your sound effects to some of the tile interactions, but didn't notice much of a lag.  I noticed a slight lag on your sound effects (because of teh empty space at the beginning of the sound), but the GetKey sound effect seemed to play as fast as it does in the sample game.
Title: Re: media clip
Post by: eric22222 on 2006-01-10, 11:11:41 PM
Well, in summary... the sfx still don't work quite right whenever I play any of my games... The sample dungeon project works fine, but if I swap out one of my sounds, it doesn't play at all, but no lag. Background music works fine. I tried updating DirectX, but that didn't help either... Considering it works fine for you guys, I'm guessing it's just my computer, or something.

On the plus side, I'm about to start collaborating with a friend of mine on a brand new project (he's doing the graphics to make up for my lack in that department  ;)). Since we'll be going back and forth between our computers, it just might work out all right, eventually. But thanks for the speedy reply and tons of help... I'll keep on using GameDev, for sure. I'll just work without sfx on my own computer. I still hope to put out a great project.  :)

Title: Re: media clip
Post by: bluemonkmn on 2006-01-11, 06:30:15 PM
Well, don't be too hasty there.  There was a slight delay in your sound effects because, as durnurd said, you left a blank space at the beginning of the WAV file.  The only sound that didn't have a delay was the GetKey sound.  So even though your games work correctly when using other people's sound effects, you should still fix your own sound effects so that they don't have a delay.
Title: Re: media clip
Post by: bat on 2006-01-14, 04:24:13 PM
i didn't read everything... but sound effects seem to be delayed on my computer, also. On "Cinos" (a very cool game!!!!)  whenever i pick up a coin (in the game), the computer seems to freeze for a second... 
Title: Re: media clip
Post by: eric22222 on 2006-01-14, 11:13:21 PM
Yeah, that's pretty much what I was dealing with... If nothing they've said helps you any, you can just edit out the sfx and play the game (it's worth the effort; the game is meant to be fast!).
Title: Re: media clip
Post by: eric22222 on 2006-01-20, 08:14:48 AM
Alright, here's a question that's somewhat still on the same topic:

What's so great about wav files? If I create a midi file that will be higher quality and lower file size than a wav, why should I convert it? The games I'm working on have tons of levels, and I'd like to create enough background music so that the songs are only repeated a few times among the levels. If I were to convert them to wavs, though, I'd be dealing with massive game! Any reason I shouldnt leave them as midis?
Title: Re: media clip
Post by: durnurd on 2006-01-20, 08:29:52 AM
The only reason to convert them to Wav files is to keep the sound quality.  People with different sound cards end up hearing MIDI files differently because of the way that the MIDI sounds are rendered.  Converting it to a Wav file negates this difference in sound, but I don't think that anybody will care if it sounds different on different systems.  A lot of the older games that use MIDI music have this anyway.

Oh, and some sound cards apparently can't play MIDI and Wav at the same time, but those must be incredibly old, out of date cards.
Title: Re: media clip
Post by: billybob884 on 2006-01-20, 08:30:22 AM
well, i dont know about midis, but wavs are better than mp3's because when you loop them they dont have that 1/2 a second of silence at teh end (or however big it is)
Title: Re: media clip
Post by: eric22222 on 2006-01-20, 10:24:14 PM
Alright then, I'll just keep 'em all as midis. I'd rather have a wide variety of music for my games. I've always been a fan of video game music... Banjo-Kazooie, Chrono Trigger, even Super Mario World (Haven't played enough Final Fantasy games to be a fan).

Yeah, I was looking at the other games that have been submitted. I'm going to try to keep the file size manageable. Didn't seem like there was much over a few megabytes, except for Turok's World, but I didn't mind its file size; it kept me laughing  :).

Looks like I can have as many songs as I need!

Thanks again, guys!
Title: Re: media clip
Post by: cbass on 2006-01-21, 02:13:00 PM
well, i dont know about midis, but wavs are better than mp3's because when you loop them they dont have that 1/2 a second of silence at teh end (or however big it is)

I'm kind of a noob on wav's.  The only ones I've ever dealt with are when ripping a cd and getting a large 30+meg file for a few minutes of audio.  Without knowing anythng more, the only place I would use waves in a gamedev project would be quick <2 second sound effects.  Any large files that would be looped (background music) I would most likely have as midi, or possibly mp3.

An option for good sound quality is to release 2 versions of the game, 1 with wav's and 1 with mp3's and midis.  One would be a massive download, and the other would be more manageable but with less quality of sound.
Title: Re: media clip
Post by: durnurd on 2006-01-21, 02:20:40 PM
Wav files are rarely if ever used in current-day games (Doom 3, KOTOR, Evil Genius are my refference points, but most games are similar).  Almost all files are MP3, OGG Vorbis, BIK, or some format of the company's own devising (which is usually just a TAR-like file containing a bunch of smaller files of the previously mentioned types).

I would sooner upload a game that includes the OGG Vorbis codec installer and uses OGG files than using Wavs.
Title: Re: media clip
Post by: GameDeveloper on 2006-01-21, 02:25:36 PM
  I was wondering, how would I be able to record midi files or any other kind of format other than wav.?  I currently only use the microsoft recorder-type-device/program, and I would really like for my games to be a smaller size!  Is there a free program I can download to do this?  Is there a way to convert?  I just need to know, because most of my games are a tremendous size because of the sound!   Any help would be greatly appreciated.
Title: Re: media clip
Post by: durnurd on 2006-01-21, 03:16:14 PM
I personally use Goldwave (Goldwave.com (http://www.goldwave.com)) for all my audio editing etc.  Very nice program.  It lets you save in many many different formats, including Wav (of course) MP3-compressed wav, MP3, ogg, and others. (however, you need to download an MP3 converter to save as an MP3 file).  You want to make sure you know what all the Kb/s, Sample rate, bit-rate etc. numbers mean as far as size and sound quality go.  I'm still not sure myself :p

As for MIDI, I use Voyetra Record Producer, however it's not free and you only get it for 30 days with the trial version (Voyetra (http://www.voyetra.com/site/products/rp/)).  I don't actually know of any completely free MIDI orchestration tools that are any good.  Do you have a MIDI piano keyboard that you use, or would you be composing the music note by note in the program?
Title: Re: media clip
Post by: GameDeveloper on 2006-01-21, 03:19:56 PM
Thanks for the programs.  I do have a MIDI keyboard, I believe.  At least it's compatible.  I believe I've tried doing the note by note way, but it wasn't my 'thing'.  I'll try to hook up my Keyboard and try these programs out.

Thanks agian, Durnurd.
Title: Re: media clip
Post by: Zorb Burger on 2006-01-21, 03:22:22 PM
DAYUMM!!  durnurd teh man!! he help me out wit math, but i no not he good at nay music kinda stfuf.  dood yer lik a nerd wit math smarts an a girl wit music tallent and crap!!  u gots it all :D :)
Title: Re: media clip
Post by: GameDeveloper on 2006-01-21, 08:41:54 PM
I have a problem.  Any kind of sound editing program I download, I can't hear anything after I record [including GoldWave].  What could be the problem?  Is it because I have integrated sound[motherboard]?  It just kind of frustrates me, and I don't want to be stuck with enormous file size for my games.  Any suggestions?
Title: Re: media clip
Post by: durnurd on 2006-01-21, 09:03:56 PM
I'll troubleshoot Goldwave anyway.  First of all, whatever program you were using before, does that still work?  If not, then it's probably a problem with a volume control.  If it does work, then try a couple of things in Goldwave:

Can you play files that you have previously recorded in another program using Goldwave (just open them and press play or Spacebar)?  If you can, then the problem is probably that it's not recording or not recording loud enough.  After you record sound, does a wave form show up in the main window?

Press F11 to open the Control properties, then go to the Volume tab.  Make sure the "microphone" box is checked (assuming that's the input you're using) and that it's not turned to zero.  Then create a new wave file about 5 seconds long ("5.0").  Record something, anything, for the length of time.  Then, go to the effects menu->Volume->Maximize and press OK.  This should make anything it did record become loud enough for you to hear if it wasn't before.  Then try playing it again.

If you can't hear files you recorded using a different program in Goldwave, can you hear them using other programs (like the one you used to record)?
Title: Re: media clip
Post by: GameDeveloper on 2006-01-21, 09:14:07 PM
Well, I did what you said and everything seems to work fine, except for the quality.  When I turn the volume all the way up, I can hear a very loud wind-like sound, it nearly overwhelms the sound itself.  Is there some way to edit that out?  If not, then it should be ok.
Title: Re: media clip
Post by: durnurd on 2006-01-21, 09:20:36 PM
So the problem is probably that your microphone is turned too far down or is too far away from your mouth (or whatever is making the sound) and too close to a computer fan or something.  If you go back into the volume tab and turn up the microphone some more, give it a little boost, that should help a little.  And another thing you can do with Goldwave is edit out background noise.  There are predefined ways to do this, or you can do it manually.  To do it automatically, from the Effects menu, choose Filter->Noise reduction.  Then at the bottom, in the "Presets" combo, choose either "Reduce Hum" or "Remove Hiss" depending on what the noise is more like.  To do it manually, find a small part of the sound that is just background noise (it doesn't have to be very long.  0.1 seconds is plenty.) abd select it and copy it (Ctrl+c, just like normal).  then Filter->Noise Reduction, and in the Preset combo choose "Clipboard Noise Print" which will remove noise similar to whatever you copied.  It works incredibly well for getting rid of a humming fan or something similar.
Title: Re: media clip
Post by: GameDeveloper on 2006-01-21, 09:22:53 PM
Wow, thanks for the suggestions, I'll try that immediately.  Hopefuly now my games wont be such an enormous size.