Slow motion effect for sound

Hello,

I’m very new to FMOD. Actually I’ve interested in it because I need to implement one simple(as I think) thing - it’s slowing down music and sounds when pause menu occurs and accelerate up after it hides.

Something like here - https://vimeo.com/174327353

Is there a simple way achieve this? I tried just to set using default cocos2d-spritebuilder engine pitch linearly, but it work very bad…

How this effect can be done with FMOD? Can someone please provide some code example? Thank you in advance.

p.s.: is there any wrapper for Objective C? Just for using simple features like play, stop, pitch and other ?

Hi Volodymyr,

I would solve this with a simple parameter in the event editor, with a smoothing seek speed, or using a RPM parameter.
When you send the information to stopped your sound, you design de sound with change in pitch, or change the modulation ADSR in your pitch, or use a snapshot to change all sounds around.
You have many ways to do this.
Good luck!

Thank for the answer, however all looks very unclear for me…
Can you please provide some code example? I’m familiar with C++ a little bit, because I developing my game with Box2D. However, while now I’m trying to understand something from FMOD examples… it’s really complicated. I’m looking for lets say light solution.
Ideally, I’m looking for demo project with cocos2d-spritebuilder and playing any slowing down sound as you said. Because now from I can’t easily integrate it to my game or even play some sound… it’s like said on cocos2d forums - “engine for big boys” and yes, developers of Badland they are, but not me. I would really appreciate any help anyway, because I really need this cool effect into my game.

You can achieve this programmatically by getting the master channel group if you are using the low level API (System::getMasterChannelGroup).

With the master channel group call ChannelGroup::setPitch to lower the pitch of everything at the same time. You will want to call this several times over a certain duration to get a nice ramp down.

Objective-C and Objective-C++ are backwards compatible with C and C++ respectively, you can use our C API with .m files, if you want to use our C++ API rename your source file to .mm and use it directly.

Can you please give some Objective-C++ code example? Even for just some UIKit app would be great! Thanks.

I’m not in a position to provide code level support services, however the APIs are very straight forward and you can read about them online:

http://www.fmod.org/documentation/#content/generated/FMOD_System_GetMasterChannelGroup.html
http://www.fmod.org/documentation/#content/generated/FMOD_ChannelGroup_SetPitch.html

I’ve opened play_sound example and added code:

system->getMasterChannelGroup(channelgroup);
FMOD_ChannelGroup_SetPitch(channelgroup, 0.1);

However, it’s not compiling and I got an error:
No matching function for call to ‘FMOD_ChannelGroup_SetPitch’

Is any example of play and pitch sounds?

You can see an example of ChannelGroup::setPitch in the “channel_group” example.

Okay, I figure out. Thanks. This C isn’t so simple… Is any Objective C wrapper for your engine?

As I mentioned in the above answer, there is no Objective-C wrapper as the language is backwards compatible with C and C++. If you are finding C too different, use C++, just make sure your source files are .mm not .m or you will get compile errors.