Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
asound.conf: Filter for Subwoofer Channel? [nearly 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
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Mon Nov 19, 2007 4:24 pm    Post subject: asound.conf: Filter for Subwoofer Channel? [nearly solved] Reply with quote

Hello,

can somebody tell me, why my asound.conf isn't working?
Code:
#-----------------
# Volume
# ----------------

# volume of all channels
pcm.softvol {
        type                    softvol         # controler type
        slave.pcm               "multi"         # redirect to
        control {
                name            "SoftMaster"    # controler name
                card            0
        }
}

# splitting the channels
pcm.multi {
        type                    multi           # controler type
        slaves {                                # redirect to
                a.pcm           "front"
                a.channels      2
                b.pcm           "rear"
                b.channels      2
                c.pcm           "center_lfe"
                c.channels      2
        }
        bindings {
                0.slave         a
                0.channel       0
                1.slave         a
                1.channel       1
                2.slave         b
                2.channel       0
                3.slave         b
                3.channel       1
                4.slave         c
                4.channel       0
                5.slave         c
                5.channel       1
        }
}


# ---------------
# Upmix
# ----------------

pcm.upmix_50to51 {
        type                    plug
        slave.pcm               surround51
        slave.channels          6
        ttable {
                0.0     1
                1.1     1
                0.2     1
                1.3     1
                4.4     1
                0.5     0.25
                1.5     0.25
                2.5     0.25
                3.5     0.25
        }
}


# ----------------
# overwrite existing devices
# ----------------

pcm.!surround50 {
        type                    plug
        slave.pcm               "upmix_50to51"
}

pcm.!surround51 {
        type                    plug
        slave.pcm               "softvol"
}


With this configuration
Code:
speaker-test -Dsurround51 -c6 -twav
is working well, but
Code:
speaker-test -Dsurround50 -c5 -twav
fails with the message
Code:
speaker-test: pcm_params.c:187: snd_pcm_hw_param_get_min: Assert »!snd_interval_empty(i)« failed.
I had to translate this message from German, so it's possible, that it sounds a bit different.

Please help!


Last edited by phate on Sat Nov 24, 2007 1:12 am; edited 2 times in total
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Mon Nov 19, 2007 4:37 pm    Post subject: Reply with quote

Quote:
can somebody tell me, why my asound.conf isn't working?


Sorry for posting a useless response, but probably, because ALSA sucks and is buggy as hell with things like this. I tried to do a similar thing to upmix 2 channels to 4.1 and gave up because the plugins just won't work right. I tried 2 or 3 different sample configs and the best I could make work was copying channels. I would have liked to get a lowpassed output for the subwoofer, but I don't know if it's possible with the current state of things.

And, even when it did work, it did bad things to the buffer length, and almost any kind of activity would interrupt the sound. I gave up and just stuck with 2 channels.
Back to top
View user's profile Send private message
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Mon Nov 19, 2007 7:04 pm    Post subject: Reply with quote

Well perhaps I should try to make my question more general: Is there a working method to filter the subwoofer channel with alsa by now? I've read quiete a lot in the alsa wiki about this toppic, but nothing really worked yet. Would be really happy to read some advise! Thanks!

I've managed so far to get 2.0 sound being played by all my 5 satellites, but the subwoofer is sounding awful.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Nov 19, 2007 9:46 pm    Post subject: Reply with quote

Try with/without plug:
Code:
speaker-test -D plug:surround51 -c 6 -t wav

See wiki.

I'm currently experimenting with, in ~/.asoundrc
Code:
pcm.lowpass_21to21 {
    type ladspa
    slave.pcm upmix_21to51
    path "/usr/lib/ladspa"
    channels 3
    plugins {
        0 {
            id 1098 # Identity (Audio) (1098/identity_audio)
            policy duplicate
            input.bindings.0 "Input";
            output.bindings.0 "Output";
        }
        1 {
            id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
            policy none
            input.bindings.2 "Input";
            output.bindings.2 "Output";
            input {
                controls [ 300 2 ]
            }
        }
    }
}


pcm.upmix_20to51 {
    type plug
    slave.pcm "lowpass_21to21"
    slave.channels 3
    ttable {
        0.0     1       # left channel
        1.1     1       # right channel
        0.2     0.5     # mix left and right ...
        1.2     0.5     # ... channel for subwoofer
    }
}


pcm.upmix_21to51 {
    type plug
    slave.pcm surround51
    slave.channels 6
    ttable {
        0.0     1       # front left
        1.1     1       # front right
        0.2     1       # rear left
        1.3     1       # rear right
        0.4     0.5     # center
        1.4     0.5     # center
        2.5     1       # subwoofer
    }
}
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Nov 21, 2007 3:29 pm    Post subject: Reply with quote

I've got it working. It's great fun to play with, and makes the sound clearer, by only having the subwoofer handle bass, so the other speakers can operate without the distortion from pumping out bass themselves. The PCM to use in e.g. audacious is of course upmix_20to51.

Edit: Here's my ~/.asoundrc

The 100 value in the "controls" lines may want changing between something like 80 and 300, depending on the speakers and personal preference.

Code:
# http://alsa.opensrc.org/SurroundSound
# http://alsa.opensrc.org/Low-pass_filter_for_subwoofer_channel_%28HOWTO%29
# Arch Linux:  pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
# speaker-test -D upmix_20to51 -c 2 -t wav
# listplugins
# analyseplugin cmt
# http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
pcm.lowpass_21to21 {
    type ladspa
    slave.pcm upmix_21to51
    path "/usr/lib/ladspa"
    channels 3
    plugins {
      0 {
         id 1098  # Identity (Audio) (1098/identity_audio)
         policy duplicate
         input.bindings.0 "Input";
         output.bindings.0 "Output";
      }

      1 {
         id 1052  # High-pass filter
         policy none
         input.bindings.0 "Input";
         output.bindings.0 "Output";
         input {
            controls [ 100 ]
         }
      }

      2 {
         id 1052  # High-pass filter
         policy none
         input.bindings.1 "Input";
         output.bindings.1 "Output";
         input {
            controls [ 100 ]
         }
      }

      3 {
         id 1051  # Low-pass filter
         policy none
         input.bindings.2 "Input";
         output.bindings.2 "Output";
         input {
            controls [ 100 ]
         }
      }

   }
}


pcm.upmix_20to51 {
   type plug
   slave.pcm "lowpass_21to21"
   slave.channels 3
   ttable {
      0.0     1       # left channel
      1.1     1       # right channel
      0.2     0.5     # mix left and right ...
      1.2     0.5     # ... channel for subwoofer
   }
}


pcm.upmix_21to51 {
   type plug
   slave.pcm surround51
   slave.channels 6
   ttable {
      0.0     1       # front left
      1.1     1       # front right
      0.2     1       # rear left
      1.3     1       # rear right

      # Front left/right to center.
      0.4     0.5
      1.4     0.5

      # Subwoofer, more powerful to compensate for bass-removal from other speakers.
      # Would normally be 1.
      2.5     2
    }
}


Edit: Formatting. Updated URLs.


Last edited by PaulBredbury on Sat Apr 30, 2011 12:56 am; edited 4 times in total
Back to top
View user's profile Send private message
Spudgun
n00b
n00b


Joined: 26 Oct 2007
Posts: 30

PostPosted: Wed Nov 21, 2007 4:35 pm    Post subject: Reply with quote

Can this be done with a 2.1 sound system too?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Nov 21, 2007 6:02 pm    Post subject: Reply with quote

I don't see why not, it's flexible. Main problem is the time it takes to figure out how the configuration file works :wink:
Back to top
View user's profile Send private message
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Fri Nov 23, 2007 5:29 pm    Post subject: Reply with quote

Hi there,

I didn't have any time until now to test this configuration. I wondered, whether there's a way to combine this with a software volume control, because there isn't another way to make my sound volume more silent and on it's default volume level it would simply wake up the whole neighborhood. I've tried the following, but everytime I do a
Code:
speaker-test -D upmix_20to51 -c 2 -t wav

I get a
Code:
speaker-test: pcm_params.c:187: snd_pcm_hw_param_get_min: Assert »!snd_interval_empty(i)« failed.

I had to translate this message from German, so it's possible, that it sounds a bit different.

The configuration I tried looks like this:
Code:
#-----------------
# Volume
# ----------------

# volume of all channels
pcm.softvol {
        type                    softvol         # controler type
        slave.pcm               "multi"         # redirect to
        control {
                name            "SoftMaster"    # controler name
                card            0
        }
}

# splitting the channels in front and rear
pcm.multi {
        type                    multi           # controler type
        slaves {                                # redirect to
                a.pcm           "front"
                a.channels      2
                b.pcm           "rear"
                b.channels      2
                c.pcm           "center_lfe"
                c.channels      2
        }
        bindings {
                0.slave         a
                0.channel       0
                1.slave         a
                1.channel       1
                2.slave         b
                2.channel       0
                3.slave         b
                3.channel       1
                4.slave         c
                4.channel       0
                5.slave         c
                5.channel       1
        }
}


# ---------------
# Upmix (copied from your configuration)
# ----------------

pcm.lowpass_21to21 {
    type ladspa
    slave.pcm upmix_21to51
    path "/usr/lib/ladspa"
    channels 3
    plugins {
      0 {
         id 1098  # Identity (Audio) (1098/identity_audio)
         policy duplicate
         input.bindings.0 "Input";
         output.bindings.0 "Output";
      }

      1 {
         id 1052  # High-pass filter
         policy none
         input.bindings.0 "Input";
         output.bindings.0 "Output";
         input {
            controls [ 100 ]
         }
      }

      2 {
         id 1052  # High-pass filter
         policy none
         input.bindings.1 "Input";
         output.bindings.1 "Output";
         input {
            controls [ 100 ]
         }
      }

      3 {
         id 1051  # Low-pass filter
         policy none
         input.bindings.2 "Input";
         output.bindings.2 "Output";
         input {
            controls [ 100 ]
         }
      }

   }
}

pcm.upmix_20to51 {
   type plug
   slave.pcm "lowpass_21to21"
   slave.channels 3
   ttable {
      0.0     1       # left channel
      1.1     1       # right channel
      0.2     0.5     # mix left and right ...
      1.2     0.5     # ... channel for subwoofer
   }
}

pcm.upmix_21to51 {
   type plug
   slave.pcm surround51
   slave.channels 6
   ttable {
      0.0     1       # front left
      1.1     1       # front right
      0.2     1       # rear left
      1.3     1       # rear right

      # Front left/right to center.
      0.4     0.5
      1.4     0.5

      # Subwoofer, more powerful to compensate for bass-removal from other speakers.
      # Would normally be 1.
      2.5     2
    }
}

# ----------------
# overwrite existing devices
# ----------------

pcm.!default {
        type plug
        slave.pcm               "upmix_20to51"
}

pcm.!surround51 {
        type                    plug
        slave.pcm               "softvol"
}


Can me be helped? :roll:
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Nov 23, 2007 5:43 pm    Post subject: Reply with quote

Quote:
slave.pcm surround51

That won't work if "surround51" isn't defined. See thread for defining it :)
Back to top
View user's profile Send private message
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Fri Nov 23, 2007 6:07 pm    Post subject: Reply with quote

