You are not logged in.

#1 2010-05-22 16:45:30

yossarianuk
Member
Registered: 2007-05-02
Posts: 101

Record soundcard output ? No mix options on my HDA card..

Hi.

I am not able to record my soundcard output, in any desktop environment - I have never been able to on this hardware ..

I am missing the mix option to record sound.

For example - in KDE mixer I have the following options for input source
- Mic
- Front Mic
- Line
- CD

= none of these record soundcard.

As an example I am trying to record in Audacity - It doesn't matter what option I choose as the recording device - all I get is nothing or static.
The options I have are
- Default
- spdif
- HDA Nvidia :ACL888 Analog (hw0,0)
- HDA Nvidia :ACL888 Digital (hw0,1)
- HDA Nvidia :ACL888 Analog (hw0,2)

I am just trying to record my soundcard's output, not mic / line in - I have muted mic and linein - same.

I did post this on the kde forum and was suggested to use Jaclk.

Is there another way to do it - I have also been mentioned snd-aloop but that module does not exist...

Cheers for any suggestions

Offline

#2 2010-05-22 19:52:46

MadCat_X
Member
Registered: 2009-10-08
Posts: 157

Re: Record soundcard output ? No mix options on my HDA card..

I had the same problem with my ALC272 (a HDA chip too). You can always use a sound server like PulseAudio or use ossv4 instead of ALSA, but I prefer to keep it clean and use ALSA only (ossv4 segfault for me btw). I have a custom .asoundrc file (see below) in my home dir which makes ALSA dump any audio input to file. There are few drawbacks this solution has. First is the need to restart ALSA whenever you want to switch the recording on or off. Second is that only one "segment" is recorded and this "segment" gets overwritten when another is being recorded. Example: you enable recording and play an MP3 in some player. Raw sound data are being saved to disk. The MP3 ends and there is no other sound playing - recording stops. Now when any other sound is played, the recorded MP3 is overwritten and the last played sound takes its place. This overwriting can be sort of prevented by renaming the recorded data as soon as you finish recording or stopping ALSA. Recording can be disabled by renaming the custom .asoundrc and restarting ALSA.

pcm.!default {                                                                                                                     
    type plug                                                                                                                      
    slave {                                                                                                                        
        pcm rate48000Hz # Direct default output to the below converter                                                             
    }                                                                                                                              
}                                                                                                                                  
pcm.rate48000Hz {                                                                                                                  
    type rate                                                                                                                      
    slave {                                                                                                                        
        pcm writeFile # Direct to the plugin which will write to a file                                                            
        format S16_LE                                                                                                              
    #    channels 2                                                                                                                
        rate 48000                                                                                                                 
    }                                                                                                                              
    #route_policy copy                                                                                                             
}

pcm.writeFile {
    type file
    slave {
        pcm card0 # Now write to the actual sound card
    }
    file "/home/madcat/aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw"
    format "raw"
}

pcm.card0 {
    type hw
    card 0
}

ctl.card0 {
    type hw
    card 0
}

EDIT: Beaten the WR in amount of typos per post...

Last edited by MadCat_X (2010-05-22 19:56:11)

Offline

#3 2010-05-26 18:30:51

yossarianuk
Member
Registered: 2007-05-02
Posts: 101

Re: Record soundcard output ? No mix options on my HDA card..

Thank you MadCat_X, that is an awesome reply !

It is a bit of an inelegant solution, but it works I have tried to set up jack but ended having absolutely no sound at all....

It slightly annoys me that my brand new PC has these issues, but my old 1.7G P4 desktops on-board sound has the ability 'out the box'

Cheers!

Offline

#4 2010-05-27 03:25:56

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: Record soundcard output ? No mix options on my HDA card..

What about using snd-aloop kernel module?

You need to compile it from the source because its is not in the official arch kernel. So download the source from alsa site and run

./configure --with-cards=loopback
make

The module is located in  modules/snd-aloop.ko copy it to '/lib/modules/$(uname -r)/kernel/sound/drivers/'. now load the drive (I think you need to run depmod -a before).

Now you have a 2 loopback devices hw:Loopback,0 and hw:Loopback,1. Anything you output to hw:Loopback,0 go to the corresponding hw:Loopback,1 as input.

Now to use this we set a .asoundrc

# output device
pcm.loopout {
  type dmix
  ipc_key 328211
  slave.pcm "hw:Loopback,0,0"
}

# input device
pcm.loopin {
  type dsnoop
  ipc_key 686592
  slave.pcm "hw:Loopback,1,0"
}

# duplex plug device
pcm.loop {
  type plug
  slave {
    pcm {
      type asym
      playback.pcm "loopout"
      capture.pcm "loopin"
    }
  }
}

the ipc_key is any random unique number you like. Now play anything to loop device. You can record using loop device.

For example

mplayer -ao alsa:device=loop file.mp3

And open another term and do a

arecord -f cd -D loop|aplay

I hope this help!

EDIT:
If you like to record and hear the output you can add this to asoundrc

