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.
Related
I've been playing around with ffmpeg for sending audio to an endpoint and listening to it. This is the command I've used.
ffmpeg -f pulse -i 1 -f pulse 1
Where the two "1's" are the indices of my mic and output device as reported by pacmd list-sources and pacmd list-sinks.
This command allows me to speak into my microphone and hear it back in my speakers, but there's latency. Other parameters like -tune zerolatency and stuff don't help.
I know that low latency audio streaming is possible on Linux since apps like Discord work on it. Why is there latency in my command, and what protocol, program, or library should I use to transmit an audio stream?
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!
I'm doing voiceover and since Sony Vegas does not support sidechaining, I render voiceover into voices.wav and then use sidechain_compress filter, as per ffmpeg documentation:
ffmpeg -y -i background.m4a -i voices.wav -filter_complex \
"[1:a]asplit=2[sc][mix];\
[0:a][sc]sidechaincompress=threshold=0.015:ratio=2:level_sc=0.8:release=500:attack=1[compr];\
[compr][mix]amerge" sidechain_1.wav
voices.wav is a stereo audio file, as well as background.m4a. But here's how the result file looks like when loaded into Sony Vegas:
This shows that in channels 1/2 I get the compressed background, while in channel 3 and 4 I get two mono tracks that somehow differ (probably, that's the original voices input and somewhat altered voices input, both in mono). UPD: I don't want to further process resulting tracks in Sony Vegas, I'd prefer ffmpeg to be the last step in my production process. The screenshot above is for illustration purposes only.
Is the background gets sidechain compressed with only left or right channel of voices? If so, how to change that to make it compressed by both channels (some voices are panned into left or right, so there might be actual difference in compressed result)
What are those channels 3 and 4? Why are they mono?
How do I get single 1/2 stereo track in the output wav file instead of this weird 4 channels in 3 tracks? (I've looked at pan complex filter, but didn't figure out how to set it up in my case).
amerge adds the channels of the inputs. amix uses the channel count of the input with the most channels. So, switch to amix.
ffmpeg -y -i background.m4a -i voices.wav -filter_complex \
"[1:a]asplit=2[sc][mix];\
[0:a][sc]sidechaincompress=threshold=0.015:ratio=2:level_sc=0.8:release=500:attack=1[compr];\
[compr][mix]amix" sidechain_1.wav
I have phone call recordings which are dual channel with each channel supposed to carry only the voice of one speaker. However, they have some echo of the other channel. Any ways to remove this, in ffmpeg or sox or otherwise.
I am working on a Ubuntu 16.04 environment and using mplayer to play back the audio. A link to a 10s clip of the audio may be found here: https://drive.google.com/file/d/14xrchHvcluhDNGutYfCPpQi3cas_4Ogi/view?usp=sharing
I also looked at (almost) the same question: Silence out quiet periods in audio file with ffmpeg
Not very sure I could follow the answer/comment though.
Thanks!
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