what audio library command...

Status
Not open for further replies.

Simon.M

Member
Hi All,

what audio library command controls the stage highlighted in the red box on the following image (image is taken from the SGTL5000 datasheet). I don't think it's the lineInLevel command as the stage in the red box is between the mic/line in switch and the ADC input. Is there a command and if so... what is ?

thanks in advance

Simon.M

audio-codec-sgtl5000.jpg
 
Hi MarkT,
Thanks for the reply... if that's the case then it seems a bit strange to have one command that effects another command. It's strange as you would be able to issue a Lineinlevel command that actually changes the mic level. Logically it doesn't make sense to me. i am sure if it is the way you describe then it was done for a reason and with safe guards that prevent one command having an effect on the other input.

best regards

Simon.M
 
Erm, that's how the chip is wired - both paths use the same switched attenuator. You cannot have both mic and line-in at once
since there's only one ADC, the attenuator is for the ADC. Mic input requires much more dynamic range so has another coarser
attenuator.
 
Good Morning MarkT,
The main problems that i had when reading the available information is this... Some information appears to be incorrect or misleading (I can only speak for myself and not for others).

Here is a list of issues that I personally have with the available information, This is only with respect to the module in the red box pictured above and the two inputs.

Audio library tool website (line in and mic inputs)
-----------------------------------------------
'line in level' command talks of voltages, and lists voltages for each of the 16 settings and NOT a gain stage as in the datasheet.

From the text the 'mic gain' command controls 0 to 63dB.

The library calls it 'Line in level' for the stage in the red box, but this appears to be a bad choice of words as that setting has an effect on both inputs and NOT just the line in. Maybe a better choice would have been 'Audio in gain' or something similar.

datasheet (line in and mic inputs only)
--------------------------------------------
Talks of 0 to 22.5 dB with respect to gain from that stage in the red box, this stage appears to be a separate stage on the block diagram.
The 'mic gain' command clearly shows 0dB, 20 dB, 30dB & 40dB settings only and NOT 63dB. Yes I fully understand that 40dB plus 22.5dB is basically the 63dB (but it's NOT immediately clear).

Github software page (the link you provided earlier)
----------------------------------------------------------
if you read the page it talks about the voltages as a reading taken from one SGTL5000 part as an experiment, Then shown in a way that depicts a voltage change rather than a gain value.

No disrespects to anybody, but it seems not everybody is talking about this in the same way... so that information is constant and less confusing.

best regards

Simon.M
 
I think the anticipated use case is that you call inputSelect() and then either micGain() or lnputLevel() in setup().

If you were to dynamically switch between mic and line inputs you'd have to also call the appropriate function
to set the gain each time. I don't know if anyone has ever fallen foul of this but it would indeed be confusing.

if you read the page it talks about the voltages as a reading taken from one SGTL5000 part as an experiment, Then shown in a way that depicts a voltage change rather than a gain value.
I think that's to help people who don't work in dB, the steps are indeed pretty close to 1.5dB each
 
HI MarkT,

well i think you might have some understanding as to why i asked the original question.

A final thought... there is nowhere in any documentation in the audio library design tool that states that one input would or could effect the other (due to they both use the same register) and to make sure you store separate variables for each input.

you talk about the steps are close to 1.5dB... what calculation was used for that ?.... from the very little i know of the dB scale is this... if you half something that's a 3 dB loss if you multiply something by 2 then you have a 3 dB increase (that's the full extent of my knowledge on the dB stuff). The voltages don't follow that scheme and is why i ask about the calculation.

apologies if my old brain is not up to speed...

best regards

Simon.M
 
voltage_ratio = 10^(dB/20)
dB = 20 * log10(voltage_ratio)

power_ratio = 10^(dB/10)
dB = 10 * log10(power_ratio)

power_ratio = voltage_ratio^2, therefore log(power_ratio) = 2 * log(voltage_ratio)

dB are in terms of "power", so +10dB is ten times the power, not 10 times the voltage.

dB are relative(*), if you want to give an absolute value you state the zero-point of the scale, for
instance dBV is relative to 1 volt, dBm is relative to one milliwatt, dBW is relative to 1 watt.

Doubling the power is +3dB, doubling the amplitude is +6dB (to a very close approximation)

When the impedance is not known or relevant you use squared volts as a proxy for power (V^2 = P/R)
The x20 implicitly encodes the squaring...

For RF the impedance is usually known (50 ohms in most cases), so dBW or dBm are commonly used.

For audio amps the actual power gain is almost never thought about, only the voltage gain. An audio
power amp might have 26dB of gain (considering volts only, ie 20-fold gain), but 64dB of true power gain (38 of which
accounts for 50k input impedance to 8 ohm output impedance ratio).

(*) the exception being acoustic dB, which are just written dB despite being absolute (0dB reference level is 20µPa)
 
Hi MarkT,

just a quick thank you for all the help over the last few days, especially clearing up the formulas

best regards

Simon.M
 
Status
Not open for further replies.
Back
Top