Skip to content

Performance

Phil Schatzmann edited this page Apr 25, 2022 · 33 revisions

Overview

The framework is supporting quite a few scenarios. The default settings have been chosen to work well in avarage with most of the scenarios. You have quite a few options to tweak the performance for your individual case. A good starting point are the settings in the AudioConfig.h. You either can change the values directly in the AudioConfig.h or create a local AudioConfigLocal.h file. The most relevant settings are

  • DEFAULT_BUFFER_SIZE
  • I2S_BUFFER_SIZE
  • I2S_BUFFER_COUNT

Please note that increasing the values might improve if the audio is breaking up. Reducing the values is reducing the delays!
The i2s buffer definition can also be changed programmatically in your sketch when you define your i2s config.

StreamCopy

When you define the StreamCopy you can specify the buffer size in the constructor

StreamCopy(Print &to, Stream &from, int buffer_size=DEFAULT_BUFFER_SIZE);

AudioPlayer

When you define the AudioSourceSdFat you can define the speed in MHz in the constructor:

AudioSourceSdFat(const char* startFilePath = "/", const char* ext = ".mp3", int chipSelect = PIN_CS, int speedMHz = 2);

URLStream

The URLStream uses it's own buffer to store the receviced (decoded) data. It is defined by

  • DEFAULT_BUFFER_SIZE,
  • URL_STREAM_BUFFER_COUNT

In this case it is advisable to increase the URL_STREAM_BUFFER_COUNT and e.g. keep the I2S_BUFFER_COUNT as small as possible!