HELP Audio Beeps with Teensy 4.1 and PT8211

Status
Not open for further replies.
Hi,

I moved to Teensy 4.1 after burning my 4.0 with bad power source. I used a new PT8211 card on top of it (scared to re-use old one).
Using the same source code (based on TSynth) as for previous board, the sound generation is ok but every 8 sec there is a beep (like a A 440Hz) occuring for 2 sec and going back to normal sound. It has been same problem for very simple sketch like Guitar or simple fixed waveform but not anymore (???), so I cannot post source code here (too big).

I tried to install the new teensyduino beta version (1.54 beta 5) but didn't change a thing. Here is a link of the output sound.

Does anyone have a guess ? Is it software problem, teensy4.1 or audio board ? Should I change my audio board (I have an audio shield but it is very painfull to unsolder previous one) ?

Thanks for the help.
 
Can you trim your program down to something small enough to post here?

I have a Teensy 4.1 and a PT8211 sitting right here on my workbench... ready to run whatever you give me to copy into Arduino and upload. If I can reproduce the problem here, odds are good I'll figure out what's wrong.
 
Thanks a lot for your help and replies.

I don't how I could make the thing grow until it doesn't work. I soldered only the Gnd, 7, 20, 21 and 3.3V pins

Here is the HEX file so maybe you can check it has the same behavior at your place and hence is not hardware problem along with complete sources (made with Sloeber thought).

However I did a few other tests :
* I hear the beep sound at startup with the Guitar Demo code but only once, even if I load the cpu up with finger_delay = 1 and hand_delay = 20.
* I tried the MQS outup and the sound disapeared at the beginning, however my sketch doesn't makes any sound with the MQS output (???).
* I also tried the Part2_03_Samples tutorial which works fine without the beginning beep.

It is quite weird as I use the TSynth version 2.03, only with the PT8211 board instead of AudioShield, and without hardware parts. I'll wait if anyone can try the HEX with same config and then try to change the shield to AudioShield and see what happens.

Thanks a lot for all your works. It makes new things possible !

Images of soldering here and here
 
A problem with the sketch is possible - I did not look so far.
But I have seen this:
2020-12-15 21_56_08-Start.png
At least the one marked with "!!" is not good. Try to heat it a little bit longer, next time. The hole needs some heat, too - so that the solder can flow into the hole.
I'd resolder everything - it's at least worth a try, before investing more time. Edit: And take a look at the Teensy-side, too.

