Re: Higher quality dmix resampling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 16 May 2009, Grant wrote:

> >> If it's the latter (as usually is on modern systems), then its just
> >> the input interface that changes, you're goin' trough ALSA anyway.
> 
> Also, I should mention something that contradicts this.  When I define
> a "format" for dmix in /etc/asound.conf that my DAC doesn't like, no
> ALSA apps will play sound.  However, if I choose to output via OSS in
> those apps, I get sound.  Here is an example of an asound.conf that
> causes apps set to ALSA to not play sound at all, and apps set to OSS
> to play sound perfectly as always:

well, that does only mean that the OSS-emulation interface does not 
obey asound.conf (and/or .asoundrc) rules but use some different 
"general" setup. This of course makes perfect sense, as OSS provided
only a simple device file interface: there would be no reason for the
emulated OSS interface to provide anything different...

Thus, I would say that what this means is that the underlying low-
level driver (at least in some conditions) does work, but either the 
default setup on your installation is somewhat screwed or the driver 
does not work properly in all possible modes (that is, yet another
snd_hda* bug...).

BTW, since I'm here I'm attaching the .asoundrc I'm using on my HTPC. 
I'm not 100% sure whether it's completely correct, but for sure playing 
to the default device (which goes to the on-board HDA) as well as to the 
HD192 & HD176 does work perfectly. I'm also quite sure that indeed ALSA 
does obey the "defaults.pcm.rate_converter" setting (yes, also for the 
HDnnn "resampling inputs" to the Juli@).

Removing all the (still "experimental") parts used to "distribute" the 
signal to various outputs (I did that mainly for testing purpouses...)
and the "duplicate" parts for different settings, all that matters is 
basically just this:

# ~/.asoundrc
defaults.pcm.rate_converter "speexrate_best"

############################################################################
# Give our card(s) some friendly aliases.
#
pcm.Juli12 "front:CARD=Juli,DEV=0"
#
# This is Julia channels 1&2 (analog stereo & tapped I2S out)
# device name "front:CARD=Juli,DEV=0" obtained with "aplay -L"

############################################################################
# Upsampling slave(s)
#
pcm.HD192 {
        type plug
        slave {
                pcm "Juli12"
                format S32_LE
                rate 192000
        }
}

# that's all

To use the upsampled output, just use "HD192" as the name for 
the alsa output device in applications (e.g. I always use that 
to play music on my main HiFi system with "Amarok").

If you want to try that, just replace "Juli" with the name of
your target device and change rate & format to whatever it can
support.

Yet again, should it work this way IMHO it does so "by chance": 
the default MUST work just fine as well. That is, there must be 
a bug somewhere...


Ciao,
                                Paolo.

--
Skype: Paolo.Saggese
http://borex.lngs.infn.it/saggese
You can still escape from the GATES of hell: Use Linux!
#defaults.pcm.rate_converter "lavcrate"
#defaults.pcm.rate_converter "lavcrate_higher"
#defaults.pcm.rate_converter "samplerate"
#defaults.pcm.rate_converter "samplerate_best"
#defaults.pcm.rate_converter "speexrate"
defaults.pcm.rate_converter "speexrate_best"

############################################################################
# Give our cards some friendly aliases.

# Intel HDA analog
#
pcm.hda "default:CARD=Intel"

# Intel HDA digital 
#
pcm.hdad "iec958:CARD=Intel,DEV=0"

# Julia channels 1&2 (analog & tapped I2S out)
#
pcm.Juli12 "front:CARD=Juli,DEV=0"

# Julia channels 3&4 (optical out)
#
pcm.Juli34 "iec958:CARD=Juli,DEV=0"


############################################################################
# 'multi' plugin allows us to create many slave devices and then distribute 
# the stream's channels between the slaves.
#
# Here we define Slave a for Julia ch 1&2 (analog & I2S) and Slave b for 
# HDA S/PDIF. Then we use channel binding to send channels 0 & 1 to the 
# Juli@ and channels 2 & 3 to the Intel HDA.
#
pcm.multi4 {
        type multi
        slaves.a {
                pcm "Juli12"
                channels 2
        }
        slaves.b {
                pcm "hda"
                channels 2
        }
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}
# Here we define Slave a for Julia ch 1&2 (analog & I2S) 
# and Slave b for 3&4 (S/PDIF).
# Then we use channel binding to send channels 0 & 1 to 
# analog/I2S and channels 2 & 3 to S/PDIF.
#
pcm.multi6 {
        type multi
        slaves.a {
                pcm "Juli12"
                channels 2
        }
        slaves.b {
                pcm "Juli34"
                channels 2
        }
        slaves.c {
                pcm "hda"
                channels 2
        }
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
        bindings.4.slave c
        bindings.4.channel 0
        bindings.5.slave c
        bindings.5.channel 1
}


############################################################################
# Here we are using the 'route' plugin to send the signal unchanged to a 
# 6-channel device. Since the incoming stream is only 2-channel, we use
# the transfer table to copy channel 0 slave's input channel 0, channel 1 
# to slave's 1, and again channel 0 to slave's 2, etc. 
# The last column (1.0) is the volume, which we are leaving unchanged

# Send to Julia channels 1&2 (analog, I2S, copper S/PDIF) as well as 
# to Intel HDA S/PDIF (optical) out. This can support up to 24/192 ?
#
pcm.both {
        type route
        slave {
                pcm multi4
                channels 4
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

# Send to all Julia channels (analog, I2S, copper & optical S/PDIF) as 
# well as to Intel HDA S/PDIF (optical) out. == Rates up to 24/96 only!
#
pcm.all {
        type route
        slave {
                pcm multi6
                channels 6
        }
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
        ttable.0.4 1.0
        ttable.1.5 1.0
}

############################################################################
# Upsampling slaves
#
pcm.HD192 {
	type plug
	slave {
		pcm "Juli12"
		#pcm "both"
		format S32_LE
		rate 192000
	}
}

pcm.HD176 {
	type plug
	slave {
		pcm "Juli12"
		#pcm "both"
		format S32_LE
		rate 176400
	}
}

pcm.HD96 {
	type plug
	slave {
		pcm "all"
		format S32_LE
		rate 96000
	}
}

pcm.HD88 {
	type plug
	slave {
		pcm "all"
		format S32_LE
		rate 88200
	}
}

pcm.HD48 {
	type plug
	slave {
		pcm "all"
		format S32_LE
		rate 48000
	}
}

pcm.HD44 {
	type plug
	slave {
		pcm "all"
		format S32_LE
		rate 44100
	}
}

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux