Solved sound: hw.snd.vpc_0db <- trying to understand.

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

Hi.

I am having a bad time trying to understand the hw.snd.vpc_0db sound(4) parameter.

Code:
hw.snd.vpc_0db
             Default value for sound volume.  Increase to give more room for
             attenuation control.  Decrease for more amplification, with the
             possible cost of sound clipping.
The default value is 45. If set as default, every time the track changes on audio/musicpd the volume default back top 45% from 100% (mixer(8) volume does not change).

If I set hw.snd.vpc_0db=100 the audio/musicpd volume is kept at 100% but the maximum output is clearly lower.

Relevant parameters:

hw.snd.vpc_autoreset=1
hw.snd.vpc_reset=0


Thanks in advance.
 

k.jacker

Aspiring Daemon

Reaction score: 424
Messages: 726

That looks like a value that sets the best amplification possible without clipping.
E.g. the mostly used replay-gain value is 89db, whereas an audio-cd has it's max somewhere a bit > 100db.
Though audio won't sound good if produced pushed too the limit, so 89db avoids clipping (in most cases) and gives you plenty of headroom for dynamics.
I guess that value of 45 doesn't represent a db-value, but it must be a negative offset from a maximum amplification level that may be around 110db.

My dog calls so I have to go, but I can dig into that further, later :)
 

rsronin

Active Member

Reaction score: 77
Messages: 103

If I set hw.snd.vpc_0db=100 the audio/musicpd volume is kept at 100% but the maximum output is clearly lower.
hw.snd.vpc_0db Default value for sound volume. Increase to give more room for attenuation control.
So, i think, with an external attenuator you have a more accurate control over the amplification using a volumeknob, e.g. before rotate from 9 to 10 o'clock, now rotate from 9 to 12 o'clock for the same effect. Depending on your gear this can lead to distortion again.

https://forum.audiogon.com/discussions/volume-control-vs-attenuation-control

Also there is a difference between pro and non-pro outputlevels...

http://www.recordingeq.com/magtip/tip/0902line.html
 
OP
OP
rigoletto@

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

