Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to copy sound from front to rear on SB Live! SOLVED
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Tue Aug 25, 2015 1:57 am    Post subject: How to copy sound from front to rear on SB Live! SOLVED Reply with quote

I have an SB0228 sound card. speaker-test -t wav -c 4 -D surround40 plays sounds through the front and rear sockets appropriately, but I'm not interested in that. I would like to copy stereo sounds from the front to the rear. That way I can plug my speakers into front, headphones into rear and I won't need a silly Y splitter. How do I copy front to rear?

Quote:
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Live
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
Default Audio Device
sysdefault:CARD=Live
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
Default Audio Device
front:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
Front speakers
rear:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
Rear speakers
center_lfe:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
Center and Subwoofer speakers
surround21:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
4.0 Surround output to Front and Rear speakers
surround41:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], ADC Capture/Standard PCM Playback
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=Live,DEV=0
SB Live! 5.1 Dell OEM [SB0228], Multichannel Capture/PT Playback
IEC958 (S/PDIF) Digital Audio Output


aplay -l
emerge --info


Last edited by Fog_Watch on Tue Aug 25, 2015 11:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Tue Aug 25, 2015 9:24 am    Post subject: Reply with quote

Simply put, you cannot because it's impossible.

Still, if you were using JACK you could connect any client (app/port)-output to any client (app/port)-input. So, if a client output 2-channels (stereo); you can then, simply connect those two ports twice -- front and rear inputs/speakers. Simply as that. An example of a simple set up of JACK/clients can be found on dotfiles using LADI front to manage studio/room/setup. -- You would be interested in `~/.ladish/studios/default.xml'. However, for that, a few LADI related apps can be found bar-overly or pro-audio overlay. You could grap [ladi-]daw portage/emerge @set from either the overlay or dotfiles repos and modify it to get what's necessary for that purpose.
_________________
home/:mkinitramfs-ll/:supervision/:e-gtk-theme/:overlay/
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2573
Location: Here and Away Again

PostPosted: Tue Aug 25, 2015 10:34 am    Post subject: ><)))°€ Reply with quote

Is it impossible, really?

Perhaps I don't quite understand this correct-like, but I feel like I've done something like this (sort of), with just plain ALSA.

Dark Souls, a game not so well ported to the PC platform, has (to my understanding) 5.1 audio, with no option to make it stereo. I believe it caused issues to people running it natively on Windows even, but I'm using Wine, of course, but I digress. I'm unsure if there is a Wine-related issue here as well, since some of the issues were supposedly fixed for the native, but again, not the point.

The point is, that the audio was quite messed up indeed, and from all this I noticed that even with speaker-test I would get audio from incorrect directions while using headphones while 5.1 channels were enabled. So, I looked into how to make things come out from different channels.

Parts of it is also to create a loopback device so I can record game and other audio like that, since the drivers don't provide means to record it. :[

Code:
# File: ~/.asoundrc

pcm.!default
{
    type asym
    playback.pcm "correctedSurround"
    #capture.pcm "loopRecord"
    capture.pcm "hw:1"
}

pcm.correctedSurround
{
    type route
    slave.pcm "loopAndReal"
    ttable
    {
        0.0 1      # Front Left
        1.1 1      # Front Right
        2.0 0.2    # Rear Left
        3.1 0.2    # Rear Right
        4.0 1      # Front Center
        4.1 1      # Front Center
        5.0 0.2    # Rear Center
        5.1 0.2    # Rear Center
    }
}

pcm.loopRecord
{
    type hw
    card "Loopback"
    device 1
    subdevice 0
}

pcm.loopAndReal
{
    type plug
    slave.pcm binder
    route_policy "duplicate"
}

pcm.binder
{
    type multi
    slaves.a.pcm xonarer
    slaves.a.channels 2
    slaves.b.pcm looper
    slaves.b.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
}

pcm.looper
{
    type dmix
    ipc_key 1027
    slave
    {
        pcm "hw:Loopback,0,0"
        #rate 48000 # 44100, 48000, 96000 etc.
        periods 128
        period_time 0
        period_size 1024 # Power of 2.
        buffer_size 8192 # Power of 2.
    }
}

pcm.xonarer
{
    type dmix
    ipc_key 1024
    slave
    {
        pcm "hw:1"
        #rate 48000 # 44100, 48000, 96000 etc.
        periods 128
        period_time 0
        period_size 1024 # Power of 2.
        buffer_size 8192 # Power of 2.
    }
}


Essentially, I'm copying (duplicating) all channels into just the two. It's possible to combine actual hardware as well, so I don't see why it shouldn't be possible to do what is asked for here.

Maybe I'm just not 'getting it' due to being half-asleep (or other reasons). ^^;

Apologies if I'm way off with all I've just put down into writing.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Tue Aug 25, 2015 11:38 am    Post subject: Reply with quote

You *seem* to be spot on, rightly, with that ALSA magic! Well then, as the @OP seems to be dealing with ALSA (no JACK mentioned), the road or rather the *highway* is green for him to adapat that magic. Indeed possible,--to re-route or rather duplicate channels.

Ahem,--I may had the eyes half-opened; let's try open one then [irony to @Chiitoo tone's care... or was it irony? who cares!].
_________________
home/:mkinitramfs-ll/:supervision/:e-gtk-theme/:overlay/
Back to top
View user's profile Send private message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Tue Aug 25, 2015 11:56 pm    Post subject: Reply with quote

The following /etc/asound.conf appears to do the job needed. I found most of it on the electric Internet and then cut the file up with a hatchet.

Note that the card does not have hardware volume control on rear. I think it was for this reason that I had to feed everything through softvol.

Quote:
pcm.!default {
type plug
slave.pcm "softvol" #make use of softvol
}

#No, I don't understand why I can't have this
#Uncommented returns a libasound_module_ctl_plug.so error.
#ctl.!default {
# type plug
# slave.ctl "softvol" #make use of softvol
#}

# This is the four-channel card that sends its first two channels
# to one real card, and the other two channels to the other card.
pcm.two {
type multi;
slaves {
a {
# The first real card, change to "channel:CARD=CardName"
# for your system.
pcm "front:CARD=Live"; #I couldn't get hardware definitions to work here
channels 2;
}
b {
# The second real card, change to "channel:CARD=CardName"
# for your system.
pcm "rear:CARD=Live";
channels 2;
}
}

# This configures how the four channels of this virtual
# card are distributed amongst the real cards.
bindings {
0 { slave a; channel 0; }
1 { slave a; channel 1; }
2 { slave b; channel 0; }
3 { slave b; channel 1; }
}
}

# This virtual "sound card" mixes two channels up to four.
pcm.both {
type route

# Its four-channel output is sent to the "two" device.
slave {
pcm "two"
}

# This defines how the channels are mixed. Input channel 0 is
# sent for 100% to channels 0 and 2 of device "two",
# and its channel 1 is sent for 100% to channels 1 and 3.
ttable {
0 { 0 1.0; 2 1.0 }
1 { 1 1.0; 3 1.0 }
}
}

pcm.softvol {
type softvol
slave.pcm "both"
control.name "Softmaster"
}
ctl.softvol {
type softvol
slave.ctl "both"
control.name "Softmaster"
}


Remember tclover, it's statements like, "it's impossible" that make things possible. Seriously, much appreciated.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum