CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
About Voice

What is a Voice?

A Voice is the most basic object for sound playback.
It loads data, decodes it and plays sound.
When playback is triggered, a voice is assigned from the voice pool and used to play a sound.
One voice is required to play one waveform. Therefore the number of waveforms that can be played in an application depends on the number of available voices.

adx2u_keys_ADX_A_01.png


Virtual voice

Specifying the number of voices

The number of voices can be specified when a voice pool is created. This way, the maximum number of simultaneous voices allowed in an application can be controlled.
However, the bigger the number of voices is, the bigger the memory needed is and the higher the CPU load. So it is a good idea to limit the number of voices to a reasonable range for your application.
If a platform uses hardware voices, you cannot create more voices than what is allowed by the hardware specifications.

What is a virtual voice?

The CRI Atom library uses a "virtual voice" object in addition to the voice.
A virtual voice is an object that is used to manage the parameters and playback time and to play a sound.

In most cases, you do not need to know the existence of a virtual voice, because it is combined with a voice.
However, by changing the voice allocation method, you can use a virtual voice as a virtual sound source with no voice.

Default behavior of a virtual voice

By default, the CRI Atom library combines a virtual voice and a voice for playback.
For example, when sound data is set in the player and the playback function is executed, the player obtains the required numbers of virtual voices and voices.
If both virtual voices and voices can be obtained, the sound is played. If the number of voices or virtual voices is insufficient, then the data is not played.

Using a virtual voice as a virtual sound source

When the "Use a virtual voice as a virtual sound source" option is selected as the voice assignment method, the player starts playing a sound with a virtual voice, even if a voice could not be obtained.
No sound is being played because there is no voice available, but the virtual voice is used to record any parameter changes and manage the playback position.
The virtual voice periodically checks for a free voice during playback, and uses one as soon as it becomes available.
So even when no voice has been acquired when the playback started, or if a voice was taken away due to priority control, the playback can be started again as soon as a voice becomes available.