snd-aloop, jack, etc

Post fully complete "how to" guides and tutorials here. This is a great place to get feedback on stuff you might put in the wiki.

Moderators: MattKingUSA, khz

User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: snd-aloop, jack, etc

Post by Capoeira »

Capoeira wrote:
Capoeira wrote: no, it's set up to 41k, i've seen it today, forgot the comand.
What does the resample is DMIX: http://alsa.opensrc.org/index.php/Dmix# ... quality.3F
how can I merge that in? I tried:

Code: Select all

# playback PCM device: using loopback subdevice 0,0
pcm.amix {
  type dmix
  ipc_key 219345
  slave {
  pcm "hw:Loopback,0,0"
  period_size 1024
        buffer_size 2048
        rate 44100
                     }
}
but still:

Code: Select all

[studio@myhost ~]$ alsa_in -j cloop -dcloop
WARNING: Rate doesn't match (requested 44100Hz, get 48000Hz)
WARNING: buffer size does not match: (requested 2048, got 12000)
WARNING: period size does not match: (requested 1024, got 6000)
selected sample format: 16bit
delay = 12416
and

Code: Select all

[studio@myhost música clássica]$ mplayer -ao alsa Ravel\ -\ Bolero\ \&\ other\ Orchestral\ Works\ \ 02\ -\ La\ Valse.mp3 
MPlayer SVN-r32025-4.5.1 (C) 2000-2010 MPlayer Team
159 audio & 347 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Ravel - Bolero & other Orchestral Works  02 - La Valse.mp3.
Audio only file format detected.
Clip info:
 Title: La Valse                      
 Artist: Ravel                         
 Album: Bolero & other Orchestral Work
 Year:     
 Comment:                             
 Track: 2
 Genre: Unknown
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   9.2 (09.2) of 745.0 (12:25.0)  0.9% 

EDIT:

Code: Select all

note that I used -q 1 as an option to alsa_in/out. This has to do with the resampling quality. At 2.3ms latency, 96kHz s.r. on a 2 x 2.4 GHz dual core CPU system and using Jack2, I get a low CPU usage (1-2%) and the quality is reasonable. If you push it to 2, 3 or 4, the CPU will increase quite a lot at small buffering / latency
what would be 100% quality? -q 1 I get obvious distorcion. -q 2 I can't here any diference
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: snd-aloop, jack, etc

Post by Capoeira »

Capoeira wrote:
Capoeira wrote: no, it's set up to 41k, i've seen it today, forgot the comand.
What does the resample is DMIX: http://alsa.opensrc.org/index.php/Dmix# ... quality.3F
how can I merge that in? I tried:
solved that way:

Code: Select all

# playback PCM device: using loopback subdevice 0,0
pcm.amix {
  type dmix
  ipc_key 219345
  slave {
  pcm "hw:Loopback,0,0"
  period_size 1024
        buffer_size 2048
        rate 44100
                     }
}

# capture PCM device: using loopback subdevice 0,1
pcm.asnoop {
  type dsnoop
  ipc_key 219346
  slave.pcm "hw:Loopback,0,1"
}

# duplex device combining our PCM devices defined above
pcm.aduplex {
  type asym
  playback.pcm "amix"
  capture.pcm "asnoop"
}

# ------------------------------------------------------
# for jack alsa_in and alsa_out: looped-back signal at other ends
pcm.ploop {
  type plug
  slave.pcm "hw:Loopback,1,1"
}

pcm.cloop {
  type dsnoop
  ipc_key 219348
  slave {
  pcm "hw:Loopback,1,0"
  period_size 1024
        buffer_size 2048
        rate 44100
                     }
}

# ------------------------------------------------------
# default device

  pcm.!default {
  type plug
  slave.pcm "aduplex"
  hint {
         show on
         description "default_show"
    }
}
added "show on" to default device, too; to let it show up in all apps (only this way it shows up for phonon-Xine for example)
thorgal
Established Member
Posts: 739
Joined: Mon Apr 07, 2008 6:04 pm

Re: snd-aloop, jack, etc

Post by thorgal »

hey! great stuff, so all is working for you now :)

You could add a comment in the ALSA howto page :)
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: snd-aloop, jack, etc

Post by Capoeira »

thorgal wrote: so all is working for you now :)
like I said, I still have a problem with java-sound. I have to close all alsa-apps before running REW, to here an output and I can't manage to get a signal on input

rest is working verry good ;-)
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: snd-aloop, jack, etc

Post by Capoeira »

damn, loopback device is so buggy(?)

had to change PC..

same distro, same packages, only 32bits now.

same home directory, same config-files

loopback-device is there
but jack only recognizes loopback "1", "1.0" and "1.1"
script is started but no ports in jack, no error message

damn
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: snd-aloop, jack, etc

Post by Capoeira »

Archers: liquorix kernel 2.6.37 from AUR now has the module included
I guess it will be also when install the liquorix kernel in other distros
User avatar
funkmuscle
Established Member
Posts: 2801
Joined: Mon Jun 02, 2008 2:30 pm
Has thanked: 129 times
Been thanked: 31 times

Re: snd-aloop, jack, etc

Post by funkmuscle »

that's great news but I can't use it with the crappy snd-hda-intel card I got... the only kernel and can run audio is the RT on my laptop but my old pc, kernels 2.6.36 and 37 working amazingly with jack but it's not that powerful for my needs.. :(
Post Reply