Author Topic: media clip  (Read 11828 times)

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
media clip
« 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!

Dr Obvious

  • Regular
  • **
  • Posts: 53
    • View Profile
    • http://www.drobvious.net
Re: media clip
« Reply #1 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?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: media clip
« Reply #2 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?

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: media clip
« Reply #3 on: 2006-01-08, 12:18:16 PM »
  • The file for the note is 54 bytes
  • It runs fine without music
  • No other box is checked
  • Other games don't lag when they play sound

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: media clip
« Reply #4 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.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: media clip
« Reply #5 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...

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: media clip
« Reply #6 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...  :(

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: media clip
« Reply #7 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)?
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: media clip
« Reply #8 on: 2006-01-09, 07:03:45 AM »
Would you be interested in posting your project someplace so I can investigate?

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: media clip
« Reply #9 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

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: media clip
« Reply #10 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.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: media clip
« Reply #11 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.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: media clip
« Reply #12 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.  :)


bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: media clip
« Reply #13 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.

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
Re: media clip
« Reply #14 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... 
~bat