Edit:Esp the PT8211-"driver" uses high frequencies (higher than with the audio shield), because it uses oversampling. Good connections are a must :)
Edit: Make sure to use a new Teensyduino Version. At least 1.53. I remember a chaching bug in an older version (I don't remeber which it was)
 
Last edited:
Hello, Thanks for looking at the pictures.

I have resoldered all connections (they were indeed not so good looking !) but it didn't change my issues.

I have tried to put a much simpler Audio patching in my software and it removed the problem with the PT8211 out but still no sound on the MQS output (??). Maybe TSynth4.1 is not OK with PT8211 (thought the TSynth for 3.6 worked well on Teensy4.0 with PT8211). I'll ask the developper of TSynth if he ever encoutered this king of problem.
Still, the beep is there at the beginning of the "Guitar" sketch... Do you have this also ?
 
Ok.. :-(
I never had beeps with the PT8211 - If I can find my PT8211 board, I can test your sketch today or tomorrow.
MQS should work, too.
 
You said you're using the latest software. But maybe check that you don't have an older copy of the audio library, which Arduino is using because it believes you want to override the one Teensyduino provided.

To check, add any syntax error and click Verify. When an error happens, the Arduino IDE prints info about which library paths it's actually using, and if there are any duplicates, which ones it's ignoring.

I recently did fix a bug with PT8211. If you're using 1.54-beta5, you definitely should have the fix. But this problem is so similar to the now-fixed bug that my hunch is you might actually be using an older copy of the library.
 
...I'll ask the developper of TSynth if he ever encoutered this king of problem...

That'll be me then. Yes the beep sounds familiar from a while back. Running out of RAM possibly? I don't think it's a hardware problem. When you compile, does it state how much memory global variables use?

...(thought the TSynth for 3.6 worked well on Teensy4.0 with PT8211...
Yes, that version is six note polyphonic with no band-limited waveform computation and never got close to running out of memory in use.
 
Hm, I re-installed the newest 1.54 beta - and guess what - I can hear the beep with PT8211. (guitar example)
I'll try to fix that. Have to find the bug, first..
 
@Regis Monte,
Please try this, and report back:

open the file "output_pt8211.cpp" in the audio-library folder and the red lines to void AudioOutputPT8211::begin(void) as shown below:
Code:
void AudioOutputPT8211::begin(void)
{
    
[COLOR=#ff0000]     memset(i2s_tx_buffer, 0, sizeof(i2s_tx_buffer));
#if defined(__IMXRT1062__)    
    arm_dcache_flush_delete(i2s_tx_buffer, sizeof(i2s_tx_buffer));
#endif
[/COLOR]
[...][COLOR=#ff0000]
[/COLOR]

Does this help?
Edit: A fix like this will be in TD 1.54 Beta 6
 
Last edited:
@Frank B,
He did work on the Guitar sketch, Bravo !
Unfortunatly I still have the same issue with my TSynth. Do you think you could you try the .HEX file ?

@Paul,
Is it what I am supposed to be looking for ? : -DTEENSYDUINO=154
Code:
"C:\\Users\\RAGEDE~1\\AppData\\Local\\Temp\\arduino_build_194390" "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ [B]-DTEENSYDUINO=154[/B] -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_MIDI_AUDIO_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr/cores/teensy4" "C:\\Users\\RAGEDE~1\\AppData\\Local\\Temp\\arduino_build_194390/pch/Arduino.h" -o
In fact I had the -DTEENSYDUINO=153 in my sloeber compiler. Changed to -DTEENSYDUINO=154 but sadly had no effect (but gave 15mn hopes thought :D).
Is there a way I can see the beta version in installation files in Arduino/hardware/teensy/avr ?

@UHF,
In fact, that beep occured also with the 3.6 version of TSynth along with Teensy4.1 and PT8211, that's why I updated to TSynth4.1, but I sure could have make a mistake on my part of the code (only hardware config side, no audio). I could not check the memory usage as Sloeber don't mention it and cannot manage to compile on Arduino, but the CPU and MEM load during execution is indeed quite high (with only one note running) : CPU:37.33 MEM:88

Thanks everyone for your support !
 
Ehh.. changing a #define does not help much.
You need to download and update Teensyduino.

Testing the hex file will not help too, since it does not have the fix..
 
Yes I did that (uninstall Aruidno, re-install Arduino and install TeensyDuino) before I send the .hex file. I just tought the Flag could force to use an older version...

Anyway, it seems that the beep varies along with filters and volume parameters which may indicate a problem (overflow) in waveforms... I didn't change my audio board (too complicated to unsolder these things !) so I'm ready to any new test and I keep on investigating (altought I'm not good for deep C programming).

Thanks anyway for your replies and help, I really appreciate it.
 
Hello, I'm back after a few tests. I didn't solve my issue but, as I tought it would come from envelopes, I happened to be the opposite. Well, simple sketch doesn't work, others more complicated does and it is still confusing. However I found a sketch which does the same thing each time. So if anyone can run it and confirm what I am hearing, that will be great. I still think I may have an hardware issue...

The below sketch only play a note every second. It is working fine with an envelope but not with the other version without envelope (commented #define WITH_ENVELOPE).

Thanks for the help.

Code:
#include <Audio.h>

//#define WITH_ENVELOPE // works fine with this defined, not if commented

AudioSynthWaveform       waveform1;      //xy=110,75
AudioOutputPT8211        pt8211_1;          //xy=303,78

#ifdef WITH_ENVELOPE
AudioEffectEnvelope      ampEnvelope1;
AudioConnection          patchCord10(waveform1, ampEnvelope1);
AudioConnection          patchCord7(ampEnvelope1, 0, pt8211_1, 0);
AudioConnection          patchCord8(ampEnvelope1, 0, pt8211_1, 1);
#else
AudioConnection          patchCord1(waveform1, 0, pt8211_1, 0);
AudioConnection          patchCord2(waveform1, 0, pt8211_1, 1);
#endif

void setup() {
  AudioMemory(15);
  waveform1.begin(WAVEFORM_SINE);
  waveform1.frequency(220);
  waveform1.amplitude(0.05);

#ifdef WITH_ENVELOPE
  ampEnvelope1.attack(2);
  ampEnvelope1.release(500);
#endif
}

int myTime = millis();

void loop() {

  if (millis() - myTime > 1000) {

    Serial.println("note on !");
#ifdef WITH_ENVELOPE
   ampEnvelope1.noteOn();
#else
    waveform1.amplitude(0.5);
#endif


    delay(200);
    
    Serial.println("note off !");
#ifdef WITH_ENVELOPE
   ampEnvelope1.noteOff();
#else
    waveform1.amplitude(0);
#endif

    myTime = millis();
  }
}
 
Hello,

I have similar problem in my project on Teensy 4.1.

Memory usage 76%. Teensyduino 1.54_beta7. SGTL5000 Audio Board and ili9341
When I append or refactoring my code the problem goes away even memory usage increases. Later it may reappear (without changes in *AudioEffect classes).
There is a suspicion that some memory address of memory is shared and depending on the address this problem may appear.
Any help would be appreciated.

Sorry for my English.
 
Can you post a photo of the hardware you built? (i.e. the connections of the board and display should be clearly visible)
 
AH...
Not sure if this is the case here... but it almost looks like!
Sounds it reasonable when I say the freeze is about 1.6 .. 1.7 seconds?
If yes, please try to update Teensyduino to 1.54 Beta 7, and after that, update startup.c - replace it with the version from here: https://raw.githubusercontent.com/PaulStoffregen/cores/master/teensy4/startup.c
Does that help??

We had a *very* weird bug, almost impossible to locate and we still do not know the *exact* reason. It had to to do with the Memory protection unit.
With the file above, so far all the 1.7 sec freezes got fixed.
 
Video with freezes https://youtu.be/901cL500uhg

Playing single loop wave from PROGMEM array about 200Kb with simple effects. Cpu usage 6%. Memory usage 6 blocks

@Muiota:

That's exactly the tone sound that I was getting in my updated TeensyMIDIPolySynth. The fix that Frank B pointed out in P#21 (included in Teensyduino 1.54b7) successfully fixed the problem that I was seeing.

Good luck & have fun !!

Mark J Culross
KD5RXT
 
Two days of little development. The freezes did not recur.
Big thank you!


Now there is new information in output


Opening Teensy Loader
teensy_size*: Memory Usage on Teensy 4.1
teensy_size*: FLASH: code:164636, data:723440, headers:7212 free for files:7231176
teensy_size*: RAM1: code:163840, variables:234176 free for local variables:126272
Uploading 'firmware' to 'Teensy 4.1' using 'usb:0/140000/0/2'
teensy_size*: RAM2: variables:304608 free for malloc\new:219680


I will let you know if problem return
 
Status
Not open for further replies.
Back
Top