pcm.mout {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}

pcm.mdev {
        type multi

        slaves.a.pcm "hw:Loopback,0,0"
        slaves.a.channels 2
        slaves.b.pcm "hw:0,0"
        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
}

And use mout as output (aplay -D mout) and record from loop (arecord -D loop). But you cant use dmix with multi, so with this setup only one app can output sound.

Why you dont use mout as playback.pcm in asym? Well I dont know, its dont work for me (plugins dont mix so well).

Thingol from alsa IRC channel (he explained me how to output to multiples devices) really advocated the use of pulseaudio and give me this link http://www.outflux.net/blog/archives/20 … ulseaudio/

Looks like that using alsa only, synchronization is not maintained.

Last edited by kazuo (2010-05-27 04:38:10)

Offline

#5 2010-06-01 12:00:36

yossarianuk
Member
Registered: 2007-05-02
Posts: 101

Re: Record soundcard output ? No mix options on my HDA card..

Hi kazuo.

Thank you for your advice.

I take it I should be using the alsa-driver source? Or do I need alsa-lib too ?

Also could I not alter an existing arch package (with abs for example) and add '--with-cards=loopback'  to the PKGBUILD ?

Thanks for everybody for their advice, the level of response on here is simply amazing..

Last edited by yossarianuk (2010-06-01 12:00:54)

Offline

#6 2010-06-01 12:18:50

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: Record soundcard output ? No mix options on my HDA card..

Only the driver is needed.

The alsa drivers on Arch Linux are compiled from the kernel source, so you need to edit the kernel PKGBUILD (but its not only a --with-cards)

Offline

#7 2010-06-01 12:28:14

yossarianuk
Member
Registered: 2007-05-02
Posts: 101

Re: Record soundcard output ? No mix options on my HDA card..

Thanks kazuo.

I just compiled from the driver source and now have working module.

The only hastle I guess is giving to redo it after a new kernel is installed.

Just out of interest why is it not included by default ? (it isn't on Ubuntu or pclinuxos either)

Thanks for your assistance man !

P.S - your advice should be on the wiki.

Last edited by yossarianuk (2010-06-01 12:30:35)

Offline

#8 2010-08-23 23:24:14

simongmzlj
Member
From: Canada
Registered: 2008-11-06
Posts: 135

Re: Record soundcard output ? No mix options on my HDA card..

Hey, I know this thread is kinda dead, but I found this very helpful and wanted to share this: http://aur.archlinux.org/packages.php?ID=40180.

Offline

#9 2010-12-31 20:46:06

louipc
Member
Registered: 2006-10-09
Posts: 85

Re: Record soundcard output ? No mix options on my HDA card..

I don't really understand the anti-old thread brigade. Would it be better to start a new duplicate thread about the same exact issue? I think not. Anyways, I just ran into this issue with my new laptop. So I'm glad to find this thread. I will try out these solutions soon. Thanks. big_smile

Offline

#10 2013-08-07 11:38:12

Jindur
Member
Registered: 2011-09-29
Posts: 184

Re: Record soundcard output ? No mix options on my HDA card..

Ok, so I installed snd-aloop, modprobed it, installed that .asoundrc, everything works so far.

Now how do I forward the audio I hear when I'm playing a game + playing music in mp3 player to this loopback device, so that I can

1) hear game sounds + my music from mp3 player in my headphones as usual and
2) it gets fed into the loopback device (from where ffmpeg will capture it)?

(I think that was the question of the op too.)

--- umm, since this thread seems a bit older, I actually created a new posting now at
https://bbs.archlinux.org/viewtopic.php … 7#p1308977

I won't delete this posting though or an admin on the Arch Way Hitler Edition (tm) will just ban me once again although I did not violate ANY forum rules (I checked this last time to make sure!) and didn't even bother to respond to my complaint about it, so keeping this as it is here, please go to my new thread, thanks!

Last edited by Jindur (2013-08-07 11:59:17)

Offline

#11 2013-08-07 14:53:16

Xyne
Moderator/TU
Registered: 2008-08-03
Posts: 5,632
Website

Re: Record soundcard output ? No mix options on my HDA card..

Jindur wrote:

--- umm, since this thread seems a bit older, I actually created a new posting now at
https://bbs.archlinux.org/viewtopic.php … 7#p1308977

I won't delete this posting though or an admin on the Arch Way Hitler Edition (tm) will just ban me once again although I did not violate ANY forum rules (I checked this last time to make sure!) and didn't even bother to respond to my complaint about it, so keeping this as it is here, please go to my new thread, thanks!

Necro-bumping by accident is not a big deal. It's easy to miss the date when a thread pops up in a search. You noticed this and you correctly edited your post to link to a new thread. That was good.

The fact that you then went to to unnecessarily insult the forum staff (with Godwin's law, no less) is just not acceptable. We have been very patient with you despite numerous warnings. It seems that your previous band has not taught you anything, so this time it will be a month. After that, it will likely be permanent.

Offline

Board footer

Powered by FluxBB