CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Streaming

Memory playback and streaming playback

The playback done after loading the entire sound data in memory is called "memory playback."
The playback done gradually while loading the next chunk of data in memory is called "streaming playback."
Advantages and disadvantages of each method are as follows:
Memory playback Streaming playback
Memory size Disadvantage: Needs a large working memory Advantage: Needs a smaller working memory
Playback preparation Disadvantage: Playback cannot start until the entire sound data is loaded Advantage: No need to wait for the entire sound data to be loaded
Latency Advantage: Smaller latency Disadvantage: Larger latency (time between the reception of a playback request and the start of the streaming)
File access Advantage: Does not prevent other files from being loaded during playback Disadvantage: Loading of other files requires more time
Many applications cannot provide a memory buffer that is large enough to store very long waveforms.
In such cases, streaming playback is required, because it can play sound data while using less memory.

How streaming playback works

Any sound data for which streaming playback has been specified in the tool will be automatically streamed when the corresponding Cue is played by the runtime.
Concretely, if the name of a sound file (or the file ID) present in an AWB file is passed, then the sound data is streamed. (An AWB file can pack multiple sound files.)

The application assigns a streaming buffer at initialization. Later, a voice that is streamed will use this buffer as required.

adx2u_overview_dbas.png


D-BAS

In streaming playback, a buffer of a fixed size is used repeatedly.
This buffer is called a streaming buffer.
ADX uses CRI's proprietary D-BAS technology to efficiently manage a streaming buffer.
D-BAS secures a fixed-size streaming buffer beforehand,
and assigns blocks of that streaming buffer to each streaming playback operation.
D-BAS has the following advantages:
  1. The size of the streaming buffer can be estimated easily.
  2. A fixed-length streaming buffer can be used efficiently.
  3. No external fragmentation of memory occurs.
To create D-BAS, specify the maximum number of streaming playbacks and the maximum instantaneous bit rate of the streaming playback in the application.
That is, assume the worst case of the streaming playback.
If any other data such as a movie is streamed at the same time, it needs to be included in the number of streamed playbacks and for the calculation of the maximum bit rate required.
Then the streaming buffer that will be secured will be large enough for the worst case.
As long as the application follows the settings passed when the D-BAS was created, streaming will not stop.
(An error will occur if the streaming playback exceeds the settings.)
Based on the number of streaming playbacks and the bit rate, D-BAS
allocates buffer blocks dynamically for each streaming playback operation.
As shown in the figure below, when the number of streaming playbacks is low, D-BAS will use the extra memory
to assign a larger (than the required minimum size) streaming buffer to each streaming playback.
The increased buffer size reduces the frequency of the access to the storage media by the streaming playbacks,
resulting in a more efficient loading of other files.
ADX_A_46_DBAS_few_streaming.png
On the contrary, when the number of streaming playbacks is high or maximum,
the minimum buffer size is assigned to each streaming playback, as shown in the figure below.
ADX_A_47_DBAS_lot_streaming.png
Even in such cases, no streaming playback will stop and other files can still be loaded concurrently.
However, the loading of the other files will be less efficient because the frequency of media access will have increased.