Thanks for the more technically minded docs; however I still don't know why the volume keeps defaulting to the valor set for hw.snd.vpc_0db. :'‑(
 

PMc

Well-Known Member

Reaction score: 168
Messages: 490

I found this strange as well. It seems the position of the fader is not stored and gets reset to the 0db position every time the /dev/dspX.vpN device is closed and reopened.
hw.snd.vpc_autoreset=0 solves this.
 
OP
OP
rigoletto@

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

Well, not solved. :D

Setting hw.snd.vpc_autoreset=0 solve the previous reset problem but at some point (I didn't observed when tha exactly happens) the volume is reset to 0. :'‑(
 

PMc

Well-Known Member

Reaction score: 168
Messages: 490

There seem to be some difficulties with the audio system - I have not yet found a really good way to operate it.
The way how an application chooses it's vp interface seems also random, or first-come-first-serve, while some applications (e.g. vlc) offer a selection, but it does not always work, at least here.
I would like to have a "real" mixer with more or less hard-wired inputs and the option to route the output to the different dsp's and change that during play.
 
OP
OP
rigoletto@

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

I think the problem is with mixer(8) becuase the settings in there does not change but the application control.

I will post about it on the mailing list later.

Thanks!
 

michael_hackson

Active Member

Reaction score: 83
Messages: 149

Now I am not having the same application but isn't that the way mixer should behave, shouldn't it be systemwise as you have individual application controls? Isn't your problem solved by turning the autoreset off?

Having the volume control of audio/musicpd strictly related with
hw.snd.vpc_0db seems very strange to me. I would set audio/musicpd to be at fault here.
 

rsronin

Active Member

Reaction score: 77
Messages: 103

The default value is 45. If set as default, every time the track changes on audio/musicpd the volume default back top 45% from 100% (mixer(8) volume does not change).
Maybe I did not understand your initial question but I had a similar issue with musicpd (in my initial FreeBSD installations where I mixed pkg/ports and played with quarterly/latest settings in a config file.

In my current desktop installation it seems to behave the way I want but I start musicpd after logging in. I did a clean install and only using pkg not ports.

There seem to be some difficulties with the audio system - I have not yet found a really good way to operate it.
The way how an application chooses it's vp interface seems also random, or first-come-first-serve, while some applications (e.g. vlc) offer a selection, but it does not always work, at least here.
I noticed the above while playing with musicpd, Kodi, VLC and other media applications both on my desktop and 'server' installation.

I did also a clean install on my 'server' where I had problems with setting the default output device which I could solve by loading it as early as possible in /boot/loader.conf. Using pkg only not ports.

Apart from that I added some lines in /etc/sysctl.conf


hw.snd.vpc_0db=45
hw.snd.vpc_mixer_bypass=0
hw.snd.default_unit=2
#hw.snd.latency=0
#hw.snd.feeder_rate_quality=3
#hw.snd.maxautovchans=32
hw.snd.latency=5
hw.snd.feeder_rate_quality=3
hw.snd.maxautovchans=16


In the initial installations before I did not use hw.snd.maxautovchans=xx.

I came to FreeBSD for the soundquality after playing with alsa/pulse/oss4 on linux (which gave me a lot of headache too especially with the order of the sounddevices). I hoped FreeBSD would be easier but still trying to understand sound here from an end user's perspective. I also tried oss and sndio but that gave me other issues. For now I am happy and I just before installing bought 2 fanless nvidia cards which seamlessly fitted in the n40l and n54l, so the puffy fish is on hold for now. Happy birthday BTW, FBSD
 
OP
OP
rigoletto@

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

rsronin I was thinking about the problem actually being with audio/musicpd but I got the impression PMc had experienced the same problem with other software. In this case, would be nice to try to make a list of what software (other than musicpd, and if any) are hit this problem to open a proper bug report.

Thanks!
 

shepper

Aspiring Daemon

Reaction score: 280
Messages: 804

There are multiple audio outputs that can be configured in /usr/local/etc/mpd.conf

Code:
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# An example of an ALSA output:
#
#audio_output {
#    type        "alsa"
#    name        "My ALSA Device"
#    device        "hw:0,0"    # optional
#    mixer_type      "hardware"      # optional
#    mixer_device    "default"    # optional
#    mixer_control    "Master"    # optional
#    mixer_index    "0"        # optional
#}
#
# An example of an OSS output:
#
#audio_output {
#    type        "oss"
#    name        "My OSS Device"
#    device        "/dev/dsp"    # optional
#    mixer_type      "hardware"      # optional
#    mixer_device    "/dev/mixer"    # optional
#    mixer_control    "PCM"        # optional
#}
mixer_type can be hardware or software and mixer_control usually has values like Master, PCM, Front etc. I believe that sndio and pulseaudio are also FreeBSD sound output options. In my mpd.conf, I specify mixer_control as Master and use the mpd client volume controls without issue in OpenBSD, Debian, NetBSD 7 and in FreeBSD 9.
 
OP
OP
rigoletto@

rigoletto@

Daemon
Developer

Reaction score: 1,019
Messages: 2,056

shepper

Yeah, I forgot about mixer_type and that was default, what probably is hardware. I switched to software and it seems to be solved.

Thanks! :beer:
 

PMc

Well-Known Member

Reaction score: 168
Messages: 490

rsronin I was thinking about the problem actually being with audio/musicpd but I got the impression PMc had experienced the same problem with other software. In this case, would be nice to try to make a list of what software (other than musicpd, and if any) are hit this problem to open a proper bug report.
Actually I found the behaviour a little bit weird and difficult to figure out, but I don't see an actual bug. OTOH, my demands are not very high, I just want to have proper stereo sound at the respective outlet - from HTML5 and vlc, for now. I did not go into the components and features and the various available libaries and ports, in order to understand the whole scheme.
 
Top