This commit is contained in:
Maxim Devaev
2025-01-20 04:18:53 +02:00
parent ddb61abb23
commit e2c6db72f5
11 changed files with 301 additions and 215 deletions
+90 -56
View File
@@ -1,91 +1,125 @@
# PiKVM V3+ Audio
Official PiKVM V3, V4 Mini and V4 Plus devices have an exclusive audio transmission feature.
Audio is transmitted over an HDMI cable from the target host to PiKVM as if it were a regular monitor
with speakers, and then from PiKVM to a web browser in [WebRTC video mode](webrtc.md).
This brings the user experience of working with a remote host even closer to the local one.
Official [PiKVM V3](v3.md) and [PiKVM V4](v4.md) devices have an exclusive audio transmission feature,
including **two-way** communication with microphone directly in the browser.
The incoming stream is captured from the target host via HDMI, the outgoing stream is transmitted to an emulated USB microphone.
This brings the user experience of working with voice applications on the remote host even closer to the local one.
!!! note
* This feature does not work with DIY devices, either CSI or USB video dongles.
* Audio does not work with DIY devices, either CSI or USB video dongles.
* Reverse audio transmission, that is, from the browser towards PiKVM
(for example, to emulate a microphone) is not yet supported.
* [VNC](vnc.md) does not support audio, it only works in the Web UI.
* [VNC](vnc.md) does not support audio, it only works in the Web UI in [WebRTC](webrtc.md) mode.
-----
## Preparing
## Speakers (incoming audio)
For PiKVM V4, this feature is enabled by default and no special preparations are required.
* On [PiKVM V4](v4.md), this feature is enabled by default, unless you didn't disable it [with custom EDID](edid.md).
For PiKVM V3, this feature is disabled by default for historical reasons so as not to break
old user configurations that were created before audio support was added.
* On [PiKVM V3](v3.md), this is disabled for historical reasons so as not to break old user's configurations
that was created before audio support was introduced.
??? example "Enabling audio on PiKVM V3"
??? example "Enabling audio on PiKVM V3"
1. Make sure that you have not removed the [audio jumpers (4)](v3.md#io-ports-and-jumpers)
on the V3 HAT board and have not deleted or commented the `dtoverlay=tc358743-audio`
line in `/boot/config.txt`. Return everything as it was, if you changed it.
1. Make sure that you have not removed the [audio jumpers (4)](v3.md#io-ports-and-jumpers)
on the V3 HAT board and have not deleted or commented the `dtoverlay=tc358743-audio`
line in `/boot/config.txt`. Return everything as it was, if you changed it.
2. Update OS and reboot:
2. Update OS and reboot:
{!_update_os.md!}
3. Enable the Basic Audio support in the [EDID](edid.md) in the `/etc/kvmd/tc358743-edid.hex` and reboot the device again:
```console
[root@pikvm ~]# rw
[root@pikvm ~]# kvmd-edidconf --set-audio=yes
[root@pikvm ~]# reboot
```
The target host determines whether it is possible to output audio via HDMI. Each OS does this in its own way.
In general, make sure that the audio output is HDMI in the mixer.
PiKVM supports stereo mode with any standard bits and frequencies like 32/44.1/48 kHz with 16/24 bit.
* **Mac OS** usually understands the priority of HDMI for audio output on its own,
but you can specify this explicitly in the settings.
* **Windows** requires explicit specifying of the audio output device.
* In **Linux**, everything depends on the distribution you use. In ancient times, the audio required performing
a ritual dance under the full Moon. For now, a working Pipewire or Pulseaudio most likely be enough.
Just specify HDMI as the audio sink in the mixer.
To receive audio in the PiKVM Web UI, go to the **System** menu and switch the video mode to `WebRTC`.
If everything is in order, the volume slider will appear. Set the volume to a non-zero value.
The video stream will restart and you should start hearing sounds from the target host.
<img src="menu_speakers.png" width="350" />
If the volume slider is set to zero, then PiKVM does not accept the audio stream to save traffic,
while the target host will still assume that the audio output to HDMI is available.
Besides, when the page is reloaded, the volume slider will be reset to zero.
Saving this setting is not possible due to browser limitation that do not allow web pages to play audio
immediately after opening without user activity to protect against annoying ads.
-----
## Microphone (outgoing audio)
PiKVM is able to emulate a USB microphone on the target host to transmit your speech from the browser to the host.
This feature is disabled by default for backward compatibility reasons.
{!_usb_limits.md!}
??? example "Enabling USB Microphone"
1. Microphone requires speakers support so check the previous paragraph. Also perform OS updating and reboot if you didn't:
{!_update_os.md!}
3. Add the following lines to `/etc/kvmd/janus/janus.plugin.ustreamer.jcfg` if they missing:
```
audio: {
device = "hw:0,0"
tc358743 = "/dev/kvmd-video"
}
```
4. Enable the Basic Audio support in the [EDID](edid.md) in the `/etc/kvmd/tc358743-edid.hex`:
2. Switch filesystem to RW-mode:
```console
[root@pikvm ~]# kvmd-edidconf --set-audio=yes
[root@pikvm ~]# rw
```
5. Reboot the device:
3. Add a config to `/etc/kvmd/override.yaml`:
```yaml
otg:
devices:
audio:
enabled: true
```
4. Perform reboot:
```console
[root@pikvm ~]# reboot
```
To receive and transmit audio in the PiKVM Web UI, go to the **System** menu and switch the video mode to `WebRTC`.
If everything is in order, the volume slider will appear with additional Microphone switch.
Set the volume to a non-zero value, next switch the mic switch.
Your browser will ask for permission to use the microphone, allow it.
-----
## Usage
<img src="menu_mic.png" width="350"/>
The target host determines whether it is possible to output audio via HDMI. Each OS does this in its own way.
The switch state will be saved in the browser's local settings.
The microphone signal will not be transmitted if the volume level is zero.
* Mac OS usually understands the priority of HDMI for audio output on its own,
but you can specify this explicitly in the settings.
!!! warning "USB compatibility"
* Windows requires explicit specifying of the audio output device.
This feature is very new, so we don't know how much it affects the ability to interact with the BIOS and UEFI.
* In Linux, everything depends on the distribution you use. In ancient times, audio required performing
a ritual dance on a full moon. For now, a working Pipewire or Pulseaudio most likely be enough.
Just specify HDMI as the audio sink in the mixer.
Please try this and [let us know](https://discord.gg/bpmXfz5) if you have lost the ability to access
the BIOS or boot OS from PiKVM Mass Storage after turning on the USB microphone.
In general, make sure that the audio output is output via HDMI.
PiKVM supports stereo mode with any standard bits and frequencies like 32/44.1/48 kHz with 16/24 bit.
To receive audio in the PiKVM Web UI, go to the **System** menu and switch the video mode to `H.264 / WebRTC`.
If everything is in order, the volume slider will appear. Set the volume to a non-zero value.
The video stream will restart and you should start hearing sounds from the target host.
<img src="menu.png" width="350"/>
!!! note
If the volume slider is set to zero, then PiKVM does not accept the audio stream to save traffic,
while the target host will still assume that the audio output to HDMI is available.
Besides, when the page is reloaded, the volume slider will be reset to zero.
Saving this setting is not possible due to browser limitation that do not allow web pages to play audio
immediately after opening without user activity to protect against annoying ads.
But even if this happens, don't worry. You can use [the dynamic USB device control](usb.md)
to temporarily turn off the microphone emulation.
-----