CRI ADX  Last Updated: 2024-07-17 10:47 p
Insertion DSP (Time stretch)

Sample Directory

/CRIWARE/SDK/pc/samples/criatomex/insertion_dsp_time_stretch


Sample Description

This sample demonstrates the time stretch feature which changes playback speed without changing pitch.
Time stretch cannot be set up as DSP bus effect as time length changes.
To use the time stretch feature, attach it to a voice.

The procedure for using the time stretch feature is shown below:
  1. Add the time stretch feature to a voice pool by the criAtomExVoicePool_AttachDspTimeStretch function.
  2. Set ID of the voice pool to a player, which the time stretch feature is attached to, by the criAtomExPlayer_SetVoicePoolIdentifier function.
  3. Set time stretch parameters to the player by the ::criAtomExPlayer_SetDspParamteter function.
  4. Start playback by the player.
The follwing items are time stretch parameters:
A sample code to use the time stretch feature is shown below:
#define TIME_STRETCH_VOICEPOOL 0x02
:
/* Voice pool configuration */
voice_pool_config.identifier = TIME_STRETCH_VOICEPOOL;
/* Create a voice pool */
app_obj->voice_pool = criAtomExVoicePool_AllocateStandardVoicePool(&voice_pool_config, NULL, 0);
/* Configure the time stretch settings */
CriAtomExDspTimeStretchConfig time_stretch_config;
time_stretch_config.num_dsp = voice_pool_config.num_voices;
time_stretch_config.max_channels = voice_pool_config.player_config.max_channels;
time_stretch_config.max_sampling_rate = voice_pool_config.player_config.max_sampling_rate;
/* Add a time stretch */
criAtomExVoicePool_AttachDspTimeStretch(&app_obj->voice_pool, &time_stretch_config, NULL, 0);
:
/* Set voice pool ID */
criAtomExPlayer_SetVoicePoolIdentifier(app_obj->player, TIME_STRETCH_VOICEPOOL);
/* Increase the time length to 1.2 times (slower) */
/* Start playback */
criAtomExPlayer_Start(app_obj->player);
#define criAtomExVoicePool_SetDefaultConfigForDspTimeStretch(p_config)
Assign the default values to the configuration structure used to attach a time-streching DSP.
Definition: cri_le_atom_ex.h:1141
void criAtomExVoicePool_AttachDspTimeStretch(CriAtomExVoicePoolHn pool, const CriAtomExDspTimeStretchConfig *config, void *work, CriSint32 work_size)
Attach a time-stretching DSP.
void criAtomExPlayer_SetVoicePoolIdentifier(CriAtomExPlayerHn player, CriAtomExVoicePoolIdentifier identifier)
Specify the Voice Pool identifier.
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
void criAtomExPlayer_SetDspParameter(CriAtomExPlayerHn player, CriSint32 param_id, CriFloat32 param_val)
Set a DSP parameter.
#define criAtomExVoicePool_SetDefaultConfigForStandardVoicePool(p_config)
Assign the default values to the configuration structure used to create a standard Voice Pool.
Definition: cri_le_atom_ex.h:564
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateStandardVoicePool(const CriAtomExStandardVoicePoolConfig *config, void *work, CriSint32 work_size)
Create a standard Voice Pool.
@ CRIATOMDSP_TIMESTRETCH_PARAM_RATIO
Stretch ratio.
Definition: cri_le_atom.h:2775
Configuration structure used to attach a time-stretching effect.
Definition: cri_le_atom_ex.h:4934
CriSint32 num_dsp
Number of DSPs created.
Definition: cri_le_atom_ex.h:4940
CriSint32 max_sampling_rate
Maximum sampling rate used for DSP.
Definition: cri_le_atom_ex.h:4956
CriSint32 max_channels
Maximum number of channels for DSP.
Definition: cri_le_atom_ex.h:4948
Configuration structure used when creating a standard Voice Pool.
Definition: cri_le_atom_ex.h:3255
CriSint32 num_voices
Definition: cri_le_atom_ex.h:3257
CriAtomExVoicePoolIdentifier identifier
Definition: cri_le_atom_ex.h:3256
CriAtomStandardPlayerConfig player_config
Definition: cri_le_atom_ex.h:3258
CriSint32 max_sampling_rate
Maximum sampling rate.
Definition: cri_le_atom.h:1466
CriSint32 max_channels
Definition: cri_le_atom.h:1448



Attention
The time stretch feature cannot be applied to HCA-MX sound.
To use the time stretch feature, please use for ADX or HCA data.