Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Pure Alsa configuration
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 5:15 pm    Post subject: Reply with quote

kajzer wrote:
ff11 wrote:

Just changed the name and one description. So you can use the "loopback_play_mic_rec"


Nope.

Yeah. I kind of knew. But now you can open a new thread for someone that use loppback to fix it (it's more easy with just one file).
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 5:18 pm    Post subject: Re: Alsa configuration Reply with quote

Jimmy Jazz wrote:
Try the following code with the library of your choice.

Code:


ctl.equal {
   type equal;
   library "/usr/lib64/ladspa/mbeq_1197.so";
   module "mbeq";
}

pcm.equal0 {
   type equal;
   #slave.pcm "plughw:0,0";
   slave.pcm "dmixer";
   library "/usr/lib64/ladspa/mbeq_1197.so";
   module "mbeq";
}

pcm.equal {
   type plug;
   slave.pcm equal0;
}


This works now, installing alsaequal solved it, "type equal" requires it.
I will have to insert 6 channels etc. to test it fully though and see how it behaves.
But it works.


Last edited by The Main Man on Wed Mar 11, 2020 5:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 5:21 pm    Post subject: Reply with quote

ff11 wrote:
kajzer wrote:
ff11 wrote:

Just changed the name and one description. So you can use the "loopback_play_mic_rec"


Nope.

Yeah. I kind of knew. But now you can open a new thread for someone that use loppback to fix it (it's more easy with just one file).


I will play with recording when I solve LADSPA, which is a priority right now.
But changing a config file just for that occasion is not really a big of a problem, for now.
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 5:21 pm    Post subject: Re: Alsa configuration Reply with quote

kajzer wrote:
Jimmy Jazz wrote:
Try the following code with the library of your choice.

Code:


ctl.equal {
   type equal;
   library "/usr/lib64/ladspa/mbeq_1197.so";
   module "mbeq";
}

pcm.equal0 {
   type equal;
   #slave.pcm "plughw:0,0";
   slave.pcm "dmixer";
   library "/usr/lib64/ladspa/mbeq_1197.so";
   module "mbeq";
}

pcm.equal {
   type plug;
   slave.pcm equal0;
}


This works now, installing alsaequal sovedd it, "type equal" requires it.
I will have to insert 6 channels etc. to test it fully though and see how it behaves.
But it works.

Wow! Good to know. So now you have all that you need to be one alsa professional configurer :D
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 5:23 pm    Post subject: Re: Alsa configuration Reply with quote

ff11 wrote:
Wow! Good to know. So now you have all that you need to be one alsa professional configurer :D


Hahaha , yeah :D

I'll try now btw that alsaequal with those caps plugins, maybe I can come up with something :idea:
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 6:01 pm    Post subject: Reply with quote

Problem with alsaequal is guess what ... 5.1 :D

It says here how you define number of channels
https://github.com/bassdr/alsaequal

so
Code:

ctl.equal {
    type equal;
    channels 6;
}

pcm.plugequal {
    type equal;
    slave.pcm "plughw:2,0";
    channels 6;
}

pcm.equal{
    type plug;
    slave.pcm plugequal;
}


it gives :

Code:
$ speaker-test -Dequal -c6 -l1 -twav                                                                                                                                                                                     

speaker-test 1.2.2

Playback device is equal
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 87376
Period size range from 16 to 43680
Using max buffer size 87376
Periods = 4
Unable to set nperiods 4 for playback: Invalid argument
Setting of hwparams failed: Invalid argument
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 6:42 pm    Post subject: Reply with quote

kajzer wrote:
Problem with alsaequal is guess what ... 5.1 :D
...

That's normal. Most users use only stereo (and most use headphones too).
The github issue is disabled for the repo and don't have any way of reach the owner of the fork. So no support too.

EDIT: There is a "successor of LADSPA", the "media-libs/lv2" (http://lv2plug.in). Maybe there is something better there (like the eq10q). But have to found how to use it first.
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 7:08 pm    Post subject: Reply with quote

Even tried to patch the alsaequal and change the number of channels that way, that way there's no error with speaker-test but channels are wrong.

Code:
--- a/ctl_equal.c-org   2020-03-11 19:04:01.586892606 +0100
+++ b/ctl_equal.c   2020-03-11 19:11:12.473502205 +0100
@@ -167,7 +167,7 @@
    const char *controls = ".alsaequal.bin";
    const char *library = "caps.so";
    const char *module = "Eq10";
-   long channels = 2;
+   long channels = 6;
    const char *sufix = " Playback Volume";
    int err, i, index;


I'll remove alsaequal and try something else.

Nice find @ff11 about lv2, I'll take a closer look now.
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 7:27 pm    Post subject: Reply with quote

kajzer wrote:

Nice find @ff11 about lv2, I'll take a closer look now.

There is the same LADSPA plugin that you use in lv2 inside portage too: "media-plugins/swh-lv2"

And some more popular: https://www.reddit.com/r/linuxaudio/comments/83inmg/what_are_your_favorite_ladspalv2_plugins/

EDIT: Don't forget about the "lv2" USE flag too.
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 7:40 pm    Post subject: Reply with quote

I have installed swh-plugins, that's what I've been using for years, maybe I need to replace that with swh-lv2
Will try that later.

Currently I'm trying freesurround plugin, compiled it and installed it, trying to use it now, supposed to be replace upmix if I understand it right.

http://micosphere.free.fr/freesurround-alsa/documentation
https://lichtmetzger.de/en/2014/04/22/better-stereo-to-5-1-upmix-on-linux-alsa-asoundrc/
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 7:58 pm    Post subject: Reply with quote

kajzer wrote:
I have installed swh-plugins, that's what I've been using for years, maybe I need to replace that with swh-lv2
Will try that later.

Currently I'm trying freesurround plugin, compiled it and installed it, trying to use it now, supposed to be replace upmix if I understand it right.

http://micosphere.free.fr/freesurround-alsa/documentation
https://lichtmetzger.de/en/2014/04/22/better-stereo-to-5-1-upmix-on-linux-alsa-asoundrc/

I has taken a look, but this ins't very clear.You will have to read the documentation of "freesurround-alsa".

Well, unfortunately the lv2 doesn't seem to work with pure alsa.

If you like things like this, then i will recommend the change to JACK,
and the use of "Carla" to load and manager the plugins: https://github.com/falkTX/Carla
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 8:45 pm    Post subject: Reply with quote

I tested freesurround, it makes it worse in my case, instead of upmixing to 5.1 it makes everything to 2.1

That made me thinking about upmix alsa plugin and why it doesn't work with LADSPA, so I did testing without LADSPA and it doesn't upmix anything, having it there or not is completely the same and doesn't make a difference.

I was thinking about JACK but it would be too much for me right now, maybe some day.

Kinda getting used to living without that sc4 plugin , it's not that bad without it like it used to be few years back, maybe libraries changed and it's better now or it's worse in pulseaudio and somehow better in pure alsa.
Easy to test with pulseuadio without LADSPA but I'm not in mood for testing that now.

Some sources are too low without it, like if I play some music and notification comes with sound (it plays wav file actually) I can barely hear it, with sc4 ladspa plugin everything was equalized to the same level.
Well... it is what it is... LADSPA is definitely doing it's thing with pure alsa, upmix should take that 2.0 output from it and make it 5.1 but it doesn't.
I'll try to look for maybe some other upmix plugin out there, I don't know...
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 8:55 pm    Post subject: Reply with quote

kajzer wrote:
I tested freesurround, it makes it worse in my case, instead of upmixing to 5.1 it makes everything to 2.1

That made me thinking about upmix alsa plugin and why it doesn't work with LADSPA, so I did testing without LADSPA and it doesn't upmix anything, having it there or not is completely the same and doesn't make a difference.

I was thinking about JACK but it would be too much for me right now, maybe some day.

Kinda getting used to living without that sc4 plugin , it's not that bad without it like it used to be few years back, maybe libraries changed and it's better now or it's worse in pulseaudio and somehow better in pure alsa.
Easy to test with pulseuadio without LADSPA but I'm not in mood for testing that now.

Some sources are too low without it, like if I play some music and notification comes with sound (it plays wav file actually) I can barely hear it, with sc4 ladspa plugin everything was equalized to the same level.
Well... it is what it is... LADSPA is definitely doing it's thing with pure alsa, upmix should take that 2.0 output from it and make it 5.1 but it doesn't.
I'll try to look for maybe some other upmix plugin out there, I don't know...

I think you will have to use alsa route for this. like:
Code:

# 2.0 to 4.1 mirrors the front speakers to the rear speakers, and combines the two
pcm.20to51 {
  type route
  slave.pcm surround51
  slave.channels 6
  ttable.0.0 1
  ttable.1.1 1
  ttable.0.2 1
  ttable.1.3 1
  ttable.0.4 0.5
  ttable.1.4 0.5
}

_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 9:03 pm    Post subject: Reply with quote

Something like that:
Code:

#------------------------------------------------------------------------------------
# Cards
#------------------------------------------------------------------------------------
pcm.onboard_card {
   type hw
   card 2
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration upmixing
#------------------------------------------------------------------------------------
pcm.setup_6ch {
   type plug # format conversion
   #slave.pcm "upmixer"
   slave.pcm "ladspa_sc4"
}

# ------- ladspa chain that use 2ch -------
pcm.ladspa_sc4 {
   type ladspa
   slave.pcm "upmixer"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

pcm.upmixer {
   type upmix # on-demand upmixing
   slave.pcm "20to51"
   channels 6
}

# 2.0 to 4.1 mirrors the front speakers to the rear speakers, and combines the two
pcm.20to51 {
   type route
   slave.pcm "duplex"
   slave.channels 6
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
   ttable.0.4 0.5
   ttable.1.4 0.5
}

pcm.duplex {
   type asym
   playback.pcm "dmixplug"
   #playback.pcm "ladspa_sc4"
   capture.pcm "dsnooper"
}

# ------- ladspa chain that use 6ch -------
pcm.ladspa_sc4 { # this is one 2ch compressor just to be one model
   type ladspa
   slave.pcm "dmixplug"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

pcm.dmixplug {
   type plug
   slave.pcm "dmixer"
}

pcm.dmixer {
   type dmix # multi-stream mixing
   ipc_key 4897
   
   slave {
      pcm "onboard_card"
      channels 6 # adjust as necessary (e.g. 8 for 7.1 audio)

      # MAY be necessary to avoid buffer underruns/audio skipping
      # YMMV, remove or adjust values as you see fit
      period_time 0
      period_size 1024 # double if you notice increased CPU load or crackling
      # halve if you like lower latency
      # (e.g. when adjusting volume with softvol enabled)
      buffer_time 0
      buffer_size 8192 # some applications do not like smaller buffers
      
      rate 48000
   }
}

pcm.dsnooper {
   type dsnoop
   ipc_key 5897
   ipc_perm 0666
   slave.pcm "onboard_card"
   slave  {
      period_time 0
      period_size 1024
      buffer_size 4096
      rate 48000
   }
   bindings {
      0 0
      1 1
   }
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration for 5.1 Surround output
#------------------------------------------------------------------------------------
pcm.surround51-ice {
   type plug
   slave.pcm "duplex"
}

#------------------------------------------------------------------------------------
# Loopback config. to record from mic plus system
#------------------------------------------------------------------------------------
# don't work for this setup
pcm.loopback_play_mic_rec
{
   type asym
   playback.pcm "loopAndReal"
   capture.pcm "loopRecord"

   hint
   {
      show on
      description "(Loopback-PlayMicRec)"
   }
}

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 "generic"
   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 1024
   ipc_key_add_uid 0
   ipc_perm 0666

   slave
   {
      pcm "hw:Loopback,0,0"
      rate 48000 # 44100, 48000, 96000 etc.
      periods 2
      period_time 0
      period_size 1024
      buffer_time 0
      buffer_size 8192
      #buffer_size 16384
      format s16_le
   }
}

pcm.generic
{
   type dmix
   ipc_key 1028
   ipc_key_add_uid 0
   ipc_perm 0666

   slave
   {
      pcm "hw:2"
      rate 48000 # 44100, 48000, 96000 etc.
      periods 2
      period_time 0
      period_size 1024
      buffer_time 0
      buffer_size 8192
      #buffer_size 16384
      format s16_le
   }
}

#------------------------------------------------------------------------------------
# Special entries for apulse in apps like skype
#------------------------------------------------------------------------------------
pcm.duplexPulse {
   # combine playback and capture devices
   type asym
   playback.pcm "dmixerPulse"
   capture.pcm "dsnooper"
}

pcm.dmixerPulse {
   type dmix
   ipc_key 7071
   slave {
      pcm "onboard_card"
      period_size 1024
      buffer_size 4096
      
      rate 48000
   }
}

#------------------------------------------------------------------------------------
# Global configurations
#------------------------------------------------------------------------------------
# for better quality convertion
defaults.pcm.rate_converter "speexrate_medium"

#------------------------------------------------------------------------------------
# My defaults
#------------------------------------------------------------------------------------
pcm.!default pcm.setup_6ch
pcm.!surround51 pcm.surround51-ice


_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 9:43 pm    Post subject: Reply with quote

No, it's the same like it was with regular upmix.
After LADSPA is involved the sound comes only from front-left and front-right speakers.

Interestingly, Kodi in that case doesn't see a regular device, only shows Loopback devices.
And doesn't produce audio at all.

Weird stuff!
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 9:46 pm    Post subject: Reply with quote

kajzer wrote:
No, it's the same like it was with regular upmix.
After LADSPA is involved the sound comes only from front-left and front-right speakers.

Interestingly, Kodi in that case doesn't see a regular device, only shows Loopback devices.
And doesn't produce audio at all.

Weird stuff!

I forgot to remove the "loopback" thing:
Code:

#------------------------------------------------------------------------------------
# Cards
#------------------------------------------------------------------------------------
pcm.onboard_card {
   type hw
   card 2
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration upmixing
#------------------------------------------------------------------------------------
pcm.setup_6ch {
   type plug # format conversion
   #slave.pcm "upmixer"
   slave.pcm "ladspa_sc4"
}

# ------- ladspa chain that use 2ch -------
pcm.ladspa_sc4 {
   type ladspa
   slave.pcm "upmixer"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

pcm.upmixer {
   type upmix # on-demand upmixing
   slave.pcm "20to51"
   channels 6
}

# 2.0 to 4.1 mirrors the front speakers to the rear speakers, and combines the two
pcm.20to51 {
   type route
   slave.pcm "duplex"
   slave.channels 6
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
   ttable.0.4 0.5
   ttable.1.4 0.5
}

pcm.duplex {
   type asym
   playback.pcm "dmixplug"
   #playback.pcm "ladspa_sc4"
   capture.pcm "dsnooper"
}

# ------- ladspa chain that use 6ch -------
pcm.ladspa_sc4 { # this is one 2ch compressor just to be one model
   type ladspa
   slave.pcm "dmixplug"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

pcm.dmixplug {
   type plug
   slave.pcm "dmixer"
}

pcm.dmixer {
   type dmix # multi-stream mixing
   ipc_key 4897
   
   slave {
      pcm "onboard_card"
      channels 6 # adjust as necessary (e.g. 8 for 7.1 audio)

      # MAY be necessary to avoid buffer underruns/audio skipping
      # YMMV, remove or adjust values as you see fit
      period_time 0
      period_size 1024 # double if you notice increased CPU load or crackling
      # halve if you like lower latency
      # (e.g. when adjusting volume with softvol enabled)
      buffer_time 0
      buffer_size 8192 # some applications do not like smaller buffers
      
      rate 48000
   }
}

pcm.dsnooper {
   type dsnoop
   ipc_key 5897
   ipc_perm 0666
   slave.pcm "onboard_card"
   slave  {
      period_time 0
      period_size 1024
      buffer_size 4096
      rate 48000
   }
   bindings {
      0 0
      1 1
   }
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration for 5.1 Surround output
#------------------------------------------------------------------------------------
pcm.surround51-ice {
   type plug
   slave.pcm "duplex"
}

#------------------------------------------------------------------------------------
# Special entries for apulse in apps like skype
#------------------------------------------------------------------------------------
pcm.duplexPulse {
   # combine playback and capture devices
   type asym
   playback.pcm "dmixerPulse"
   capture.pcm "dsnooper"
}

pcm.dmixerPulse {
   type dmix
   ipc_key 7071
   slave {
      pcm "onboard_card"
      period_size 1024
      buffer_size 4096
      
      rate 48000
   }
}

#------------------------------------------------------------------------------------
# Global configurations
#------------------------------------------------------------------------------------
# for better quality convertion
defaults.pcm.rate_converter "speexrate_medium"

#------------------------------------------------------------------------------------
# My defaults
#------------------------------------------------------------------------------------
pcm.!default pcm.setup_6ch
pcm.!surround51 pcm.surround51-ice

Please test again. But the route should have worked now.
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 9:57 pm    Post subject: Reply with quote

Again the same.

I feel there's nothing that could be done.
Either some new (more recent) plugins which are doing the similar thing or I don't know what, it's just not doable maybe.

I mean I understand that majority of people have stereo speakers/headphones , but having 5.1 speakers or better isn't abnormal ffs
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 10:03 pm    Post subject: Reply with quote

kajzer wrote:
Again the same.

I feel there's nothing that could be done.
Either some new (more recent) plugins which are doing the similar thing or I don't know what, it's just not doable maybe.

I mean I understand that majority of people have stereo speakers/headphones , but having 5.1 speakers or better isn't abnormal ffs

Well, "normal" or "anormal" are just about the number of people. Let's try before upmix:
Code:

#------------------------------------------------------------------------------------
# Cards
#------------------------------------------------------------------------------------
pcm.onboard_card {
   type hw
   card 2
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration upmixing
#------------------------------------------------------------------------------------
pcm.setup_6ch {
   type plug # format conversion
   #slave.pcm "upmixer"
   slave.pcm "ladspa_sc4"
}

# ------- ladspa chain that use 2ch -------
pcm.ladspa_sc4 {
   type ladspa
   slave.pcm "20to51"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

# 2.0 to 4.1 mirrors the front speakers to the rear speakers, and combines the two
pcm.20to51 {
   type route
   slave.pcm "upmixer"
   slave.channels 6
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
   ttable.0.4 0.5
   ttable.1.4 0.5
}

pcm.upmixer {
   type upmix # on-demand upmixing
   slave.pcm "duplex"
   channels 6
}

pcm.duplex {
   type asym
   playback.pcm "dmixplug"
   #playback.pcm "ladspa_sc4"
   capture.pcm "dsnooper"
}

# ------- ladspa chain that use 6ch -------
pcm.ladspa_sc4 { # this is one 2ch compressor just to be one model
   type ladspa
   slave.pcm "dmixplug"
   path "/usr/lib64/ladspa";
   plugins [
   {
      label sc4
      input {
         #         RMS/peak   attac time (ms)   release time (ms)   threshold (dB)   ratio   knee radius   attenuation
         controls  [1         1.5               401                 -10              20      5             12]
      }
   }]
}
#-----------------------------------

pcm.dmixplug {
   type plug
   slave.pcm "dmixer"
}

pcm.dmixer {
   type dmix # multi-stream mixing
   ipc_key 4897
   
   slave {
      pcm "onboard_card"
      channels 6 # adjust as necessary (e.g. 8 for 7.1 audio)

      # MAY be necessary to avoid buffer underruns/audio skipping
      # YMMV, remove or adjust values as you see fit
      period_time 0
      period_size 1024 # double if you notice increased CPU load or crackling
      # halve if you like lower latency
      # (e.g. when adjusting volume with softvol enabled)
      buffer_time 0
      buffer_size 8192 # some applications do not like smaller buffers
      
      rate 48000
   }
}

pcm.dsnooper {
   type dsnoop
   ipc_key 5897
   ipc_perm 0666
   slave.pcm "onboard_card"
   slave  {
      period_time 0
      period_size 1024
      buffer_size 4096
      rate 48000
   }
   bindings {
      0 0
      1 1
   }
}

#------------------------------------------------------------------------------------
# 6ch alsa configuration for 5.1 Surround output
#------------------------------------------------------------------------------------
pcm.surround51-ice {
   type plug
   slave.pcm "duplex"
}

#------------------------------------------------------------------------------------
# Special entries for apulse in apps like skype
#------------------------------------------------------------------------------------
pcm.duplexPulse {
   # combine playback and capture devices
   type asym
   playback.pcm "dmixerPulse"
   capture.pcm "dsnooper"
}

pcm.dmixerPulse {
   type dmix
   ipc_key 7071
   slave {
      pcm "onboard_card"
      period_size 1024
      buffer_size 4096
      
      rate 48000
   }
}

#------------------------------------------------------------------------------------
# Global configurations
#------------------------------------------------------------------------------------
# for better quality convertion
defaults.pcm.rate_converter "speexrate_medium"

#------------------------------------------------------------------------------------
# My defaults
#------------------------------------------------------------------------------------
pcm.!default pcm.setup_6ch
pcm.!surround51 pcm.surround51-ice

Please test again.
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 10:16 pm    Post subject: Reply with quote

Starting to hate this :D
But still the same.

I read Arch wiki just now, wanted to learn more about speex thingy, what more options are there with it etc.
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#High_quality_resampling

and there's a section about LADSPA , mbeq actually, which says what is already known but I guess speaks enough (it can't be done with 5.1)
Quote:
Note: This method requires the use of a LADSPA plugin which might be CPU intensive during playback. In addition, this was made with stereophonic sound (e.g. headphones) in mind.


I'm using your config with disabled ladspa and I'm happy with it for now, I'll stay with it, it's not that bad :D

I appreciate your help but I think it's best to forget about LADSPA in this scenario, I think I will :D
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 10:23 pm    Post subject: Reply with quote

kajzer wrote:
Starting to hate this :D
But still the same.

I read Arch wiki just now, wanted to learn more about speex thingy, what more options are there with it etc.
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#High_quality_resampling

and there's a section about LADSPA , mbeq actually, which says what is already known but I guess speaks enough (it can't be done with 5.1)
Quote:
Note: This method requires the use of a LADSPA plugin which might be CPU intensive during playback. In addition, this was made with stereophonic sound (e.g. headphones) in mind.


I'm using your config with disabled ladspa and I'm happy with it for now, I'll stay with it, it's not that bad :D

I appreciate your help but I think it's best to forget about LADSPA in this scenario, I think I will :D

Well, this thing is a bug on the alsa and LADSPA integration. If you want to report: https://alsa-project.org/wiki/Bug_Tracking

On https://wiki.archlinux.org/index.php/Talk:Advanced_Linux_Sound_Architecture we have:
Code:
linear:             0.01s user 0.04s system 0% cpu 8.138 total

samplerate:         0.38s user 0.01s system 4% cpu 8.147 total
speexrate:          0.24s user 0.01s system 2% cpu 8.137 total

samplerate_medium:  0.60s user 0.01s system 7% cpu 8.149 total
speexrate_medium:   0.32s user 0.06s system 4% cpu 8.143 total

samplerate_best:    1.36s user 0.01s system 16% cpu 8.204 total
speexrate_best:     0.79s user 0.01s system 9% cpu 8.166 total

So you can try the "speexrate_best" with just a little more cpu.

EDIT: And if you want improve even more, then you can change the "rate" that the mixing is working form 48000 (48kHz) to 96000 (96kHz).
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 10:51 pm    Post subject: Reply with quote

The only thing that annoys me is that it works in pulseaudio, but whatever...

Good tips, I'll do that for sure and see the impact (if there is any noticeable) , that Arch wiki says medium is fine, quality is not that visible with best but cpu impact is, something like that.
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 11:00 pm    Post subject: Reply with quote

kajzer wrote:
The only thing that annoys me is that it works in pulseaudio, but whatever...

Good tips, I'll do that for sure and see the impact (if there is any noticeable) , that Arch wiki says medium is fine, quality is not that visible with best but cpu impact is, something like that.

Yep! You can get more changing to 96 kHz and 32bit (instead of the 16bit).
Code:
rate 96000
format S32_LE

Take a look at: https://lastique.github.io/src_test/
_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 11:13 pm    Post subject: Reply with quote

I tried, well , speexrate_best is cpu intensive and I can't notice much difference, went back to medium.

On the other hand, format32_LE and 96000 seems to be better indeed.

I modified your conifg and placed those in this section, removed from other places other instances.

pcm.onboard_card {
type hw
card 2

format S32_LE
rate 96000
}
Back to top
View user's profile Send private message
ff11
l33t
l33t


Joined: 10 Mar 2014
Posts: 664

PostPosted: Wed Mar 11, 2020 11:17 pm    Post subject: Reply with quote

kajzer wrote:
I tried, well , speexrate_best is cpu intensive and I can't notice much difference, went back to medium.

On the other hand, format32_LE and 96000 seems to be better indeed.

I modified your conifg and placed those in this section, removed from other places other instances.

pcm.onboard_card {
type hw
card 2

format S32_LE
rate 96000
}


Good! You can always test using (while playing something):
Code:
$ cat /proc/asound/card0/pcm0p/sub0/hw_params

_________________
| Proverbs 26:12 |
| There is more hope for a fool than for a wise man that are wise in his own eyes. |
* AlphaGo - The Movie - Full Documentary "I want to apologize for being so powerless" - Lee
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Wed Mar 11, 2020 11:24 pm    Post subject: Reply with quote

ff11 wrote:

Good! You can always test using (while playing something):
Code:
$ cat /proc/asound/card0/pcm0p/sub0/hw_params


Very nice tip , thanks!

Code:
$ cat /proc/asound/card2/pcm0p/sub0/hw_params                                                                                                                                                                           
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 6
rate: 96000 (96000/1)
period_size: 1024
buffer_size: 8192
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
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
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