Jump to content


Photo

Fmod Sound System Engine


  • Please log in to reply
873 replies to this topic

#581 _212084

_212084

    GMC Member

  • New Member
  • 2 posts

Posted 16 June 2011 - 05:58 PM

You should get a medal for the effort you've put into keeping this thread alive since... 2007!? Wow. Well, I've got another question for you. When I run your demo (after importing it into Game Maker 8 with the .gmres), I get an endless stream of "illegal argument count" errors for each function that's called. I tried clicking through them with "Ignore", but 3 minutes later the messages were still coming. With such a broad and consistent error, there must be a simple solution to this, something really silly that I'm doing (or forgetting to do). Any ideas? Thanks in advance!

~Cheers
M.B
  • 0

#582 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 17 June 2011 - 04:08 AM

GM 8.1 broke the GM calling system for variable arguments. So make sure you always pass all the arguments even the default ones

One Function that have variable/default arguments is FMODSoundAdd, you must pass the stream and 3d option

For every complaint, note the function referred and change the call (eg, pass the missing 0s)
  • 0

#583 _212084

_212084

    GMC Member

  • New Member
  • 2 posts

Posted 17 June 2011 - 03:50 PM

GM 8.1 broke the GM calling system for variable arguments. So make sure you always pass all the arguments even the default ones

One Function that have variable/default arguments is FMODSoundAdd, you must pass the stream and 3d option

For every complaint, note the function referred and change the call (eg, pass the missing 0s)


Tedious, but it works. Thanks for getting back to me on that.

~Cheers
M.B.
  • 0

#584 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 17 June 2011 - 06:43 PM

I should have also said, you can change the code in the culprit functions to use the argument array as Mike.Daily said somewhere. but I felt this was safer for most
  • 0

#585 5thman

5thman

    GMC Member

  • GMC Member
  • 41 posts

Posted 27 June 2011 - 12:01 AM

I've been trying to use this save/load code with a game that also uses the FMOD wrapper, but there seem to be compatability issues, which don't seem to be present when I use the same save/load function with games that rely on GM's internal sound system (haven't thoroughly tested that yet though). Namely, when I load my progress the sound goes mute, and then shortly afterward the game hangs and crashes. The same thing happens if I use GM's save function too. Trouble is I need to allow the player to make multiple saves, because the game in question is nonlinear and relatively epic in scope, so a single save slot won't do. But neither will GM's inefficient internal sound system.

I've tried stopping and freeing all sounds pre-save/load, and loading all sounds again (as with Game Start) post-save/load: that at least got the music to play again, but the sound effects still wouldn't play and the game still crashed. Is there a certain way I have to handle save/load functions alongside the FMOD wrapper to prevent game-crashing code loops?
  • 0

#586 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 27 June 2011 - 03:07 AM

...


See "How Do I" links in the first post for saving and loading
  • 0

#587 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9259 posts
  • Version:Unknown

Posted 28 June 2011 - 05:12 PM

I have a question about the FMODInstanceGetWaveSnapshot function. I'm trying to use FMOD to get wave data, then save that as a WAV file. I have the WAV writing all working. The thing is, I'm writing the WAV using 8-bit mono samples at 44100Hz. I thought that, in the step event, querying FMODInstanceGetWaveSnapshot with a size of sampleRate/room_speed would give me the correct buffer data I need (sampleRate is in samples/second, room_speed is in steps/second, so the result should be the correct samples/step). However, when I write a WAV using this data, it's always sped up, making me think either I'm using the function wrong or I've miscalculated.

Someone suggested that perhaps FMOD returns stereo data, so I tried averaging each pair of sample values into one sample, but it still resulted in sped-up audio in the resulting WAV.

So I'm thinking the format is just different. What differences are there from the format the function returns and 8-bit mono?

-IMP ;) :)
  • 0

#588 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 28 June 2011 - 06:48 PM

I have a question about the FMODInstanceGetWaveSnapshot function. I'm trying to use FMOD to get wave data, then save that as a WAV file. I have the WAV writing all working. The thing is, I'm writing the WAV using 8-bit mono samples at 44100Hz. I thought that, in the step event, querying FMODInstanceGetWaveSnapshot with a size of sampleRate/room_speed would give me the correct buffer data I need (sampleRate is in samples/second, room_speed is in steps/second, so the result should be the correct samples/step). However, when I write a WAV using this data, it's always sped up, making me think either I'm using the function wrong or I've miscalculated.

Someone suggested that perhaps FMOD returns stereo data, so I tried averaging each pair of sample values into one sample, but it still resulted in sped-up audio in the resulting WAV.

So I'm thinking the format is just different. What differences are there from the format the function returns and 8-bit mono?

-IMP ;) :)


try placing your code in a tight loop

ins = sound play
while(is playing ins)
{
get data ins left
get data ins right
merge values
save data
fmod update
}

this should eliminate any problem related with room speed (to debug)
But I suspect a mismatch in either stereo, mono, sample size

If you go on the fmod forum there are people asking how to properly save wav. I don't support fast reading of the sound as mentioned in the forum but there are math formulas there that will help you.
  • 0

#589 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9259 posts
  • Version:Unknown

Posted 28 June 2011 - 10:38 PM


I have a question about the FMODInstanceGetWaveSnapshot function. I'm trying to use FMOD to get wave data, then save that as a WAV file. I have the WAV writing all working. The thing is, I'm writing the WAV using 8-bit mono samples at 44100Hz. I thought that, in the step event, querying FMODInstanceGetWaveSnapshot with a size of sampleRate/room_speed would give me the correct buffer data I need (sampleRate is in samples/second, room_speed is in steps/second, so the result should be the correct samples/step). However, when I write a WAV using this data, it's always sped up, making me think either I'm using the function wrong or I've miscalculated.

