Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alc_max above 0.4 causes distortion. #49

Open
jonahnm opened this issue Jul 1, 2024 · 13 comments
Open

alc_max above 0.4 causes distortion. #49

jonahnm opened this issue Jul 1, 2024 · 13 comments

Comments

@jonahnm
Copy link

jonahnm commented Jul 1, 2024

As far as I can tell, this is not caused by my dac, amp or speaker as it happens even if I lower the gain on the amp itself.

DAC/AMP: MAX98357A

@darki73
Copy link

darki73 commented Jul 8, 2024

From my observation, any AMP which is not soldered to the board will have a distortion.
You may want to try it out with the very short cables going from pins to the AMP.

On my device, i have the AMP placed on the circuit board itself, so it has direct connection to the ESP32, and the sound is crystal clear even with alc_max set to 0.5 (which from my understanding actually limits the max volume, and indeed would cause a distortion if there is a signal degradation when set too high).

@jonahnm
Copy link
Author

jonahnm commented Jul 8, 2024

I could try to directly solder it to the board! Thanks for the tip!

@jonahnm
Copy link
Author

jonahnm commented Jul 9, 2024

From my observation, any AMP which is not soldered to the board will have a distortion. You may want to try it out with the very short cables going from pins to the AMP.

On my device, i have the AMP placed on the circuit board itself, so it has direct connection to the ESP32, and the sound is crystal clear even with alc_max set to 0.5 (which from my understanding actually limits the max volume, and indeed would cause a distortion if there is a signal degradation when set too high).

I've soldered it directly to the ESP32, same issue.

@darki73
Copy link

darki73 commented Jul 9, 2024

Mine is on the PCB itself, so it uses traces to connect to ESP.

One more thing to try, you can set the gain using the GAIN pad, thing is, if it left hanging, it will increase gain by default to +9dB.

In the datasheet for the AMP you can see what you need to do to achieve different values of GAIN, from +3dB to +15dB.

On +15dB and 100% volume with alc set to 0.5 even with my setup I can hear distortion.

Also, signal filtering is a thing )

@jonahnm
Copy link
Author

jonahnm commented Jul 10, 2024

Yes, but I'm not sure where the distortion is coming from, the AMP, or the ESP.

@gnumpi
Copy link
Owner

gnumpi commented Jul 10, 2024

Have you tried a setup without the adf_pipeline? E.g. one of the officially provided ESPHome firmwares? Do you see the same issue then?

@jonahnm
Copy link
Author

jonahnm commented Jul 10, 2024

Have you tried a setup without the adf_pipeline? E.g. one of the officially provided ESPHome firmwares? Do you see the same issue then?

The official ones don't work at all for me.

@jonahnm
Copy link
Author

jonahnm commented Jul 10, 2024

(As in streaming on the official ones are broken)

@jonahnm
Copy link
Author

jonahnm commented Jul 11, 2024

From my observation, any AMP which is not soldered to the board will have a distortion. You may want to try it out with the very short cables going from pins to the AMP.

On my device, i have the AMP placed on the circuit board itself, so it has direct connection to the ESP32, and the sound is crystal clear even with alc_max set to 0.5 (which from my understanding actually limits the max volume, and indeed would cause a distortion if there is a signal degradation when set too high).

I will note that after soldering directly to the ESP32, alc_max of 0.5 sounds quite clear now.

@jonahnm
Copy link
Author

jonahnm commented Jul 11, 2024

There is still some distortion on louder music though.

@jonahnm
Copy link
Author

jonahnm commented Jul 11, 2024

I might end up buying a dedicated DAC instead of the combo and using the dedicated amps I have lying around (PAM8403) instead.

@darki73
Copy link

darki73 commented Jul 12, 2024

@jonahnm PAM8403 in my experience (i have 20 of them ready to go to the trash bin) is a pretty bad AMP. If you are willing to do things right (read the datasheet for it and then filter the signal) and want to have a good sound, you kinda have to go MAX98357.

I have tried out about 5 or 6 PAMs and none of them were able to produce the sound to my liking (ordered couple of batches from different sellers on the amazon)

Here is the example i can provide you with recorded on the Galaxy S24 Ultra from 2 meters away, phone pointed at me, device in the enclosure designed by me, (sorry for applied volume normalization, AI stuff is killing me on this device) with volume being set to 100% on my speaker (also, had to use a dodgy online converter to make a WEBM out of M4A file, so there might be some sound quality degradation).

Voice.240713_033530.webm

Specs of this device:

  1. ESP32-S3
  2. MAX98357AETE+T (Gain set to +12dB, alc 0.5)
  3. 10W @ 4Ohm speaker

The only cables i have are the ones from the board (ESP32-S3 -> Dip switches for gain -> AMP ->Speaker) to the speaker itself. Rest is on the PCB. Honestly, cant complain about the sound.

P.S. I am no sound specialist, but from browsing the internet I found out that oversizing the speaker is a good practice, so for a 3W AMP you might want to have 5W+ speaker. Yet again, no idea if it actually makes sense, I've just ordered few packs of 2x 10W full range speakers (passive ones), as when I got ADA1314 i ordered initially, the looked flimsy as hell.

P.P.S. Honestly, even surprised that you can achieve with a 40 USD custom board (printing and assembly) and about 5 USD on the LED + Mic + Speaker side and other 2 USD in 3D printing costs. Just tried Alexa and my speaker side by side, and the only thing that differs is the bass on the lower volume on Alexa, yet it cannot come even close in the max volume.

DIY and projects like this one are really changing the world.

@jonahnm
Copy link
Author

jonahnm commented Jul 15, 2024

I know right, lol, anyways I'm trying to make my own implementation for everything using PWM audio with a low pass filter rather than a dedicated AMP. I also bought ESP32-S3s as they have more RAM, just in case the clipping was a decoder issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants