Skip to content

Microphone Server Help

cyberofficial edited this page May 7, 2024 · 1 revision

Synthalingua Remote Microphone Streaming and HLS Password Support

This update introduces two major features to Synthalingua: remote microphone streaming and support for password-protected HLS streams.

Remote Microphone Streaming

You can now stream audio from your microphone to a web server, enabling remote access for translation and transcription. This is particularly useful when:

  • Capturing audio from a different device: If your microphone is connected to another computer or device within your network, you can utilize this feature to stream the audio to the machine running Synthalingua.
  • Sharing audio with collaborators: Collaborators on different machines can access and translate/transcribe the audio stream from your microphone, facilitating remote collaboration. So lets say a user has a beefy pc, with like a 24gb gpu, using the 2gb ram option and english they can support a few people leaving enough gpu for personal use as-well.

To use remote microphone streaming:

  1. Run the remote_microphone.py script on the machine with the microphone input or virtual audio input. This script creates a local web server that streams the microphone audio as an HLS stream. You will be prompted to select the microphone and choose a server port and stream key. For instance, if the script generates the stream key "your_secret_key", the HLS playlist URL would be:

    http://localhost:8888/index.m3u8?key=your_secret_key 
    
  2. On the machine running Synthalingua, use the --stream flag with the HLS playlist URL:

    python transcribe_audio.py --stream "http://localhost:8888/index.m3u8?key=your_secret_key" --stream_translate
    

    Remember to replace "your_secret_key" with the actual stream key generated by the remote_microphone.py script.

  3. Add the --remote_hls_password_id and --remote_hls_password flags to provide the stream key ID and key and othe relevant arguments:

    python transcribe_audio.py --ram 2gb --stream_original_text --stream "http://10.0.0.100:8888/index.m3u8?key=pMt3hgV1cVQRW08L9k3VDw" --stream_language English --stream_chunks 6 --device cuda --ignorelist "X:\github\Real-Time-Translation\blacklist.txt" --portnumber 2000 --condition_on_previous_text --remote_hls_password_id "key" --remote_hls_password "pMt3hgV1cVQRW08L9k3VDw "
    

    This ensures that only authorized users with the correct stream key can access the audio stream. Which is hard coded enabled, there will be not option to disable this. Security first! This command does the following, Sets the VRAM usage to 2GB, Will show original text, Identify the input language as English so we don't need to transcribe or translate, sets the stream chunk to 6 (6 second audio recording time), using cuda (aka gpu) using a custom black list of phrases, Sets the webserver of Synthalingua to 2000 on the local machine, condition_on_previous_text will try to prevent spammed repeats of words, hls id is key, password is the password after the = sign.

HLS Stream Password Support

Synthalingua now supports HLS streams that require a password through url authentication, allowing you to access and translate/transcribe content from premium or protected sources that use hls passwords via direct url. Please remember not all HLS Password streams will not work like this, but this is still early alpha and will be improved upon later.

To use HLS stream password support also comes along the microphone server:

  1. Obtain the HLS URL and password information. This might involve inspecting network requests or utilizing browser developer tools to identify the HLS playlist URL and any required authentication parameters.

  2. Use the --stream flag with the HLS URL:

    python transcribe_audio.py --stream "https://your-protected-stream.com/playlist.m3u8" --stream_translate 
    
  3. Include the --remote_hls_password_id and --remote_hls_password flags to provide the password ID and password:

    python transcribe_audio.py --stream "https://your-protected-stream.com/playlist.m3u8" --stream_translate --remote_hls_password_id "your_id" --remote_hls_password "your_password" 
    
  4. Replace "your_id" and "your_password" with the actual values required for authentication. The specific format and values for these parameters will vary depending on the stream provider.

Important Notes:

  • The remote microphone server is also password-protected. Therefore, you still need to use the --remote_hls_password_id and --remote_hls_password flags when connecting to the microphone stream.
  • HLS password support is currently in early alpha and may not work with all streams. We are actively working to improve compatibility and reliability.
  • Ensure that ports are open if the microphone server is not within your local network.
  • The default password ID used by the remote_microphone.py script is "key".