Line in alsa linux

loopback/listen to Line In, ALSA/Pulseaudio

I have 2 computers, and one set of headphones. When I used Windows on my desktop PC I could simply select Listen to and it would pipe the Line In input to the default output device. I don’t see a way to do that on Arch Linux. I looked at alsamixer, but found it too difficult to use. I tried using pactl module-loopback, but it looped my microphone, probably as it was set as the default in GNOME audio settings and/or pavucontrol Pavucontrol allowed me to mess with the source of module-loopback, but it only allowed «Analog Stereo Duplex» or «Ellesmere HDMI Audio» as options. I want to use my microphone for calls, but also have the line in jack be played back.

1 Answer 1

You can use the pactl command (a part of the PulseAudio system) to handle this.

 pactl list short sources pactl list short sinks 

This will give you a list of all your input and output devices. Look for your Line In device in the sources list and your speakers (or whatever output device you’re using) in the sinks list.

pactl load-module module-loopback source= sink=

If you want to stop the audio routing, you can unload the loopback module with the following command:

pactl unload-module module-loopback 

It will unload everything by the way, if you have multiple loopback gotta specify the index for it.

Here an example of my system and my devices:

pactl load-module module-loopback source=alsa_input.pci-0000_2f_00.4.3.analog-stereo.6 sink=alsa_output.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.iec958-stereo 

Источник

Recording sound using ALSA from Line IN

I’ve developed a small application that records sound using ALSA driver on an embedded system.
Now I have a problem selecting the device that I want to record from MIC/Line IN .
The application is set to start at system start up but my default recording device is set to MIC. For my app to work I have to go to amixer and set the recording device from MIC to Line IN and then start my app. Do you guys know a way to do this change from the app or amixer command that will change this recording device and I can put it in a script an run it at start up. Has I said this app is running on a embedded system and I need a way to conf the system before my app starts. EDIT1:
here is my amixer output:

root@freescale ~$ amixer Simple mixer control 'Headphone',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 127 Front Left: 103 [81%] Front Right: 103 [81%] Simple mixer control 'Playback',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 192 Front Left: 192 [100%] Front Right: 192 [100%] Simple mixer control 'Capture',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 15 Front Left: Capture 15 [100%] Front Right: Capture 15 [100%] Simple mixer control 'Capture Vol Reduction',0 Capabilities: enum Items: 'No Change' 'Reduced by 6dB' Item0: 'No Change' Simple mixer control 'ADC Mux',0 Capabilities: enum Items: 'MIC_IN' 'LINE_IN' Item0: 'MIC_IN' Simple mixer control 'DAC Mux',0 Capabilities: enum Items: 'DAC' 'LINE_IN' Item0: 'DAC' Simple mixer control 'MIC GAIN',0 Capabilities: enum Items: '0dB' '20dB' '30dB' '40dB' Item0: '0dB' 

2 Answers 2

I finally did it. I’m using amixer with «cset» command to do it.

Читайте также:  Astra linux freeipa client

«-c 0» is the first sound card
«numid=7» is the recording device that is active.
«1» is the second intput . in my case 0-MIC 1-LINEIN

Gets all the controls with their numids ex:

 amixer info Card default 'mxsevk'/'mxs-evk (SGTL5000)' Mixer name : '' Components : '' Controls : 7 Simple ctrls : 7 root@freescale ~$ amixer contents numid=5,iface=MIXER,name='Headphone Volume' ; type=INTEGER,access=rw---,values=2,min=0,max=127,step=0 : values=103,103 numid=7,iface=MIXER,name='ADC Mux' ; type=ENUMERATED,access=rw---,values=1,items=2 ; Item #0 'MIC_IN' ; Item #1 'LINE_IN' : values=1 numid=3,iface=MIXER,name='Capture Vol Reduction' ; type=ENUMERATED,access=rw---,values=1,items=2 ; Item #0 'No Change' ; Item #1 'Reduced by 6dB' : values=0 numid=2,iface=MIXER,name='Capture Volume' ; type=INTEGER,access=rw---,values=2,min=0,max=15,step=0 : values=15,15 numid=4,iface=MIXER,name='Playback Volume' ; type=INTEGER,access=rw---,values=2,min=0,max=192,step=0 : values=192,192 numid=6,iface=MIXER,name='DAC Mux' ; type=ENUMERATED,access=rw---,values=1,items=2 ; Item #0 'DAC' ; Item #1 'LINE_IN' : values=0 numid=1,iface=MIXER,name='MIC GAIN' ; type=ENUMERATED,access=rw---,values=1,items=4 ; Item #0 '0dB' ; Item #1 '20dB' ; Item #2 '30dB' ; Item #3 '40dB' : values=0 

