Sound Lib for Slowing Down Sound

Started by
8 comments, last by Webbster 19 years, 2 months ago
I'm using SDL at the moment, with OpenGL. I want to be able to go slow motion during the game, easy enough to do the graphical side but I think it would be neat to slow the music and the sound effects down at the same time. Will something like SDL_mixer or OpenAL allow me to do this? What about FMOD? Thanks
Advertisement
I don't think there is a specific way of slowing down the speed the sound is played at but you could simulate it by including a small delay in your game loop between calls to playing the sound. This will require a bit of trial and error to get the delay right but it should be possible.
well, SoundTouch is LGPL, and pretty cool. I think either Audiere or PortAudio supports this natively, but I can't find it in their docs.
What are you trying to do? Do you want to actually physically stretch out the waveforms, meaning the sound becomes slow and lower-pitched, or do you need to keep the pitch the same? Doing the first is trivial; in DirectSound all you do is call SetFrequency() on the sound buffer and I would be surprised if something similar does not exist in SDL/OpenAL/FMOD. Doing the second is trickier because it requires some actual processing of the sound. I'm not sure how you would go about doing it.

@Spudder: That doesn't sound like it would slow the sound down so much as make it sound very choppy. Perhaps you could elaborate?
Quote:I don't think there is a specific way of slowing down the speed the sound is played at but you could simulate it by including a small delay in your game loop between calls to playing the sound. This will require a bit of trial and error to get the delay right but it should be possible.


I would be very surprised if any sound library used the main game thread to process audio. Slowing the main loop down would therefore do nothing. If the audio was being processed on the same thread, you would only get chop.
Don't be afraid to be yourself. Nobody else ever will be.
Quote:Original post by Webbster
I'm using SDL at the moment, with OpenGL. I want to be able to go slow motion during the game, easy enough to do the graphical side but I think it would be neat to slow the music and the sound effects down at the same time. Will something like SDL_mixer or OpenAL allow me to do this? What about FMOD?

Thanks


An effect like this can be achieved in OpenAL by lowering the pitch some, but then everything will be a little lower toned. Other than that OpenAL does not have anything that you could use to accompish this. If I come across anything in OAL, I'll share it with everyone.

- Drew
Quote:Original post by Drew_Benton
An effect like this can be achieved in OpenAL by lowering the pitch some, but then everything will be a little lower toned.

Which is what you'd want for a slow-motion effect. [smile]

More information here: OpenAL documentation (Frequency Shift by Pitch)



---
Was my post useful to you? Please use the rating system! [smile]
Quote:Original post by DEVLiN
Quote:Original post by Drew_Benton
An effect like this can be achieved in OpenAL by lowering the pitch some, but then everything will be a little lower toned.

Which is what you'd want for a slow-motion effect. [smile]

More information here: OpenAL documentation (Frequency Shift by Pitch)


Ohhh I see. Well I figured he wanted to slow down the tempo while perserving the pitch, which is what I am currently researching for my library. I use the pitch right now to slow down the music but I'd like to also find a way to keep that tempo. From what I've seen though, it may just require some DSP algo's.

There is also a sound library I just stumbled upon, Sound Touch. OP might want to take a look into that as well. repost by accident - lonesock already suggested this.

- Drew

[Edited by - Drew_Benton on February 7, 2005 2:48:05 PM]
What you want to do is lower the frequency. I'm not quite sure how it'd work in SDL_mixer, but it's easy enough to do in Open AL. The easiest way to modify it is like this:

float speedPercentage = 100.0f;//change this as neededALsizei modifiedFrequency = (ALsizei)(frequency * (speedPercentage / 100.0f));


Then all you need to use is the modified frequency in place of the frequency. That way it doesn't lower the pitch, but does slow it down.
Thanks for all the replies, it would seem as though some people are unsure as to the exact effect im trying to achieve.

Think: sound effects during Matrix Bullet time. Game examples might include Facewound!

This topic is closed to new replies.

Advertisement