-
Notifications
You must be signed in to change notification settings - Fork 58
Audio Settings
- Audio Devices
- Sending
- Receiving
- Codecs
- Other examples
- Using echo-cancelling microphones (Chat 150)
- Multi-channel setup
- JACK transport
- Echo cancellation
- Notes
Currently you can choose following capture/playback devices:
- portaudio - use system sound via PortAudio (multiplatform)
- jack - use JACK Audio Connection Kit
- alsa - use Advanced Linux Sound Architecture (ALSA)
- coreaudio - use Core Audio (macOS)
- wasapi - use WASAPI (Windows)
Further 3 devices are used to capture/playback audio with device currently used for video. Therefore, -d <device> option always needs to be present and indicates which HW device to use sound from.
- embedded - grab/play audio embedded in SDI
- analog - grab/play analog audio connected to capture card
- AESEBU - grab/play AES/EBU (digital) audio connected to capture card
- send video and analog audio (XLR-connected) from Decklink
uv -t decklink:0:6:UYVY -s analog <destIP>
- Send system’s default audio, without any video stream
uv -s portaudio 192.0.43.20 # sender
- the same, but with ALSA, Coreaudio or JACK
uv -s alsa 192.0.43.20 # use default ALSA device
uv -s coreaudio 192.0.43.20 # use default Coreaudio device
uv -s jack:system:capture 192.0.43.20 # send sound captured with JACK
- send selected audio source (CoreAudio)
uv -t dvs:37:UYVY -s coreaudio:1
to get list of available audio devices, issue:
uv -s help
You can specify number of captured (and sent) audio channels:
uv -s alsa --audio-capture-format channels=2 # send stereo
- receive sound and embed it into SDI (DeckLink and DELTACAST)
uv -d decklink -r embedded
uv -d deltacast -r embedded
- playback video and play audio through AES/EBU (note that, however, Decklinks always play audio through all available outputs - analog, AES/EBU and embedded into SDI):
uv -d decklink -r AESEBU
- receive only audio with PortAudio (Windows/OS X/Linux)
uv -r portaudio # use default system sound device
- the same with CoreAudio/ALSA/JACK
uv -r coreaudio # use default CoreAudio device (OS X)
uv -r alsa # use ALSA (Linux)
uv -r jack:system:playback # playback received audio with JACK Audio Connection Kit
- receive video with deltacast card, audio with ALSA PulseAudio plugin
uv -d deltacast -r alsa:pulse
- you can also use Decklink as a playback driver. The difference compared to “-r embedded” is that here is DeckLink used solely for audio playback (useful when you want to use Decklink’s XLR outputs). Please note that in this setup you cannot use the same decklink device for video playback. If you want so, use “-d decklink -r embedded” option.
uv -r decklink:0
to get list of available playback devices issue uv -r help
Other options used when playing received audio are:
- –audio-channel-map - can remap audio channels, mix/split them etc. For more info issue ‘uv –audio-channel-map help’
- –audio-scale - scale audio signal, either by a constant value or adaptively, pleas see ‘uv –audio-scale help’ for details
UltraGrid sends uncompressed PCM by default. If this is not desired,
another codec can be specified with --audio-codec
parameter:
uv -s testcard --audio-codec OPUS ug.example.com
You can get list of available codecs with uv --audio-codec help
. This
parameter has also additional options like changing sample rate of the
audio.
- send and receive only audio, use Portaudio sound device nr. 3 for
both input and output (you can list available devices with
-r/-s help
paramaters);
uv -r portaudio:3 -s portaudio:3 <dest_addr>
The echo-cancelling must be used as both sender and receiver and this must be passed to ultragrid via the -s/-r parameters.
uv -s alsa:plughw:CARD=C150 -r alsa:plughw:CARD=C150 <dest_addr>
This should be sufficient for most setups. Echo cancelling microphones are always one channel, therefore is here specified a plughw device, which enables all SW conversions (eg. from 2 channels to 1).
Alternatively, you may want to use one channel directly, by specifying this explicitly:
uv -s alsa:hw:CARD=C150 -r alsa:hw:CARD=C150 --audio-capture-format channels=1 --audio-channel-map 0:0 --audio-scale none <dest_addr>
–audio-capture-format channels=1 tells that we want to capture and send only one channel (default behavior).
–audio-channel-map is here to instruct that we need to receive only one channel (received channel 0 is mapped to played channel 0). Other channels are dropped. This is for situation when we receive more than one channel, otherwise it can be omitted.
–audio-scale none tells that we do not want to scale received audio channel. The automatic scaling is enabled when we use –audio-channel-map option. You should remove this option if you know you will receive 2 channels and you want to mix them together - this would be –audio-channel-map 0:0,1:0.
To capture more than one channel, use option:
--audio-capture-format channels=N
with requested number of input
channels
By default, receiver receives all captured channels, if this is not desired behavior, you can select channels that you want to play with following option:
--audio-channel-map
Syntax is following:
source1_chan:dest1_chan[,source2_chan:dest2_chan...]
eg.:
--audio-channel-map 4:0,5:1
Plays only channel 4 and 5 (indexed from zero) as channel 0 and 1. All other received channels are dropped.
You can JACK as a source on a sender and sink on a receiver. This is especially useful in conjunction with JackTrip.
Note: For JACK as a normal audio driver (output through JACK at receiver, input at sender side) please refer to audio section and use JACK in a similar way to other audio drivers like CoreAudio or ALSA.
Usage:
-
sender (DVS, JACK source) – this commands take sound from SDI/portaudio and send it via JACK server and specified port
uv -t dvs:37:UYVY -s embedded -j po=system:playback uv -t dvs:37:UYVY -s portaudio -j po # if port name ommited, UG chooses from what is offered by JACK server
-
receiver (Quicktime, JACK sink) - this command takes sound capture via JACK (eg. netjack) and passes it to quicktime driver
uv -d quicktime:65561 -r embedded -j pi[=system:caputre]
Important: Echo cancellation is currently broken in directly in UltraGrid therefore following examples won’t work!
Basic usage:
uv --echo-cancellation ...
Toggles on acoustic echo cancellation. You need to have only one channel in both sides to use this. To set egress audio channels you can use –audio-capture-format channels=1 option.
If you are receiving more than one channel, you can mix them with –audio-channel-map. Typical usage is the following - receiving stereo audio, sending one channel echo-cancelled audio:
uv --echo-cancellation --audio-capture-format channels=1 --audio-channel-map 0:0,1:0 -r alsa -s alsa
Echo cancellation works through Pulseaduio on Linux. To enable it in Pulseaudio use:
pacmd load-module module-echo-cancel
You can test if the module is present with pacmd
and entering
list-modules
. Echo cancelling can be enabled by default editing
/etc/pulse/default.pa
and adding
### Enable Echo/Noise-Cancelation
load-module module-echo-cancel
Once the echo cancellation is enabled you can run UltraGrid as:
./uv -r alsa:pulse -s alsa:pulse ...
and select the appropriate echo cancelled input and output devices for
recording and playback using pavucontrol
.
If you experience problems eg. with wrong sample format or channel sound, try to use a plugdev ALSA device, which has all SW conversions enabled
If you have any technical or non-technical question or suggestion please feel free to contact us at