On Sun, Feb 02, 2014 at 11:11:08PM +0100, Nils Reuße wrote:
> Thank you, that helped!  I tried with -v 100 and could listen to 5 songs at
> the same time without the volume being changed, that will do it.
> 
> Never heared of sound attenuation before though, is the sndiod behaviour a
> direct requirement of some physical laws?

Exactly. Sound samples are numbers in the [-1:1] range; when two
sounds are mixed, samples are added and the result would be in the
[-2:2] range, which is not supported by the hardware. So we have to
fit them in the [-1:1] range, there are two options:

(1) Clipping: set samples in the [-2:-1] and [1:2] ranges to -1
    and 1 respectively. This generates audible distortion.

(2) Scale samples (divide them by 2). This lowers the volume and
    loses 1 bit of precision.

There are plenty of other options, but they are basically
compromises between above two options.

By default sndiod dynamically lowers the volume depending on how
many sounds are playing simultaneously, hence the volume jumps when
clients connect/disconnect. The -v option can be used to pre-scale
samples (lower volume in advance) thus avoiding the most annoying
volume jumps when new clients connect/disconnect, at the expence of
a overal quality/volume loss. The -w option can be used to turn
volume adjustments off, keeping max quality when 1 sound only is
playing, and enabling distortion when 2 or more sounds are playing.

All that to say that there's a compromize to find, which depends on
the user constraints/taste.

HTH

-- Alexandre

Reply via email to