goofy2k / ESP32_faust2api

Towards a faust2api for ESP32
6 stars 0 forks source link

Unpredictable behavior in play_setVoiceParameter_path #9

Closed goofy2k closed 3 years ago

goofy2k commented 3 years ago

When adding a third note to the sequencing loop in play_setVoiceParam_path (approx line 849 in faust_mqtt_tcp5_v1\main), the program seems to hang. The routine is started, but also the first two notes are not played after adding the third! The program does not hang really. It does receive and display MQTT messages.

This is all at ESP-logging level INFO.

When the logging level is increased to VERBOSE, the loop plays with three notes ! ??????? And even withs six

VERBOSE level the does not "repair" defective the play_keys routine
Test with logging only ERRORS or None ongoing....

Both routines play well at ERROR level debugging. No logging not tested as this is not a viable solution.

goofy2k commented 3 years ago

The behaviour may have to do with the use of vTaskDelay for determining note duration. This method blocks other tasks. See mai notes from Oct 5th

goofy2k commented 3 years ago
goofy2k commented 3 years ago

The solution for the hanging code is: do not use vTaskDelay. This is blocking other freeRTOS tasks. For playing a sequence of non-overlapping notes, use the self-defined non-blocking function nbDelay (as of faust_mqtt_tcp5_v1). It was tested in sequence playing procedures ending with _nb and found OK for non-overlapping notes. These routines now play the sequence independent of the logging level!