Audio Switching

From BATC Wiki
Jump to: navigation, search

The capability to transmit or stream sound from a microphone connected through a cheap USB dongle, a video capture device (EasyCap) or a Webcam was ofurther developed in software 201803061. Note that sound is only added to MPEG-2 transmissions. The capability to add sound to H264 transmissions is only available when a Logitech C920 Webcam is being used.

On the touchscreen or on the Console (System Setup, Audio Input menu) there are 6 options: auto, USB mic, video (EasyCap), Webcam, Bleeps and no_audio. The switching behaviour is as follows:

1. If "no_audio" is selected, no audio stream is generated.

2. If "bleeps" is selected, mono bleeps are transmitted.

3. If no EasyCap, USB Sound Dongle or Webcam is detected (see below), no audio channel is generated, unless the option for "bleeps" has been requested. In which case "bleeps" are generated.

4. In "auto" mode:

If more than one sound source is detected, the video source is checked. If video from the Pi Cam is selected, mono audio from the USB Sound Dongle is transmitted. If the EasyCap is selected for video, stereo audio from the EasyCap is transmitted. If a webcam is selected, audio from the webcam is transmitted

If only a USB Sound Dongle is detected, mono audio from the USB Sound Dongle is transmitted.

If only an EasyCap is detected, stereo audio from the EasyCap is transmitted.

5. In "mic" mode, if a USB Sound Dongle is detected, mono audio from the USB Sound Dongle is transmitted. If no USB Sound Dongle is detected, but an EasyCap is, stereo audio from the EasyCap is transmitted.

6. In "video" mode, if an EasyCap is detected, stereo audio from the EasyCap is transmitted. If no EasyCap is detected, but a USB Sound Dongle is, mono audio from the USB Sound Dongle is transmitted.

Identification of Audio Devices

Audio devices are identified as being Microphone Dongles with a single audio channel or EasyCaps with stereo audio channels by analysing the response to the Linux command "arecord -l".

If the response includes any of the following strings (case sensitive) , the device is classed as a USB Microphone Dongle:

USB Audio Device
USB AUDIO
Head
Sound Device
Webcam C170
Webcam C525
U0x46d0x825

This means that the following audio devices are supported by this logic:

Device [USB Audio Device], device 0: USB Audio [USB Audio]
AUDIO [USB AUDIO], device 0: USB Audio [USB Audio]
Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
C170 [Webcam C170], device 0: USB Audio [USB Audio]
C525 [HD Webcam C525], device 0: USB Audio [USB Audio]
U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]  - Logitech C270

Note that the Samson C01UPro USB Microphone is not supported. It requires relatively complex Linux driver software that is beyond the scope of this project.

If the response includes any of the following strings, the device is classed as a video capture device:

usbtv
U0x534d0x21
DVC90
Cx231xxAudio
STK1160
U0xeb1a0x2861
AV TO USB
Grabby
Webcam C920

This takes account of the following devices:

usbtv [usbtv], device 0: USBTV Audio [USBTV Audio Input]
U0x534d0x21 [USB Device 0x534d:0x21], device 0: USB Audio [USB Audio]
DVC90 [DVC90], device 0: USB Audio [USB Audio]
Cx231xxAudio [Cx231xx Audio], device 0: Cx231xx Audio [Conexant cx231xx Capture]
STK1160 [STK1160], device 0: USB Audio [USB Audio]
U0xeb1a0x2861 [USB Device 0xeb1a:0x2861], device 0: USB Audio [USB Audio ]
USB20 [AV TO USB2.0], device 0: USB Audio [USB Audio]
Grabby (TerraTec Grabby), device 0: USB Audio (USB Audio)
HD Pro Webcam C920 (usb-3f980000.usb-1.4)

Note that inclusion in this list does not mean that the Portsdown will work with the device for video capture. All it means is that it can capture audio from it; in particular, the DVC90 and Cx231xxAudio devices will not work for video capture (yet).

If you want an entry added to either of these lists (which each appear twice between lines 70 and 100 in the file scripts/a.sh) please post full details on the BATC Forum.