CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Adjusting the sound decoding buffer

If you use the default settings of the CRI Atom library, noise may be generated (sound is interrupted) or no sound may play on some Android devices.

This problem can be improved by adjusting the sound decoding buffer as shown below.

Solution: Adjusting the sound decoding buffer

On some devices, the default sound decoding buffer is not large enough, leading to noise or no sound.

To avoid this, you can adjust the following CriWare.CriWareInitializer component setting to increase the sound decoding buffer until the problem is solved.

The figure below shows CriWare.CriWareInitializer in Inspector of Unity Editor.

adx2u_initializer_bufferingtime.png

The section surrounded by a red square shows

  • (a) Buffering Time: Output buffering time (milliseconds)
  • (b) Start Buffering Time: Playback start buffering time (milliseconds)

from top to bottom. By default, the values below are specified.

  • (a) Buffering Time: 133 (milliseconds)
  • (b) Start Buffering Time: 100 (milliseconds)

At (a), adjust the size of the sound decoding buffer. At (b), specify how much sound data to accumulate before starting playback (milliseconds).

How much to increase depends on the device and the load status on the application. You must determine appropriate values for each device.

Repeat increasing (a) and (b) by the same number until no noise is generated and sound is played properly.

Then, if you use Low-latency sound playback on Android , sound playback is delayed by the value of (b). Reduce only the value of (b) so that no sound is interrupted.

Sample setting

CRI have confirmed noise (interrupted sound) on the devices below.

  • ARROWS X LTE F-05D (OS 4.0.3)
  • ARROWS X F-10D (OS 4.0.3)

For example, for F-05D, we have confirmed that the setting below at CRI SDK generates no noise.

  • (a) Buffering Time: 200 (milliseconds)
  • (b) Start Buffering Time: 150 (milliseconds)

We have also confirmed no playback sound on the device below.

  • REGZA Tablet AT700/35D AT200 (OS 4.0.3)

For AT200, we have confirmed that ADX sound is played with the following setting.

  • (a) Buffering Time: 220 (milliseconds)
  • (b) Start Buffering Time: 220 (milliseconds)

Basically, use the default values. Only for a specific device where sound is interrupted or no sound is played, identify the device model on the application side and adjust the buffer times.

Supplement

# Sample code for identifying a model with code

To identify a mode with code, for ARROWS X LTE F-05D, for example, you can check whether MODEL in the android.os.Build class is "F-05D". The following shows a sample code that was tested on Unity.
{
AndroidJavaClass clsUnity;
string MODEL_ID;
clsUnity = new AndroidJavaClass("android.os.Build");
MODEL_ID = clsUnity.GetStatic<string>("MODEL");
/* Compare the string with the Android device name (F-05D); */
int ret = MODEL_ID.CompareTo("F-05D");
if (ret == 0) {
/* Setting for F-05D */
initializer.atomConfig.androidBufferingTime = 200;
initializer.atomConfig.androidStartBufferingTime = 150;
}
}

# Reducing the playback start latency

This section describes noise reduction with the increase of the size of the sound decoding buffer. Meanwhile, you can reduce the default value within the range where no noise is generated to reduce playback start latency. To do that, be sure to check the operation on an actual device sufficiently.