Multi-instruments Playing Backwards

Is it possible to get multiinstruments and scatterer instruments playing backwards setting the frequency to a negative value as it says on this post?
https://qa.fmod.com/t/reversing-a-sound/10524

I can play single sounds reversed using setFrequency and setPosition to the end of the sound. But it doesn’t work for me using multisounds or scatterer.

Thanks in advance

This is my code to change the frequency:

    soundEvent.start();
    soundEvent.setTimelinePosition(timelinePosition % (int)GetEventLength(soundEvent, true));
    
    RuntimeManager.StudioSystem.flushCommands();
    while (!IsEventState(soundEvent, PLAYBACK_STATE.PLAYING) && !IsEventState(soundEvent, PLAYBACK_STATE.STOPPED));
    
    soundEvent.getChannelGroup(out ChannelGroup channelGroup);
    channelGroup.getGroup(0, out ChannelGroup auxGroup);
    auxGroup.getChannel(0, out Channel channel);
    channel.setFrequency(frequency);

If I don’t call flushcommands after starting the event, it doesn’t detect that event is started. Is this true?

I need to take the channel to set the frequency, but I need to wait to the event to be playing to take the channel.

  1. I don’t know if this is the correct way to change the frequency of a sound.

  2. Also, I want to change the frequency on update time, to play the same sound at different velocities. This includes to call flushcommands on every frame then, and my engine collapses because it takes a lot of time to perform the action. How can I solve that?

Thanks again, can anyone help with that?

Instead of using flushCommands, using StudioSystem.update() would do the same job more effeciently, as flushCommands will block the thread until all pending commands are executed.

Digging in to the channels and changing frequency isn’t really advised as it can wreak havoc on the playback system, especially if you are trying to play things backwards with a negative frequency.

There are a couple of ways you can go about making a rewind effect.

  1. Use a Master Bus custom DSP that writes the audio into a buffer, then when it is time to rewind the buffer can be flipped and played back.

  2. Using a generic “audio rewinding” sound effect rather than actual captured audio. This is a much simpler solution and can often produce the required results.

I need to change the frequency on realtime, because when replaying again, listeners can be moved (imagine it’s like a replayer of your gameplay, but changing the camera). I can’t do option number 1, and number 2 doesn’t solve my problem…

There’s no way to reproduce all the different events in backwards? It’s not possible to get the masterchannel of an event and change its frequency?

Thanks again

Is there a reason you cannot do this? It sounds like your only real option at this point.

You can only change the frequency on Channels not ChannelGroups.

Because it’s a replayer, and it needs to be reproduced forward and backward on real time in different velocities (not 1x, 2x, but progressive from 0x to 2x, so it can be 1.35x equivalent to 64800Hz (48000Hz for the real sample).

So I understand is not possible to manage a multitrack event playing backwards or different frequencies on realtime, because of the possible breakdown on the playback system.

Also I’ve tried to change the frequency on a single channel with a multitrack or scatterer event and it doesn’t works.