Источник

Trying to hear audio coming from LINE IN using ALSA on Debian

I have a netbook with Debian sid, command line only, using it for a server. I am trying to configure it so that the speakers play back what is going in through the netbook’s line in audio port. I can not find a simple way to do that. As far as I know, I am using ALSA for all audio, no jack and no pulse audio. I use alsamixer to manage audio levels, but I can not find a ‘capture’ mode in the PLAYBACK settings to turn on. Card: HDA Intel
Chip: Realtek ID 268 Note: All other audio seems to work. Line in does record (although just can’t figure out how to route it live to speakers) and speakers do work themselves. Tested by doing arecord then aplay. Here is my ‘aplay -L’ output:

null Discard all samples (playback) or generate zero samples (capture) default:CARD=Intel HDA Intel, ID 268 Analog Default Audio Device sysdefault:CARD=Intel HDA Intel, ID 268 Analog Default Audio Device front:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog Front speakers surround40:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog 4.0 Surround output to Front and Rear speakers surround41:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=Intel,DEV=0 HDA Intel, ID 268 Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers 

Источник

Читайте также:  Захват pmkid kali linux

Get the audio from Line-in to output to the speaker

which computer vendor is it (e.g. Dell / Asus / Toshiba)? and which model (e.g. Dell XPS / Asus ZenBook / Toshiba Satellite)?

4 Answers 4

Try use the pulse audio: module-loopback, this module loops all incoming audio back through your outputs ,that isn’t enabled in Ubuntu by default.

# Manually start the module-loopback. pactl load-module module-loopback # Configure your system to load module-loopback on startup. # This places load-module module-loopback at the end of # the /etc/pulse/default.pa pulseaudio configuration file. sudo sh -c ' echo "load-module module-loopback" >> /etc/pulse/default.pa ' 

the «counter-spell» is pactl unload-module module-loopback #and counter-spell to stop loading module-loopback on system startup is sudo sh -c ‘sed -i «/load-module module-loopback/d» /etc/pulse/default.pa’

Thx, it seems so simple. I have in the meanwhile checked myself and it must be quite similar this pactl unload-module so the module name would not work in this case, which is counterintuitive. pactl list modules can yield the necessary . Thanks for responding.

hmm, I did this, and my audio out become from music to a weird buzzing with slowly decreasing pitch o.o

modification to xranby’s answer:

I was having a problem with latency where there was quite a noticeable amount of lag between my button-press and the «immediate» sound.

This fixes that: pactl load-module module-loopback latency_msec=1

In the end I entered into «alsamixer» and rised the level of the Line-in, which was at 0 and it worked (in Ubuntu 10.13)

I tried to do this using xranby’s answer, and I found it quite confusing and time-consuming to figure out, for several reasons.

The loopback module is designed so that by default, it doesn’t take input from the mic. This is meant so that you won’t get feedback. However, my mics are USB mics, and therefore they’re not automatically excluded. For this reason, it’s necessary to use source=. when loading the loopback module.

Читайте также:  Awus036h kali linux drivers

If you don’t successfully shut off the mics as inputs to the loopback, then it’s also possible to get confused because you think everything is working, but actually it’s not the line-in that’s working, it’s input going through the air from your stereo speakers to your mics.

To figure out which source you need, do «pacmd list-sources | grep name:» (note the colon at the end). On my system, the first two on the list were my USB mics, while the fourth was «alsa_input.pci-0000_00_1b.0.analog-stereo» and the third was like that but with «.monitor» on the end of the name. This told me that the source I wanted was number 4.

So to start up the loopback:

pactl load-module module-loopback source=4 
pactl unload-module module-loopback 

If you want to make these settings permanent, see xranby’s answer.

There turned out to be three different volume controls that I had to find and set appropriately. On my hardware, I had a volume knob on my computer’s speakers/headphones. Also, there are two different volume controls in pavucontrol. There’s one under the input devices tab, and once you start up the loopback module there will also be a separate control in the playback tab saying something like Built-in Audio Analog Stereo; Port: Line in. If any one of these three is all the way down, then you get nothing. If either of the software ones is too high, you can get distortion.

Источник

Оцените статью
Adblock
detector