Scream Virtual Network Sound Card

repository·master·Indexed 23 days ago

https://github.com/duncanthrax/scream

A virtual network sound card for Microsoft Windows that broadcasts audio as a PCM multicast stream over a local network. It enables low-latency audio streaming to receivers on Unix/Linux, Windows, or embedded devices (STM32F429, ESP32). The project includes a Windows driver, a C# receiver (ScreamReader), a Unix receiver supporting PulseAudio, JACK, and ALSA, and a Wireshark dissector for protocol analysis. It also supports IVSHMEM for Windows guest to Linux host audio in QEMU/KVM environments.

Tokens
2.9K
Snippets
9
Records
21
Agent score
78%

What's inside Scream

  1. Understand the Scream Network Protocol

    master

    Scream transfers raw PCM audio in UDP frames.

    Packet Structure:

    • Max Payload Size: 1157 bytes.
    • Header (5 bytes):
      • Byte 1 (Sampling Rate): Bit 7 specifies the base rate (0 for 48kHz, 1 for 44.1kHz). Other bits specify the multiplier.
      • Byte 2 (Sampling Width): Bit depth in bits.
      • Byte 3 (Channels): Number of channels being transferred.
      • Bytes 4-5 (Channel Mask): A DWORD dwChannelMask from the Microsoft WAVEFORMATEXTENSIBLE structure, mapping channels to speaker positions.
    • Payload (1152 bytes): Raw PCM data.

    Receiver Implementation Note: Receivers should open a multicast listen socket and implement minimal buffering (approximately 4 times the UDP payload size) to account for jitter.

  2. Understand the Scream UDP packet format

    master

    The Scream driver emits UDP datagrams consisting of a 5-byte header followed by interleaved, little-endian PCM audio data. The default multicast destination is 239.255.77.77:4010.

    Header Structure

    OffsetSizeDescription
    01Sample rate marker
    11Bits per sample (16, 24, or 32)
    21Number of interleaved channels (1–8)
    32Channel map (little-endian Windows speaker mask)
    5NPCM payload (interleaved, little-endian samples)

    Sample Rate Marker Logic

    The first byte encodes the base sampling family and a multiplier via the lower 7 bits:

    • Bit 7 unset: Base rate is 48 kHz. Multipliers: 1 → 48 kHz, 2 → 96 kHz, 4 → 192 kHz, etc.
    • Bit 7 set: Base rate is 44.1 kHz. Multipliers: 1 → 44.1 kHz, 2 → 88.2 kHz, 4 → 176.4 kHz, etc.

    Channel Map

    The 2-byte mask follows the Windows speaker mask layout (KS digital). Examples include:

    • 0x0001: Front Left
    • 0x0002: Front Right
    • 0x0003: Stereo (Front Left + Front Right)
    • 0x060F: 5.1 surround (Front L/R/C, Low Frequency, Back L/R)
  3. Install the Scream Wireshark dissector

    master

    To decode Scream traffic in Wireshark, install the scream.lua plugin into your Wireshark plugin directory and restart the application.

    Plugin Directory Locations

    • Windows: %APPDATA%\Wireshark\plugins
    • macOS: ~/Library/Application Support/Wireshark/Plug-ins
    • Linux: ~/.local/lib/wireshark/plugins/<version>

    After restarting, packets should be labeled SCREAM with decoded header information.

  4. Configure Scream Receivers

    master

    Scream publishes audio as a PCM multicast stream on the local network.

    Default Stream Details:

    • Multicast Address: 239.255.77.77
    • Default Port: 4010 (UDP)

    Available Receivers:

    • Windows: ScreamReader (included in the installer package). Note: It does not support positional mapping for multichannel setups.
    • Unix/Linux: Various receivers support PulseAudio, JACK, or ALSA (refer to the Receivers/unix folder in the repository).
    • Embedded/3rd-party: cornrow (for embedded devices), STM32F429 (ARM), and ESP32 receivers.

    Firewall Requirement: If your receiver system has a firewall, you must open UDP port 4010 (or your custom port).

  5. Use Scream in Network mode (Multicast/Unicast)

    master

    Scream can receive audio over the network using either Multicast or Unicast modes.

    • Multicast mode (Default): Run scream without arguments to start in multicast mode using the default audio output.
    • Unicast mode: Use the -u option.
    • Specifying an interface: If your machine has multiple network interfaces, use the -i option to specify the interface that should receive the Scream packets.

    Example for specifying an interface:

    scream -i eth0
  6. Install Scream on Windows 11

    master

    The standard installer is not compatible with Windows 11. You must use pnputil and put Windows into Test Mode.

    Steps:

    1. Disable Secure Boot in BIOS.
    2. Enable Test Mode: Open an administrator command prompt and run: bcdedit /set testsigning on Reboot your machine. You should see "Test Mode" in the bottom-right corner of your wallpaper.
    3. Install the driver: Open an administrator command prompt, navigate to <scream folder>/Install/driver/<architecture>/, and run: pnputil /add-driver .\Scream.inf /install
    4. Turn Off Test Signing: Open an administrator command prompt and run: bcdedit /set testsigning off Restart your computer. Ensure "Test Mode" is no longer visible. The Scream audio device should now appear in your audio settings.
    bcdedit /set testsigning on
    pnputil /add-driver .\Scream.inf /install
    bcdedit /set testsigning off
  7. Install Scream on Windows 10

    master

    Download the signed builds from the GitHub releases page. The installer is a batch file that must be run with administrator rights.

    If your Windows 10 installation has tightened kernel driver signing rules (common in newer installations), the driver may fail to install. You can use one of these workarounds:

    1. Disable Secure Boot in your BIOS.
    2. Set a special registry value to allow cross-signed drivers:
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CI\Policy]
    "UpgradedSystem"=dword:00000001
  8. Use Scream in libpcap (sniffer) mode

    master

    The libpcap mode allows the Scream client to act as a sniffer. This is useful if UDP multicast/unicast traffic is visible in tools like wireshark or tcpdump but is not being delivered to the user-space Scream client. Use the -P flag and specify the interface with -i.

    Example:

    scream -P -i macvtap0
  9. Compile the Scream Unix receiver

    master

    The Scream receiver for Unix can be compiled using CMake. The build process automatically detects Pulseaudio or ALSA headers. If Pulseaudio is found, it becomes the default output; otherwise, ALSA is used. If neither is found, the receiver defaults to raw/stdout output.

    To compile, create a build directory, run CMake, and then make:

    $ mkdir build && cd build
    $ cmake ..
    $ make