Skip to content

Performance

Phil Schatzmann edited this page Apr 26, 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 following is valid for the ESP32 only. If the USE_URLSTREAM_TASK is defined in AudioConfig.h, then URLStream uses it's own task and buffer to store the received (encoded) data which 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!

The following parameters are also relevant:

#define URL_STREAM_CORE 0
#define URL_STREAM_PRIORITY 2
#define URL_STREAM_BUFFER_COUNT 10
#define STACK_SIZE 30000
#define URL_CLIENT_TIMEOUT 60000;
#define URL_HANDSHAKE_TIMEOUT 120000
Clone this wiki locally