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.12.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.12-cp313-cp313-win_amd64.whl (426.4 kB view details)

Uploaded CPython 3.13Windows x86-64

snorbyte-0.1.12-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.12-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.12-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.12-cp312-cp312-win_amd64.whl (425.9 kB view details)

Uploaded CPython 3.12Windows x86-64

snorbyte-0.1.12-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.12-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.12-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.12-cp311-cp311-win_amd64.whl (431.0 kB view details)

Uploaded CPython 3.11Windows x86-64

snorbyte-0.1.12-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.12-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.12-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.12-cp310-cp310-win_amd64.whl (429.5 kB view details)

Uploaded CPython 3.10Windows x86-64

snorbyte-0.1.12-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.12-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.12-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.12-cp39-cp39-win_amd64.whl (430.0 kB view details)

Uploaded CPython 3.9Windows x86-64

snorbyte-0.1.12-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.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: snorbyte-0.1.12.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.12.tar.gz
Algorithm Hash digest
SHA256 d2dafec38af28b455313ab6047e45dcdc4ab43d6ed5844349e0be57d2553594d
MD5 16c149fbfd53c46fe56d531185c2e19c
BLAKE2b-256 e8e40b8e234d752940bb2b67a0651a59f1406a7c9df1ce945642aceaf1ef27ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.12-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.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 09ce473e55cbbf0e055c9428caff0653712927acbeea608c9fcb829a851d90bd
MD5 4f1bcefa9216cad4f70166e6913e3b57
BLAKE2b-256 9a32128d5bb2c12a7681dd08448524d1eb4ba0b33e2e06e0951c1e89b29927cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 040d90b8b9c4dd4f2f6428e1b033896cf09b2913fa07ce199219332ce46090e1
MD5 e1a302012abbf9e98631932f1de1a11e
BLAKE2b-256 9dbaedaf15907d6e71230215b774e17a0c4043611e12f0fd57015d960e494830

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 dcf81d21913b933349f3cbb7f8f6488a3f575874159e65a8098562ba4f314e2a
MD5 89b4143469ac51d4c6aca532abe8a0e2
BLAKE2b-256 91d7befa12043aa2cb398c5cf02dba3ef46cb40928a0a50eb6baf5383130a5fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 834e0867a185bbc0a1bc625009e7c1fb15e5b2e943aac5cea4327054309c823c
MD5 0e6161933a20d6e5f0907e054093b330
BLAKE2b-256 382fa6499eca6a2ff5e714e3382ba89d681fe3f2eb83f52358b18b3578754e87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 425.9 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.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0befbf0268db2c18ea7c6a13df531bdd82e05c2eba9af7fa9de4dbb99ce998ef
MD5 2f1e4ffc5fe9796c43e0065beecb9ba9
BLAKE2b-256 d00de3b2dff196d742073851a5d4b7cd593f98ee538e256844081a19910cdc78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d427978340072ba6b31522d47b54127167a390208dd830ee87450ba855dbed94
MD5 17b00ed1c7f69ff1b4a663e7edaa2d7c
BLAKE2b-256 65816b7f182b6f60c84aec6b7daa0667723f421343bdd1f04ae4767446cbe50e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e851d53cb3bf7ede51bbca7624f11dc165d61d945e9a11af47d410d828cbcd0e
MD5 7c33941e22c5a8bcb0d8e5ea833f859a
BLAKE2b-256 da2755a7ad9dcd11382d39ac5e782bec5b7fd5a96a92c6d11c4bb2fc0eb1d23d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 d07a91e34fcd875570391b73a584a337ff6e2a60e10e4837cff34c9c54e85e9a
MD5 7a912b72a91eba314a12cb36c1e85eee
BLAKE2b-256 7528d639a4745eba35a8cc25299dfce963798fa263d91b830db9932f9e443f2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.12-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.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42deb24c085795f3cbdeec71bc7b80307505cce54e3aebf7cde0ada1e6e87668
MD5 f22af21fbf27f9360e5163dba0be8311
BLAKE2b-256 eb87be11707202e76d667199fa7c8e52514b1e1443432955731514b7831917bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30afe4f1e3922fa5e5d997446d50f04c4af40c8015e7eaeff7521c19c6845e4b
MD5 92260a5fd106572d0a05b5df9b855cdd
BLAKE2b-256 2fb2fb3b154a07d75e413471fec46a6ad5c1b6dcf034a47e129f019cab0e542d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 29f204df8db107c6584de8df3e976193b44a4987974c3c747c0ac1ab7e3995a6
MD5 8dbe10b560ea2bc4f96dfc2ffdffebbd
BLAKE2b-256 8ee100937e06d743a052bb4c8135462c95af795a31210df0bc0f3a214e17582c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5aabc4cb82cd3360cfa3c82a839a52cd190067f4248e9adc01dc3d81ba7ccdd1
MD5 5ae5772e9201a14f2ad42ac82e95ae95
BLAKE2b-256 41bfb9fb8626f0b5a31b58b2b1ded917af30da55eb5b754c5fbb32d9026e229e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.12-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.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9fd081ffd7b627e4aa43c5273d0646e1ff934eb3dbc838a24222b84df901fb7c
MD5 22df8dce96eaaa84198f4229e13b74c9
BLAKE2b-256 f11e1524d8db67afc974f684d9a608188c4d579b9ff5939a74c13a80617ea3f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4d60b45a7ec9119f4cf0dcc18b11e5ec631a20068565a8086d179b2be49dbe4
MD5 7725de6f6b2980bdef32465453fe4195
BLAKE2b-256 a30f70ac71db40deceab2c00fcef9cb39c879372696157e06fba861e98772241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0baf2708c19622932c4a94fc07a33dc6f9c8f86c9fc2bf6cb405a33d9e791ecb
MD5 a5ad44414646ea5347132851864b664f
BLAKE2b-256 5f3d055e39c649cd8d416fc99cf4286d359e65816310cc84cbedcb196375c055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0b5c53297fa291184245ce0b2dfdc5b73aabe49833c2b81b3baed64aa762d63e
MD5 82e17f904f34b57cc384bdc1a59e5527
BLAKE2b-256 df6e159a41bf7b168669f56040293c204e9a4740b3d510fd44db06bcdcb8637e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.12-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.12-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f23b9445cbb393279b80438c3aea27b41d5ad842a2662fd781cc9effff05c6ff
MD5 125655ddf2cd88057510313cc213c49a
BLAKE2b-256 fda2ef7c95ef28331e76b96632adb5807e1b8ab830091ba81837acf17cead6f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd0059db3bb0bb8b1f9eb1a016155555286f57b3ed679097ab0fb8b98cd5477e
MD5 4bc7029f2c6c69b6bc311ee9aab2e449
BLAKE2b-256 944eef58c0407c3a5d8bfc1a5f8a8c4300a41c6bc262b7c4251b07e3c774a884

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a815524458c41ad23a60b68d36af32bac06d493b76e23e5505a515148edfa01c
MD5 2ce963cc8e2b4bff7b63108caf7eb94e
BLAKE2b-256 b5e0075ab8c53ea074a1f56e83c4f8ac73a4f4b0dc8012d6efae1bdbe4bf8703

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.12-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5b18506aefa7fdfaa7c3ad2725976cbb1e6a25bea3f1d538384087ff90bb88f3
MD5 d7299cc5dbeaeb74d03fb4715d83d1d7
BLAKE2b-256 6d10fe1ea47f351339d65a563012110c7e234b08710d91e9cfbd2aa871bfe525

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