how to use amixer to change playback channel map in Linux - audio

I have an Ice Lake laptop. The A/V system has several HDMI 2.0 outputs and each appears to have 8-channel audio. However, I can't figure out how to get multi-channel to play through these outputs. amixer shows playback channel maps for these outputs, for example
numid=41,iface=PCM,name='Playback Channel Map',device=5
; type=INTEGER,access=rw---R--,values=8,min=0,max=36,step=0
: values=0,0,0,0,0,0,0,0
| container
| chmap-variable=FL,FR
It appears that it should be possible to change these channel maps, but I can't find out how to do so. Running amixer -c0 cset numid=41 1,1,1,1,1,1,1,1 doesn't change anything. Does anyone know what syntax amixer wants to changes these channel maps?

Related

ALSA Card for Respeaker 4-Mic Setup

During the installation, we are supposed to check the sound card by pressing ‘arecord -L’ to obtain a certain output like shown below,
pi#raspberrypi:~ $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
playback
ac108
sysdefault:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Hardware device with all software conversions
usbstream:CARD=seeed4micvoicec
seeed-4mic-voicecard
USB Stream Output
usbstream:CARD=ALSA
bcm2835 ALSA
USB Stream Output
However, the output that I have received is as shown below,
Screenshot of Output
It basically shows that I don’t have the ALSA soundcard, and I cant move on to the sound localization process. Please show how can I move forward, thanks!

Building a software parrot repeater with Linux CLI audio-processing tools?

I have an audio coming from a radio transceiver on my sound card's microphone input. What i want to make is a simple software-based parrot repeater using Linux CLI tools like the sox suite and arecord. For it to work, i think a flow similar to the following must take place:
The audio that comes on the microphone subdevice is getting recorded in a buffer (file or RAM-based)
When the buffer stops filling (audio stopped), start playing it's content on the audio output device (it is connected to the radio's microphone input)
When it's over, empty the buffer and start expecting step 1 to occur again
I'm looking for an elegant way to implement the logic behind step 2. Is there a CLI tool that i can use for that, so i can pipe the microphone audio taken with arecord to it and play the output of the buffer with sox?
Try looking at this. I did this on a raspberry pi a little while ago, only I made a voice changer.
https://www.instructables.com/Halloween-Voice-Changer-With-Raspberry-Pi/
Basically, play "|rec --buffer 2048 -d" takes recorded sound and puts it in a buffer that is passed in 4096 bit (byte?) chunks to play. -d stands for duration, and if left blank defaults to 0, and will run until killed. If you want to play with the options, there is some helpful info in the links.
Good luck with your project!

How I can play any audiofile to any connected usb audio card?

I have PC with linux and connected there 3 usb audio interfaces. Each audio interface has one stereo output.
I have 6 speakers connected by 2 to each stereo output.
My goal is have ability to play any sound on any card on any channel.
For example I need to play sound of beating glass on first audiocard on left channel and play some sound of nature on second audiocard on right channel.
I have looked into mpg123 but didn't found in man nothing what I want.
My prefer to have a player with next params:
./example_player --audio_device=1 --channel=left glass.mp3
If no any player with my requires please advice any python library for easy make my "example_player".
Thank you!
I have found the answer.
My prefer is mplayer. It has enought functionality for my goal.
This command:
$ mplayer -af channels=2:2:0:0:1:0 song1.mp3
will play sound on left speaker.
2 (the count of output channels) : 2 (the count of moving signal) : 0:0 (left channel route to left channel) 1:0 (right channel route to left channel)
To route sound to any audiocard you should use this command:
$ mplayer -ao alsa:device=hw=0.0 song2.mp3
To see all available alsa devices use this command:
$ aplay -l
Here you'll see all available alsa devices. The first digit in 'hw' param is the card number and second digit is the device number.
Of course you can combine these both commands:
$ mplayer -af channels=2:2:0:0:1:0 -ao alsa:device=hw=0.0 song3.mp3
Also I found more useful solution using PulseAudio!
Use thic command to list all available audiodevices with PulseAudio:
$ pactl list cards short
For example you need to output the sound to 0 card (all cards numeric begins with 0):
$ mplayer -ao --pulse::0 file.mp3
And that's works as well.

Is it possible to capture audio from an ASIO device with ffmpeg?

We have a setup with a Windows 7 machine where we installed Dante Virtual Soundcard and start that soundcard with ASIO capabilities. The soundcard will receive audio over the network from a Tesira server. We want to capture the audio to files (highly preferring each channel to a separate file). The files will be played back on a later moment. There will likely be 6 channels or more.
In the same setup we use ffmpeg to capture some video which is working fine, with Direct Show. So for audio we wanted to use the same setup, since ffmpeg is able to record audio as well. However, there seems to be no option to select the ASIO devices which the virtual soundcard probably creates. So the question is what command line to use for ffmpeg, or what to install? Or which other program can record ASIO from command line?
I already tried installing:
Asio4all (actually wrong way around)
sox (don't know why actually)
HiFi Cable Asio Bridge (from VB-audio, not enough channels even with donate version)
Voicemeeter (from VB-Audio, not enough channels and actually mixes down)
O Deus Asio link, this might be an interesting option but it did not let me configure any route, any suggestions?
One thing I noticed is that the virtual soundcard can also be set to use WDM. Then I can see the devices with ffmpeg -list_devices true -f dshow -i duymmy, but recording does not yield any result, I have to ctrl-c to make it stop instead of q, and the file is zero bytes. Supposedly this is because the data over the network is all ASIO formatted and the Tesira Server cannot send "WDM data". FFmpeg stops at selecting the capture pin for audio only
EDIT:
I ran ffmpeg with high verbosity and when selecting the WDM soundcard it stops at Selecting pin Capture on audio only. Also when requesting the options it gives the same line for 22 times: min ch=1 bits=8 rate= 11025 max ch=2 bits=16 rate= 44100
You might use Voicemeeter instead of HIFI-Cable / ASIO-Bridge. Voicemeeter is a virtual audio device mixer able to connect everything together, any audio point, in any interface and any app together (including ASIO DAW)... Download & User Manual on www.voicemeeter.com
To answer my own question: it is not possible to capture sound from an ASIO device with ffmpeg. Maybe I will write the code for it if I need it...
I could however solve my issues by separating the two streams of audio data we have (AVB and Dante). These where on the same switch and maybe it is a bug in the firmware, maybe misconfiguration.
Thanks for your help!
How do I get the output from an ASIO device to IceCast2 or FFMpeg?
Duplicate?
And if not, Place the output for ffmpeg -f dshow -i "audio=your_device_name_in_dshow" -list_options

Setting channel volume in ALSA

My app plays raw PCM audio data through various channels using ALSA. I'm allocating a new audio channel by using snd_pcm_open(), then setting the PCM format via the snd_pcm_hw_params_xxx() calls and finally feeding raw PCM audio data to ALSA by using the snd_pcm_writei() API.
This is all working fine so far but I haven't found any way to tell ALSA to reduce the volume of a sound channel allocated in the way outlined above. Of course, I could just manually apply volume scaling to the PCM data before sending it to ALSA via snd_pcm_writei() but is there really no way to have ALSA do this on its own?
ALSA has no such function.
You have to do the scaling yourself, or use a sound server like PulseAudio.
You can via amixer:
amixer cset name='Headphone Playback Volume' 98%,100%
To get the name value - check alsamixer, appending 'Playback Volume' to each.
And via alsamixer:
Keyboard z is left channel decrease.
q is left increase.
and
c is right decrease.
e is right increase

Resources