CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Increased speed playback
The following methods can be used to increase playback speed in ADX:
  • Speed up the execution of a Cue's sequence
  • Speed up the playback while changing the pitch
  • Speed up the playback while changing the pitch

Speeding up the execution of the Cue's sequence

By using CriWare.CriAtomExPlayer::SetPlaybackRatio , the playback speed of the Cue's sequence can be increased.

The sound of the waveform and the timing of each event will occur earlier, but the pitch will not change.
You can use this method when you want to accelerate the triggering of events within a Cue.

Speeding up the playback while changing the pitch

With CriWare.CriAtomExPlayer::SetPitch , the playback speed can be increased while changing the pitch.

This function will only changes the parameters of the player.
If you want to apply the new parameters to a playing Voice, you need to call CriWare.CriAtomExPlayer::Update to actually update the parameters.
See the notes in the reference for more details.

Speeding up the playback without changing the pitch

Use CriWare.CriAtomExPlayer::SetDspTimeStretchRatio to maintain the original pitch while increasing the playback speed.

To use this function, you first need to attach it to the voice pool used by the player. The player also needs to be explicitly connected to the voice pool.(*1)

When creating a voice pool:
  • Explicitly assign a voice pool identifier
  • Specify a sampling rate at least twice the waveform playback frequency
If no voice pool was explicitly set for the player, the voice pool created within CriWareInitializer (i.e., the voice pool with an identifier of 0) will be used for the sound playback.
Therefore, it is necessary to assign an arbitrary identifier to a voice pool with a time stretch DSP attached to ensure audio playback. (*2)

At this time, the maximum sampling rate specified for the voice pool must be at least twice the waveform playback frequency. (*3)
When pitch shift is used, twice the amount of pitch shift must also be added to the value.

For example, when using CriAtomSource, the code will be like this:
CriAtomSource criAtomSource = gameObject.AddComponent<CriAtomSource>();
CriAtomExStandardVoicePool pool = new CriAtomExStandardVoicePool(1, 2, 64000 /* (*3) */, true, 2104 /* (*2) */);
pool.AttachDspTimeStretch();
criAtomSource.player.SetVoicePoolIdentifier(pool.identifier) //*1
criAtomSource.player.SetDspTimeStretchRatio(0.5f);