How to slow down sound playback?

Hello,

I have been trying to slow down the speed of an audio file to half. Its because my game utilizes a time effect that of you press a button the time slows down. And the movement of objects and other entities slows down. So I have to slow audio speed as well when time slows down. Is there a way to do this?

Hi. Checkout the following link:

http://coronalabs.com/blog/2011/07/27/the-secretundocumented-audio-apis-in-corona-sdk/

Download and play with the following example. This helped me immensely.

https://github.com/alix-ansca/ALexplorer

You can change the pitch which will therefore change the playback speed. I successfully used this feature to make a scrubbing effect in a video app(I made the sound match the speed and position of the video dynamically).

These are the important lines:

[lua]

mySource = audio.getSourceFromChannel(1)

al.Source( mySource, al.PITCH, 0.5 )

[/lua]

You could also call this several times with a slight delay to soften the transition from full to half speed e.g. 1.0, 0.9, 0.8, 0.7, 0.6, 0.5. 

From memory I used audio.loadStream for all sound effects. Not sure if that is necessary.

Thank you! That really helped :slight_smile:

Hi. Checkout the following link:

http://coronalabs.com/blog/2011/07/27/the-secretundocumented-audio-apis-in-corona-sdk/

Download and play with the following example. This helped me immensely.

https://github.com/alix-ansca/ALexplorer

You can change the pitch which will therefore change the playback speed. I successfully used this feature to make a scrubbing effect in a video app(I made the sound match the speed and position of the video dynamically).

These are the important lines:

[lua]

mySource = audio.getSourceFromChannel(1)

al.Source( mySource, al.PITCH, 0.5 )

[/lua]

You could also call this several times with a slight delay to soften the transition from full to half speed e.g. 1.0, 0.9, 0.8, 0.7, 0.6, 0.5. 

From memory I used audio.loadStream for all sound effects. Not sure if that is necessary.

Thank you! That really helped :slight_smile: