Skip to main content

Snorbyte TTS client with streaming and playback

Project description

snorbyte

Snorbyte TTS client with streaming, PCM ring-buffer playback, and ffplay/ffmpeg required for compressed live playback/encoding.

DEPENDENCIES (VERY IMPORTANT)

We require both ffplay and ffmpeg to be available on your system PATH. We also use sounddevice for PCM playback, which depends on PortAudio (OS package) on Linux.

Windows

Option A (winget)

winget install -e --id Gyan.FFmpeg

Option B (chocolatey)

choco install ffmpeg

Verify

After install, ensure the ffmpeg/bin folder is on your PATH.

ffmpeg -version
ffplay -version

Linux

Debian/Ubuntu

sudo apt-get update
sudo apt-get install -y ffmpeg libportaudio2

Verify

ffmpeg -version
ffplay -version

INSTALL PACKAGE

pip install snorbyte

API CALL USAGE

from snorbyte import Snorbyte

def consume_stream(b: bytes):
    # b is raw stream bytes (PCM aligned for fmt="pcm", raw MP3/WAV chunks otherwise)
    print(f"chunk {len(b)} bytes")

client = Snorbyte(
    api_key="<YOUR-API-KEY>",
)

path, data, info = client.tts(
    utterance="दोस्त, दिल टूटा है तो क्या, रात भर प्लेलिस्ट रोएगी पर सुबह धूप आएगी, खुद से वादा कर—जो गया, जाने दे, जो आएगा, मुस्कुराकर अपनाएंगे।",
    speaker_id=233,
    speaker_name="",
    tone="Encouraging",
    speed=1.00,
    chunk_size=8192,
    denoise=True,
    stream=True,
    stream_bytes_callback=consume_stream,
    fmt="pcm",               # "mp3" | "wav" | "pcm"
    play=True,
    save_to="out.mp3",      # optional; auto-name if omitted
    temperature=0.0,
    top_p=1.0,
    repetition_penalty=1.05,
)

print("Saved to:", path)
print("Bytes in memory:", len(data) if data else None)
print("Info (ms):", info["latency_ms"])

WEBSOCKET CALL USAGE

from temp.snorbyte import Snorbyte   # e.g., "from snorbyte import Snorbyte"
import time

API_KEY    = "<YOUR-API-KEY>"


def consume_stream(b: bytes):
    print(f"chunk {len(b)} bytes")


def main():
    client = Snorbyte(
        api_key=API_KEY,
        ipv4_only=True,
    )

    client.ws_connect()

    try:
        path1, info1 = client.ws_send(
            utterance="ग्रुप प्रोजेक्ट में हर कोई अपना हिस्सा टाइम पर दे दे तो प्रेज़ेंटेशन शाइन करेगी, वरना आख़िरी रात को हड़बड़ी में स्लाइड्स बिगड़ जाती हैं, तो चलो एक शेड्यूल फिक्स करते हैं और डेडलाइन से पहले एक ड्राई-रन करके फीडबैक फ्रीज़ कर देते हैं।",
            speaker_id=228,
            tone="Encouraging",
            speed=1.00,
            denoise=False,
            fmt="pcm",               
            save_to="demo_out_1.wav",
            stream_bytes_callback=consume_stream,
            play=True,               
        )
        print("[WS] saved:", path1)
        print("[WS] metrics:", info1.get("latency_ms", {}))

        path1, info1 = client.ws_send(
            utterance="ठीक है, फिर शाम को रिपोर्ट भेज दूँगा; आप बस मेट्रिक्स देख लेना और अपना फीडबैक बता देना।",
            speaker_id=49,
            tone="",                 # or "Encouraging"/"Consoling" for Charan/Shreeja only
            speed=1.00,
            denoise=True,
            fmt="pcm",               
            save_to="demo_out_1.mp3",
            stream_bytes_callback=consume_stream,
            play=True,               
            timeout=30,
        )
        print("[WS] saved:", path1)
        print("[WS] metrics:", info1.get("latency_ms", {}))

        path1, info1 = client.ws_send(
            utterance="देख भाई, धीरे-धीरे कर ना, फालतू टेंशन मत ले, जो काम समय से हो सकता है, उसे जबरदस्ती धक्का देकर बिगाड़ने से अच्छा है, आराम से कर, रोज़ थोड़ा-थोड़ा बढ़ेगा।",
            speaker_id=67,
            tone="",                 # or "Encouraging"/"Consoling" for Charan/Shreeja only
            speed=1.00,
            denoise=False,
            fmt="pcm",               
            save_to="demo_out_1.wav",
            stream_bytes_callback=consume_stream,
            play=False,               
            timeout=30,
        )
        print("[WS] saved:", path1)
        print("[WS] metrics:", info1.get("latency_ms", {}))



    finally:
        time.sleep(2)
        client.ws_close()
        client.close()
        print("[WS] closed")

if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snorbyte-0.1.11.tar.gz (262.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

snorbyte-0.1.11-cp313-cp313-win_amd64.whl (426.4 kB view details)

Uploaded CPython 3.13Windows x86-64

snorbyte-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

snorbyte-0.1.11-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

snorbyte-0.1.11-cp313-cp313-macosx_10_13_universal2.whl (644.1 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

snorbyte-0.1.11-cp312-cp312-win_amd64.whl (425.8 kB view details)

Uploaded CPython 3.12Windows x86-64

snorbyte-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

snorbyte-0.1.11-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

snorbyte-0.1.11-cp312-cp312-macosx_10_13_universal2.whl (646.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

snorbyte-0.1.11-cp311-cp311-win_amd64.whl (431.0 kB view details)

Uploaded CPython 3.11Windows x86-64

snorbyte-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

snorbyte-0.1.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

snorbyte-0.1.11-cp311-cp311-macosx_10_9_universal2.whl (652.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

snorbyte-0.1.11-cp310-cp310-win_amd64.whl (429.5 kB view details)

Uploaded CPython 3.10Windows x86-64

snorbyte-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

snorbyte-0.1.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

snorbyte-0.1.11-cp310-cp310-macosx_10_9_universal2.whl (655.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

snorbyte-0.1.11-cp39-cp39-win_amd64.whl (430.0 kB view details)

Uploaded CPython 3.9Windows x86-64

snorbyte-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

snorbyte-0.1.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

snorbyte-0.1.11-cp39-cp39-macosx_10_9_universal2.whl (657.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file snorbyte-0.1.11.tar.gz.

File metadata

  • Download URL: snorbyte-0.1.11.tar.gz
  • Upload date:
  • Size: 262.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11.tar.gz
Algorithm Hash digest
SHA256 feb8f8b20ba4e36f79dba5adbdc0fff0af31c8c411a8246319cfd1525e0d3884
MD5 d97fbe1371fe83d3ce429e6aeb992323
BLAKE2b-256 3feda27c72a7c5470a0345ca60fc93b66f073a4216229d75e82b44be42107fe3

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: snorbyte-0.1.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 426.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0a7d1dff0d986b04aa7fd462a86271a12c189f8320115882df4bb118e9b0e578
MD5 ce85353413e51c23af60b2444f30bd37
BLAKE2b-256 053017dbb3959fc2d8561f504576c89b0f9af09762fedd0633a05311cc8c9541

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f6a6804ea566396c7203bf0b67e47facb009d9212f5e760461048a1f390ee20
MD5 3004b8735968ecc0c00a86078a202f94
BLAKE2b-256 eafc9d98c9a70367dc33db31282bae6342c231c3195b26d06473cba5de77feca

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 088988244e03acb2b6f03570437cae5362ae80a7dd560aba1436b007a43f8799
MD5 6aa48ef36a07da93d0fb161da6b1b41f
BLAKE2b-256 c01635b965abe7bb94d63ad47ee7c1891739ff13c2a08f050a8eb4cab9f02045

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ea2f40fa4c1afd0230b8c980e8cb534498f3eac7fbb105b43999ead6a2fa76a6
MD5 da9113384ebffe1edf33a3d4efd9d05d
BLAKE2b-256 6b22ddd9ee47918db4e90cfda77398c4416aa6f106221569122ab6c2cc77301a

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: snorbyte-0.1.11-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 425.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3e82aada8d18b5cb518706fcc53a6c9a5c6019dc8ad3fc1fbd0d9c539c7ae47d
MD5 bf66219c83a54d68ae218a83ab131fef
BLAKE2b-256 39884060c414078a7481e917106e094fc99c94faef64277db9ccfe57395cae65

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cbc7a0982053d86e2737b5b5a660479515c0f95898435b5da76a55b82d962476
MD5 770219760206c37e7f6863642106b1ed
BLAKE2b-256 93ce8d24e7b72ab45f305a2517280774166a5565de0a305e71809dcbea517552

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 24f96cd5435aa5a848bc7d9e95fb7359b0e522ac88f3fe25267518aacbc301a7
MD5 a8fa5848015284f60903fdc3b3e41914
BLAKE2b-256 76896b2d6a08c08d029fd24e1d2964b3e9b220185d77c4f639bc5697bc38d258

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ad6ef7ca320eb48e7228ca4f979827e661ba812d225bb93c3a40aa598a3f0738
MD5 2e03b56e8b13bcf7bd531477672f4e2f
BLAKE2b-256 2c10092485ca5510746030dfb683f1bfecfbd66fccd8dd6b5a54ba7e43708310

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: snorbyte-0.1.11-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 431.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0cd382b2815347100aac4f5fb2b18f1bebe2fde2dfdb3447b88d8a483251531a
MD5 fa926216cdce5ca1de91a08386e64551
BLAKE2b-256 f4c8d597674395a6490f0f4c8661691b7bc477e8c19df672ea12aa276f45eb3c

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 068a9b98f99fd3d243a896dfc609fcccbc8801224b674478a0986097438577a8
MD5 8ed51a7103e5f37524a0eecf3135fec4
BLAKE2b-256 7ebca4bad2fb96cf9b1aa10168e01a4b47d5b80ca44a1538a1b0884accb72b95

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 81332e9029d3309b03728e3392426dce3a9a9fe11b1f688de941296d085fe506
MD5 220c027bd17912cbd767f71973661e50
BLAKE2b-256 5ded83845654cf6e9396eec83140b7429bdb6a7678899c32a58ab23f7913f6b6

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b08f88cbee43851987bf0118078f7a1a1bbc8ed503f34eca7dd0faf7cfbfcc99
MD5 9bbfc4383c06ea933e5b04d4582a7983
BLAKE2b-256 49a8b034d87357b246aa4a0dcdff8688a5b206d8899a5977e6fe19e7930abfc3

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: snorbyte-0.1.11-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 429.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 40d50b463dd3b1d41a7af971996db87a6b8a54863b98d9ff47eab42d82b5769e
MD5 e8e8ac03d96277bc67ef12acab8a5104
BLAKE2b-256 6e931f85a0dc49de628332e5e823d980adb7445ef9373c4d0f83ae93bfec70bc

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55571462dd9e798226b8d9d7ee663135357e9cca36d8a4615ae0c1567bc79a7a
MD5 739ee47c814dc35fe3c7961f52ce8f44
BLAKE2b-256 cb181f64ffc14bf33fd61978f62ce91e29e419324716ce61461f3138ad976763

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5c354ac8816b09b9a03a460966e9c14b3544f5c29315b13cdbb1ee56bc82d49e
MD5 d4aba5f482e5d997445d67d717aea4c3
BLAKE2b-256 aadc7a48df863130727252f968f1b41efa99feb8eef30b6439bfaabc05592163

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5efb0d2e5fb5e565e8cbe60c4fe5d1861b8eb04c4821be25cf2dd4a69869f4af
MD5 1c571dc273589634e7623f1a8a771920
BLAKE2b-256 bbf6213eb7fc21227a378434e81cff0521e7acb3b7c6e58528011e4f6a7f0fa9

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: snorbyte-0.1.11-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 430.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for snorbyte-0.1.11-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 695d3f91bb0b948f21a8547e42f0392c093625d7ee29791ecdc3c900b42397d3
MD5 e6921fda2ff0c89d1fa69138cd640861
BLAKE2b-256 8a78e62bc86e018b39ea374eb08729df707b427773e39f3d83abdd13a1d7f7e6

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a8d9044633bb4e20a13473058e0a744597468833bfc08dafd07c7c562064ffa
MD5 ed8ff389542dc67f6a807158c727188b
BLAKE2b-256 d4eeced29924db718a316d802299be5ac79b50b4ee3f85c1679a64d01b9c6bec

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7c73021cdd0b768d8d749cbf5e0eea00c9e00e5d8b935a2b628bbe61b18aa6d5
MD5 cce5ac9e8abb97f93b8dedbc93778872
BLAKE2b-256 4644737796f72c6c27a6b719609f85cb537ad56eac76e10bc4dab5f374d5ba00

See more details on using hashes here.

File details

Details for the file snorbyte-0.1.11-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for snorbyte-0.1.11-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 669574177cd28cc9ab91ba66782ad5a45cc1ef14e9ab51b8ec716947038a568c
MD5 7fd53f42d5e303889fc3e2d8b1fcda2b
BLAKE2b-256 c65949f54b0afdc72140f157c190a326609efa5b9bb035401d19f55069c019d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page