Thank you so much,
Code:
speaker-test -D upmix_20to51 -c 2 -t wav

is working now. One bad thing remains:
Code:
speaker-test -D default -c 2 -t wav

complains the same way "upmix_20to51" did previously. Any idea how to fix this?
You are using dmix, but as I have read here, I don't need dmix if my sound card supports hardware mixing (I'm pretty sure it does).

My configuration changed only in one line, where "slave.pcm surround51" was replaced by "slave.pcm softvol". The naming isn't best, I will change this when everything is working.
Back to top
View user's profile Send private message
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Fri Nov 23, 2007 7:05 pm    Post subject: Reply with quote

I've fixed this with the following:
Code:
pcm.!default {
        type                    asym
        playback.pcm            "upmix_20to51"
}


When playing stereo mp3 files I notice something strange: My subwoofer makes sounds like "klong", it sounds a bit like it's being oversteered. I will try to describe the scenario:
- Let's use mplayer with software mixing turned on in it's properties.
- Case 1)
--- Let's set mplayer's own volume bar to 100%.
--- Let's set SoftMaster to 7%
- Results in a quiete silent output with a subwoofer klonking on every beat.
- Case 2)
--- Let's set mplayer's own volume bar to 50%.
--- Let's set SoftMaster to 40%.
- Results in very good, loud and clear sound.

Can somebody explain this?? :?:


Last edited by phate on Fri Nov 23, 2007 7:50 pm; edited 2 times in total
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Nov 23, 2007 7:30 pm    Post subject: Reply with quote

I use:
Code:
# Subwoofer, more powerful to compensate for bass-removal from other speakers.
2.5     2

Try changing the 2 to 1, which will halve the volume.
Back to top
View user's profile Send private message
phate
Apprentice
Apprentice


Joined: 22 Mar 2004
Posts: 298
Location: Aachen, Germany

PostPosted: Fri Nov 23, 2007 7:43 pm    Post subject: Reply with quote

Thanks, that solved the subwoofer klonking :D
But regarding the above described scenario: In case 2 (low volume in mplayer) the sound is perfect.
With high volume in mplayer the "normal" speakers are "scratching" a bit. This didn't happen in case 2 as described above. I'm not sure, but I have the slight feeling, that the more bass there's in a song, the more the speakers are scratching. I've already tried setting the frequency for the "controls" lines to 300, but it didn't help.

my current config
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