We have chosen the pt8211 for a project (ALFASoniQ Mirage II Emulator). We are making great progress, but we ran into what appears to be a latency issue.
When a note is triggered by MIDI, it takes almost 0.5 second for the sound to be produced.
Interestingly, once the note is triggered, the latency is gone for subsequent notes.
Until there is a pause of a few seconds.
When the next note is triggered, the latency is again very high.
Here is a video (Teensy 4.1 with PT8211) of a test case that reproduces the issue:
https://www.youtube.com/watch?v=8G2UPIfnT0E
Does the PT8211 have a undocumented low-power mode? That would explain why it takes a second note to wake up.
The other option could be that the PT8211 has some synchronization issues when using the library?
We tested the same code against teensy 4.0 with Teensy Audio Board SGTL5000:
https://www.youtube.com/watch?v=eoRDheKFKzg
Here is the code:
#include <Audio.h>
#include <MIDI.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
MIDI_CREATE_DEFAULT_INSTANCE();
//#define PT8211
AudioSynthWaveform waveform1;
#ifdef PT8211
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord1(waveform1, 0, pt8211_1, 0);
AudioConnection patchCord2(waveform1, 0, pt8211_1, 1);
#else
AudioOutputI2S i2s1;
AudioConnection patchCord1(waveform1, 0, i2s1, 0);
AudioConnection patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
#endif
void setup() {
AudioMemory(15);
Serial.begin(9600);
#ifdef PT8211
#else
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
#endif
waveform1.begin(WAVEFORM_SINE);
waveform1.frequency(440);
// waveform1.amplitude(0.99);
Serial.println("getting ready....");
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(0);
}
void loop()
{
int note, velocity, channel, d1, d2;
if (MIDI.read()) // If we have received a message
{
byte type = MIDI.getType();
switch (type) {
case midi::NoteOn:
digitalWrite(LED_BUILTIN, HIGH);
waveform1.amplitude(0.99);
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
if (velocity > 0) {
Serial.println(String("Note On: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
} else {
Serial.println(String("Note Off: ch=") + channel + ", note=" + note);
}
break;
case midi::NoteOff:
digitalWrite(LED_BUILTIN, LOW);
waveform1.amplitude(0.0);
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
Serial.println(String("Note Off: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
break;
default:
d1 = MIDI.getData1();
d2 = MIDI.getData2();
Serial.println(String("Message, type=") + type + ", data = " + d1 + " " + d2);
}
}
}
Any ideas on what might be happening here?
(we will fire up the scope and logic analyzer sometime during the week...)
When a note is triggered by MIDI, it takes almost 0.5 second for the sound to be produced.
Interestingly, once the note is triggered, the latency is gone for subsequent notes.
Until there is a pause of a few seconds.
When the next note is triggered, the latency is again very high.
Here is a video (Teensy 4.1 with PT8211) of a test case that reproduces the issue:
https://www.youtube.com/watch?v=8G2UPIfnT0E
Does the PT8211 have a undocumented low-power mode? That would explain why it takes a second note to wake up.
The other option could be that the PT8211 has some synchronization issues when using the library?
We tested the same code against teensy 4.0 with Teensy Audio Board SGTL5000:
https://www.youtube.com/watch?v=eoRDheKFKzg
Here is the code:
#include <Audio.h>
#include <MIDI.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
MIDI_CREATE_DEFAULT_INSTANCE();
//#define PT8211
AudioSynthWaveform waveform1;
#ifdef PT8211
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord1(waveform1, 0, pt8211_1, 0);
AudioConnection patchCord2(waveform1, 0, pt8211_1, 1);
#else
AudioOutputI2S i2s1;
AudioConnection patchCord1(waveform1, 0, i2s1, 0);
AudioConnection patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
#endif
void setup() {
AudioMemory(15);
Serial.begin(9600);
#ifdef PT8211
#else
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
#endif
waveform1.begin(WAVEFORM_SINE);
waveform1.frequency(440);
// waveform1.amplitude(0.99);
Serial.println("getting ready....");
pinMode(LED_BUILTIN, OUTPUT);
MIDI.begin(0);
}
void loop()
{
int note, velocity, channel, d1, d2;
if (MIDI.read()) // If we have received a message
{
byte type = MIDI.getType();
switch (type) {
case midi::NoteOn:
digitalWrite(LED_BUILTIN, HIGH);
waveform1.amplitude(0.99);
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
if (velocity > 0) {
Serial.println(String("Note On: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
} else {
Serial.println(String("Note Off: ch=") + channel + ", note=" + note);
}
break;
case midi::NoteOff:
digitalWrite(LED_BUILTIN, LOW);
waveform1.amplitude(0.0);
note = MIDI.getData1();
velocity = MIDI.getData2();
channel = MIDI.getChannel();
Serial.println(String("Note Off: ch=") + channel + ", note=" + note + ", velocity=" + velocity);
break;
default:
d1 = MIDI.getData1();
d2 = MIDI.getData2();
Serial.println(String("Message, type=") + type + ", data = " + d1 + " " + d2);
}
}
}
Any ideas on what might be happening here?
(we will fire up the scope and logic analyzer sometime during the week...)

