Line-in gain clipping #53
-
Hello, I've been experimenting with the "streams-audiokit-audiokit" while using different input level options. I'm encountering clipping of the input stage with anything over 100mV. Curious if it's possible to adjust this parameter to a higher value (maybe the ES8388 has the ability to adjust the feedback of the input op amp?) Thank you! Wonderful library! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
The ADF API does not provide any high level function, but you can try to play around with the functions on the driver level: |
Beta Was this translation helpful? Give feedback.
-
I was able to do some tests tonight regarding adjusting the gain on the AudioKit board. Initially I noticed severe clipping, yet with help here from Phil as well as resources from jujax (https://github.com/jujax/lyrat_passthru) and thaarrak aka NA5Y (https://github.com/thaaraak/es8388/blob/master/src/es8388.cpp) I was able to get to a cleaner place. It seems by default the PGA gain is set to +9 which was the cause of the clipping. There is a line in the es8338.c file that address this gain. The path is: arduino-audiokit/src/audio_driver/es8388/es8388.c 0xbb sets the gain to 9db 6.2.1 Register 9 – ADC Control 1, Default 0000 0000 I was able to take a look on a scope of the clipping and max peak to peak while probing at the input pin of the speaker amplifier. (I added this line to the Kit-to-kit example after the kit.begin(cfg); line) I also chose "0" for the volume hack parameter. Attached are some photos that may do a better job of explanation. I hope this is helpful to others. Thank you again, Phil! Photos>>>> |
Beta Was this translation helpful? Give feedback.
-
You can easily figure out if the clipping is on the input side if you send the output to a CsvStream and look at the signal in the Arudino Serial Plotter: In fact as you can find in the documentation that is usually the first step to do! ES8388_ADCCONTROL1 can be set to any required value by just calling
In addition I added the following to AudioKitSettings.h
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
ps. I never run my board at full volume because this is much too loud! |
Beta Was this translation helpful? Give feedback.
The ADF API does not provide any high level function, but you can try to play around with the functions on the driver level:
e.g es8388_set_mic_gain(). I never used this, so you are on your own...