Page MenuHomeFreeBSD

snd_hdspe(4): Add sysctls to select analog signal levels.
ClosedPublic

Authored by dev_submerge.ch on Nov 3 2024, 2:11 PM.
Tags
None
Referenced Files
F106162462: D47412.id146745.diff
Thu, Dec 26, 10:17 AM
F106157955: D47412.diff
Thu, Dec 26, 8:31 AM
Unknown Object (File)
Wed, Dec 25, 12:12 PM
Unknown Object (File)
Wed, Dec 11, 4:42 PM
Unknown Object (File)
Sun, Dec 8, 11:40 PM
Unknown Object (File)
Tue, Dec 3, 10:33 PM
Unknown Object (File)
Sun, Dec 1, 3:30 AM
Unknown Object (File)
Thu, Nov 28, 12:14 PM
Subscribers

Details

Summary

RME HDSPE AIO sound cards support different sensitivity levels at the
analog input, and different gain levels for the analog line and phones
outputs. Expose these settings as sysctl tunables.

Test Plan

The following tests on hardware should be performed if possible:

  • Phones output volume changes according to sysctl setting (caution, still extremely loud).
  • Create loop to feedback the line output to line input, recording the sound played.
  • Iterate through input signal levels and observe volume changes in recorded audio.
  • Iterate through output signal levels and observe volume changes in recorded audio.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60786
Build 57670: arc lint + arc unit

Event Timeline

@br: This is the equivalent of D47330 for HDSPe AIO, as promised. Could you test it on real hardware (see test plan)? Please check that the default levels are safe, they should always be the most quiet.

There were some differences about the register used, and the RME terminology for the phones output levels is different from HDSP 9632. Watch out for copy'n'paste errors.

Great work, thanks!

I managed to switch phone level to +4dBU and then to HighGain, but could not switch back to -10dBV which was default

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dbU
dev.hdspe.0.phones_level: -10dBV -> +4dBu

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=HighGain
dev.hdspe.0.phones_level: +4dBu -> HighGain

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dBU
dev.hdspe.0.phones_level: HighGain -> +4dBu

Fail:
0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=-10dBV
dev.hdspe.0.phones_level: +4dBu -> +4dBu

(Note that default setting (-10dBV) is loudest, then +4dbU is lower, and HighGain is lowest volume)

In D47412#1081377, @br wrote:

Great work, thanks!

I managed to switch phone level to +4dBU and then to HighGain, but could not switch back to -10dBV which was default

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dbU
dev.hdspe.0.phones_level: -10dBV -> +4dBu

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=HighGain
dev.hdspe.0.phones_level: +4dBu -> HighGain

0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=+4dBU
dev.hdspe.0.phones_level: HighGain -> +4dBu

Fail:
0 pie:/home/br %sudo sysctl dev.hdspe.0.phones_level=-10dBV
dev.hdspe.0.phones_level: +4dBu -> +4dBu

Thanks for the feedback, although I can't explain it from the code yet. I hope it's not the command line swallowing the "-" or something like that?

(Note that default setting (-10dBV) is loudest, then +4dbU is lower, and HighGain is lowest volume)

Interesting, should be the other way round. The linux code doesn't seem to label these explicitly, which is why I expected the 0 value to be safe (quiet) similar to HDSP 9632. Chances are the input and output levels work the same and are in wrong order too, could you check them?

On travel currently -- will look next week.

(Note that default setting (-10dBV) is loudest, then +4dbU is lower, and HighGain is lowest volume)

Interesting, should be the other way round. The linux code doesn't seem to label these explicitly, which is why I expected the 0 value to be safe (quiet) similar to HDSP 9632. Chances are the input and output levels work the same and are in wrong order too, could you check them?

I can confirm the line level output is also mixed around (currently -10dBV is loudest, +4dBu medium and HighGain is lowest volume).
I could not check inputs right now, but I'll get a microphone to test this next week!

On the "-10dbV" problem I could suggest to rename this to "minus10dbv" (and "plus4dbu as well).

Fix the signal level flags which were backwards, with the loudest setting (high
gain) resulting in a quiet signal and vice versa.

In D47412#1086254, @br wrote:

On the "-10dbV" problem I could suggest to rename this to "minus10dbv" (and "plus4dbu as well).

Now that I think of it, we also have negative integer values in sysctl. Given that, it should be acceptable to use "-10dBV". It is quite a bit more readable and closer to RME / standard signal level terminology.

Could you please try to set "-10dBV" in a su -l session, to check whether this is a sudo problem? I read through the code again and didn't find any possible cause.

In D47412#1086254, @br wrote:

On the "-10dbV" problem I could suggest to rename this to "minus10dbv" (and "plus4dbu as well).

Now that I think of it, we also have negative integer values in sysctl. Given that, it should be acceptable to use "-10dBV". It is quite a bit more readable and closer to RME / standard signal level terminology.

Could you please try to set "-10dBV" in a su -l session, to check whether this is a sudo problem? I read through the code again and didn't find any possible cause.

I'm now able to set -10dBV and +4dBu, but could not set HighGain. So I guess there is an off-by-one error somewhere...

On the Input front, I have inserted Shure SM7B into External card Input 1, and I barely hear myself in Audacity. Slighly more loud on LowGain compare to +4dBu, but still very low on both. I could not set -10dBV because of off-by-one error somewhere (I guess).

Fix condition to set the signal level in the settings register on change
requests, it checked the control register by mistake. This was a leftover from
the hdsp.c code that was copied here, sorry about that.

In D47412#1088444, @br wrote:

I'm now able to set -10dBV and +4dBu, but could not set HighGain. So I guess there is an off-by-one error somewhere...

This should be fixed now, could you please test again?

In D47412#1088459, @br wrote:

On the Input front, I have inserted Shure SM7B into External card Input 1, and I barely hear myself in Audacity. Slighly more loud on LowGain compare to +4dBu, but still very low on both. I could not set -10dBV because of off-by-one error somewhere (I guess).

AFAIK the SM7B is a passive mic and as such emits a very low signal. Given the bit depth and quality of the RME circuits you should be able to get a decent signal, but supposedly much quieter than line level signals. Usually one would apply an external mic preamp here. An alternative option for testing the signal levels would be a loop cable, just recording what you play back on the AIO, or any other device.

I only have the breakout cable with RCA connectors for the HDSP 9632, so can't really test with a microphone directly.

Also I suspect the input signal levels to be backwards now, please report your findings. The recorded signal should be loudest for "-10dBV" and quietest with "LowGain".

Also I suspect the input signal levels to be backwards now, please report your findings. The recorded signal should be loudest for "-10dBV" and quietest with "LowGain".

just checked: yes they are backwards on input.

everything else seems to work properly!

Switch input level flags according to test findings by @br. Setting "LowGain"
on the input level should now match the signal level of "HighGain" outputs.

This revision was not accepted when it landed; it landed in state Needs Review.Tue, Dec 3, 10:32 PM
This revision was automatically updated to reflect the committed changes.