Mod to programmatically disable speaker whine/hiss.

  • Re: Noise on speaker

    Hi all,

    I've been working on porting the Teensy Audio Library to M5Stack to allow full (& easy) audio synthesis.


    However the background whine/hiss from the speaker when no audio is being played is very annoying (and quite loud on my M5Stack).

    My suggested modification in this case is to put a wire from Pin 1 of the speaker amplifer to GPIO5.


    Then it's just a simple case of digitalWrite(5, HIGH); to turn on the amplifier, and digitalWrite(5, LOW); to turn off the amplifier.

    There seems to be a 30-100ms delay for the amplifier to turn on, and very little delay for it to turn off so I sadly can't get my audio library to automatically turn the amplifier on/off because I would miss the beginning of any new audio playback.

    So I've just attached the amplifier control to BtnA for manual control so I can at least turn off the noise.

    Good luck to anyone else attempting this mod! :)

  • @macaba I will have to look into this! Do you plan on sharing any of your work porting the audio libraries from the Teensy over to the M5Stack / ESP32?

  • Yep! It'll be going on GitHub at some point.

    It won't be compatible with the the original audio objects from the Teensy library;

    1. I've moved over to float datatype for audio samples (it makes certain audio algorithms so much easier) so I've been slowly porting across the objects when I use them.
    2. I've added some functionality that lets you get more detailed CPU reporting.

    You can see my handy 'Amp on/off' control now:

  • @cbrightly

    Initial commit of ESP32/M5Stack audio library done. Not that many objects yet, I'll be adding more as time allows.

  • Hello, I just flashed it and it works. Thankx :-)
    Do you use a software sigma-delta-DAC or the internal 8 Bit DAC?
    Probably you can add a second example which shows a little bit of the sound qualities of the lib.

  • You can mute the speaker very easy from code.
    Just call
    dacWrite (25,0);

  • @Calin Hold your ear on the "mute" speaker. There is still noise with your code.

    THX for the hardware mod suggestion.

  • Hello,
    Maybe you can port this teensy dalek voice sketch to m5stack
    Thank you in advance.

  • @macaba Nice. I was trying all the way to avoid noise on speaker and none of luck. Then trying using this method and it's works! Thanks

  • It is probably better not to connect PIN 1 of the NS4148 but pin 3 the buck converter EA3036 to pin 5 since otherwise you have a bigger power consumption. You could also remove R23 in that case.