Someone suggested that perhaps FMOD returns stereo data, so I tried averaging each pair of sample values into one sample, but it still resulted in sped-up audio in the resulting WAV.

So I'm thinking the format is just different. What differences are there from the format the function returns and 8-bit mono?

-IMP ;) :)


try placing your code in a tight loop

ins = sound play
while(is playing ins)
{
get data ins left
get data ins right
merge values
save data
fmod update
}

this should eliminate any problem related with room speed (to debug)
But I suspect a mismatch in either stereo, mono, sample size

If you go on the fmod forum there are people asking how to properly save wav. I don't support fast reading of the sound as mentioned in the forum but there are math formulas there that will help you.

Thanks for responding. If I put it in a while() loop, even for testing, I have no idea how to time it. The WAV needs to sample at a constant rate--in this case, 44100 samples per second. A while() loop will cycle at whatever the computer's clock speed is, right? And there's no way to get that value, nor is is constant, right? So how do I time my samples if it's in a while() loop? As in, how do I calculate the size of the snapshot to use?

-IMP ;) :)

*EDIT* By the way, I've ruled out the possibility this has anything to do with stereo vs. mono, since I'm getting a snapshot of only channel 0 (left channel) and it's still going fast.

*EDIT2* Some more info has come to light. I had been using songs (or the beginnings of songs) to test this, and I always thought the audio was just too fast. But I tested it with a metronome for comparison, and it turns out it's not just fast. It starts out normal speed, then over time it speeds up faster and faster. Does this help you pinpoint the issue?

Edited by IceMetalPunk, 29 June 2011 - 12:23 AM.

  • 0

#590 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 29 June 2011 - 03:25 AM

can you try getting the data on the group (main)? I think the default is 44100 or 48000

http://www.fmod.org/...keywords=saving

you could also try the sleep command and the pause

ins = sound play, paused
while(is playing ins)
{
unpause
sleep for the ms matching a frame bit rate
fmod update
pause

get data ins left
get data ins right
merge values
save data
}


I really don't know how to calculate this though
  • 0

#591 5thman

5thman

    GMC Member

  • GMC Member
  • 41 posts

Posted 01 July 2011 - 02:16 AM


...


See "How Do I" links in the first post for saving and loading


Read through it. Didn't realize the scripts I was using also used the built-in save system...

Is the code you listed there the only way to save/load with FMOD? or will anything work as long as I stop and free all sounds before save/load, and load all sounds again after save/load (and as long as it isn't the GM save function)?
  • 0

#592 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 01 July 2011 - 02:24 AM

Is the code you listed there the only way to save/load with FMOD? or will anything work as long as I stop and free all sounds before save/load, and load all sounds again after save/load (and as long as it isn't the GM save function)?


the concept applies for both GM and programmer implemented methods yes
  • 0

#593 zmaj

zmaj

    GMC Member

  • GMC Member
  • 323 posts

Posted 04 July 2011 - 08:27 AM

Great dll...
Can I got a help?

I need to record voice(mic input), and in real time mix with music on one or both channel (stereo music)...
Of course, final output must one mixed file?
Also, i need to decrease volume of music while I do voice recording, and increase after recording...
It's that possible?
Format of output file can be *.wav or *.mp3 or something else (*.ogg or similar i don't care really)...
  • 0

#594 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 04 July 2011 - 06:21 PM

I dont know if it is possible to record to a file; see the posts above yours.

The mic stuff is in the last demo room or the merge file
  • 0

#595 zmaj

zmaj

    GMC Member

  • GMC Member
  • 323 posts

Posted 06 July 2011 - 08:16 PM

I dont know if it is possible to record to a file; see the posts above yours.

The mic stuff is in the last demo room or the merge file


Oh... but sims it's possible...
If you change output ( force) to WRITEWAV than is possible to write all channels to one single WAV file...
But you miss something... Where come address where to save... A name of particular WAV file...

Can you fix that?
  • 0

#596 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 06 July 2011 - 10:25 PM

Yes, there is a fmod option option that allows saving directly to file. nope I'm not adding it. You can use the source to make your own dll if you want.
  • 0

#597 zmaj

zmaj

    GMC Member

  • GMC Member
  • 323 posts

Posted 07 July 2011 - 02:40 PM

Tnx..man...

I will see with Brandom....
  • 0

#598 gmcsdobbie

gmcsdobbie

    GMC Member

  • GMC Member
  • 298 posts

Posted 08 July 2011 - 10:15 PM

I am having a problem with the frequency function. I have an object which is moving with hspeed vspeed and speed. This is what I am using. This function just stops the sound for some unknown reason. I also set up a test variable that uses this function and it just returns 0.

FMODInstanceSetFrequency(soundWingsuitinstance,freq*max(1,max(abs(hspeed),abs(vspeed),speed)/5));

Edited by gmcsdobbie, 08 July 2011 - 10:19 PM.

  • 0

#599 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14386 posts
  • Version:GM:Studio

Posted 09 July 2011 - 12:05 AM

start playing:
soundWingsuitinstance = FMODSoundPlay(sound);
freq = FMODInstanceGetFrequency(soundWingsuitinstance)


step:
FMODInstanceSetFrequency(soundWingsuitinstance,freq * (1 + speed/5));
  • 0

#600 gmcsdobbie

gmcsdobbie

    GMC Member

  • GMC Member
  • 298 posts

Posted 09 July 2011 - 09:44 AM

Thankyou. That works.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users