I'm currently getting my brain ruffled by testing the digital HW (based
digital) volume control.
That includes the "-X" option. 
If we take the PCM5122, it offers a logarithmic ramp-up/amp-down series 
at 0.5db stepwidth. 

We don't want a 2nd logarithmic curve applied by squeezelite. "-X" makes
sense.

The PCM5122 - e.g. Allo Boss  offers a range from -103.5 to 23db and
these are put into 255 steps. 
The Allo driver cuts off the attenuation part from 208 to 255. All these
steps get a 0db assignment. 
Actually pretty much all PCM51xx DACs do it by now.

0db starts at step 207. Now we'got 207 0.5db steps. And we just have 100
clicks on the LMS/squeezelite. 

That'd be an easy one. Just take out the 0.5dB steps and cut off the
bottom. We'd have a proper 1db/click 
linear scale in db-steps. As naive as I was, I thought that'd be
accomplished by "-X".




So far so good. 
Below the ramp-down scale of the PCM5122. I ran a script ramping all the
way down to see what's going on .


Code:
--------------------
    
  %   db
  207 100 0.00
  206 100 -0.50
  205 99 -1.00
  204 99 -1.50
  203 98 -2.00
  202 98 -2.50
  201 97 -3.00
  200 97 -3.50
  199 96 -4.00
  198 96 -4.50
  197 95 -5.00
  196 95 -5.50
  195 94 -6.00
  194 94 -6.50
  193 93 -7.00
  192 93 -7.50
  191 92 -8.00
  190 92 -8.50
  189 91 -9.00
  188 91 -9.50
  187 90 -10.00
  186 90 -10.50
  185 89 -11.00
  184 89 -11.50
  183 88 -12.00
  182 88 -12.50
  181 87 -13.00
  180 87 -13.50
  179 86 -14.00
  178 86 -14.50
  ...
  
--------------------


As you can see it goes down linear in 0.5dB steps.

Since there are only 100%=100clicks we see two values per %. Not very
nice. Another reason for letting the 0.5db values go.


I then configured SL with "-V Digital" "-X". The linear HW VC mode. My
assumption then, one click on LMS WEB GUI VC = -1dB.

I debugged what's going on.


Code:
--------------------
    
  [17:30:42.961540] process_audg:426 audg gainL: 46592 gainR: 46592 adjust: 1
  [17:30:42.961564] set_mixer:193 setting vol raw [0..207]
  [17:30:42.961585] set_mixer:226 Digital left: -3.0dB -> 198 right: -3.0dB -> 
198
  [17:30:43.961656] sendSTAT:179 STAT: STMt
  [17:30:44.081764] process:514 audg
  [17:30:44.081857] process_audg:426 audg gainL: 41728 gainR: 41728 adjust: 1
  [17:30:44.081892] set_mixer:193 setting vol raw [0..207]
  [17:30:44.083492] set_mixer:226 Digital left: -3.9dB -> 195 right: -3.9dB -> 
195
  [17:30:44.083597] process:514 audg
  [17:30:44.083621] process_audg:426 audg gainL: 41728 gainR: 41728 adjust: 1
  [17:30:44.083645] set_mixer:193 setting vol raw [0..207]
  [17:30:44.083667] set_mixer:226 Digital left: -3.9dB -> 195 right: -3.9dB -> 
195
  [17:30:45.005768] sendSTAT:179 STAT: STMt
  [17:30:45.005946] process:514 strm
  [17:30:45.005970] process_strm:264 strm command t
  [17:30:45.005993] sendSTAT:179 STAT: STMt
  [17:30:45.152253] process:514 audg
  [17:30:45.152339] process_audg:426 audg gainL: 37120 gainR: 37120 adjust: 1
  [17:30:45.152375] set_mixer:193 setting vol raw [0..207]
  [17:30:45.153978] set_mixer:226 Digital left: -4.9dB -> 192 right: -4.9dB -> 
192
  [17:30:45.154083] process:514 audg
  [17:30:45.154106] process_audg:426 audg gainL: 37120 gainR: 37120 adjust: 1
  [17:30:45.154131] set_mixer:193 setting vol raw [0..207]
  [17:30:45.154152] set_mixer:226 Digital left: -4.9dB -> 192 right: -4.9dB -> 
192
  [17:30:46.154228] sendSTAT:179 STAT: STMt
  [17:30:46.563268] process:514 audg
  [17:30:46.563355] process_audg:426 audg gainL: 33024 gainR: 33024 adjust: 1
  [17:30:46.563392] set_mixer:193 setting vol raw [0..207]
  [17:30:46.564995] set_mixer:226 Digital left: -6.0dB -> 189 right: -6.0dB -> 
189
  [17:30:46.565099] process:514 audg
  [17:30:46.565123] process_audg:426 audg gainL: 33024 gainR: 33024 adjust: 1
  [17:30:46.565147] set_mixer:193 setting vol raw [0..207]
  [17:30:46.565168] set_mixer:226 Digital left: -6.0dB -> 189 right: -6.0dB -> 
189
  [17:30:47.565242] sendSTAT:179 STAT: STMt
  [17:30:49.005664] sendSTAT:179 STAT: STMt
  
--------------------


6 clicks = -6dB  -> that's looks good. 

On the first glance.

What made me wonder were the -4.9 and -3.9dB are coming from. These
shouldn't be there. We're on HW VC and in linear mode. 1 click one clean
and straight -1dB.
Hmmh.
Do I maybe look at the SL SW control in the debug log, which still runs
even though HW VC "-V" is enabled!?!? I'd guess so. That's not good. 

Then I had a look at the amixer setting, what happened there after 6
clicks..


Code:
--------------------
    
  tc@pico1:~$ amixer sget Digital
  Simple mixer control 'Digital',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 207
  Mono:
  Front Left: Playback 189 [91%] [-9.00dB] [on]
  Front Right: Playback 189 [91%] [-9.00dB] [on]
  
--------------------


What ?? -9dB !??! Something is not quite right here.

Ok. I quickly talked to Paul@pCP. 

I'd be opening a can of worms (my words). I have no issue with that.

One of the issues seems that different HW, comes with different VC
scales.
Matching these properly is quite challenging.

However. I do think there'd be a way to accomplish this.
squeezelite would need a feature that reads custom VC scales - maybe
read from a stored file.
That file would consist of 100 number pairs. 

100 207
99   205
98   203
...

That should lead to a linear and "predictable" volume control at last.
I'd know that 94 = -6dB and 88 = -12dB for a 5122 chip. 

With such a file at hand, people could even improve/tailor the
ramp-up/ramp-down curve.


Any comments?



:::'  my audioblog  - latest series: RaspBerry PI - \"The Audio Engine\"
' (http://soundcheck-audio.blogspot.com):::
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=97046

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to