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    = "94BuyEP6MGZCUHuE2TqZzNO0w8SLxQ3RPqcq6Qauy2JVsmeg"


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", {}))


        print("Hi")
        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.10.tar.gz (262.3 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.10-cp313-cp313-win_amd64.whl (426.5 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.12Windows x86-64

snorbyte-0.1.10-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.10-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.10-cp312-cp312-macosx_10_13_universal2.whl (646.3 kB view details)

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

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

Uploaded CPython 3.11Windows x86-64

snorbyte-0.1.10-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.10-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.10-cp311-cp311-macosx_10_9_universal2.whl (652.2 kB view details)

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

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

Uploaded CPython 3.10Windows x86-64

snorbyte-0.1.10-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.10-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.10-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.10-cp39-cp39-win_amd64.whl (430.1 kB view details)

Uploaded CPython 3.9Windows x86-64

snorbyte-0.1.10-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.10-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.10-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.10.tar.gz.

File metadata

  • Download URL: snorbyte-0.1.10.tar.gz
  • Upload date:
  • Size: 262.3 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.10.tar.gz
Algorithm Hash digest
SHA256 e2e9a6c07483577e81453cc6baef4190a6b553bdaed988576a39488b691130da
MD5 82eb7e7d77c5f922f47aa09121b63637
BLAKE2b-256 64b27d9a9a4f820a5152f8c22daeafdbbe8f396a93e1deb846b0c3a31b8afe9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.10-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 426.5 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.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ee2148122bd81bddf37e3d78362a6e55fbbd59e4e142d79940cd870cabeac410
MD5 a298bf7979f333a14571ef6c7c404d3e
BLAKE2b-256 049f037a1e015ff0f53c45ebec00348cde77926fc39be7f27a2df7dd487432dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c265a6cd8dd264745530631a63625d2dfb47f4ab55fcd867b4bbf7117535948a
MD5 460c63626b66f2cdd438f3fa1b9efb0d
BLAKE2b-256 26cde5a43ba47c15fb56a9eb7b174cbb2ff5f05c093cec72455bf01221a7f9bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 9df0fac1955128d2d6d3df2d76ddae4946a073ed49693708519fb27efbfb1d0b
MD5 7c837306bf2ee0900904f248ba35d3ad
BLAKE2b-256 e52403f87d5a0ed28cae267ebd1f0964d4ca328e3fb5d1886a398e690e4df85e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 5a9494715bc15261e0733ee0d2ab83491efddce884e7983761b486cb0ed9b50a
MD5 7d1b9e242997e12ad62d21979613bd8f
BLAKE2b-256 2ecde9467d3d74757b9cc22c23b3ce064f14b8fe87b76691d39704fbb3a76236

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.10-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.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5e75586bcb34ea2096b70f48bc660627151f13ee18e5efe4b049e34dd8597372
MD5 0a42cf3963d7dc2e59895def19b58fcf
BLAKE2b-256 12af70392156e3f7220d936814c0e4ca2216a36850657116d9152d09c1419b1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7cf73b79b762de179386549a981972390ecf9a39181241e63f00ca17d3443fad
MD5 d2aaebb8f69276bac31d8a2fb8f5a783
BLAKE2b-256 90acf31f8a86b73a3f57b9f347c2d31d270e3b37441943ef9b3edc711aec6c27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 00965c7093a36b1ff7ede738f4a7c94aaec77de26265c7515d8519c92793c8e9
MD5 26ca941dbefcdcc445ed6b115fd49589
BLAKE2b-256 cbc24955860c108fa460b760a2022e35e2b79504fa3459d91f422d3066efd7fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 045310ceacd9c1d6f013821fea02f23fa5bf5ea90cf14c402225cb44ea09bd1e
MD5 108b9c0e633dcfcf1c98befb573bebb3
BLAKE2b-256 378774e7a750842bcb6079bd816db7f388b40ea3da6108aed3a884bd5e45ac0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.10-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.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 62933f74b72b24d70eeb0e98384741448ef6c291ca9fb190fd480bc49696d770
MD5 9b099de72895b99b13237b246d60d4a6
BLAKE2b-256 8f49f81a8bb3ed73cc79c63fbb432d40db542146ceb395c639712f851e60cba9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 249b91a3db62a3df32ee5a1b385f3e5ffad5b56d55b1aae34c604f150caab2ce
MD5 31d593a8aeda2b3a29b886f55468deb4
BLAKE2b-256 254399dc65abb5ba6e20110f70b929337a1d4e22a083d33bd8a8e03720f9919f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 28047b8b4c00cfd1e2bae0c6b1ea7ced0d4e8d89e76ffc02c3fe59346e7b21e4
MD5 f2a5ad4a707407f35b7b108e9a1c8322
BLAKE2b-256 713cfb9a83a5b133aedd78c91efade24a96d2792674192f91578663620f77370

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 600ddd3f9d3cd3ab1d7fe5e51f6c97f695a6a484f855fcc118eacae3beee6dc9
MD5 cec5d89a0c83110eb79c5601dc56adbf
BLAKE2b-256 4b8fe7936a2d1497365c50c89c79e488d00bf2fd654ea44d1d9f8f6bb48352d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.10-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.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 98c77a89c34b71bb9badddcd2300d36f9ff4ed6124062ee3520b8bc3a68669d0
MD5 c09037588fba53599cb099950b12850f
BLAKE2b-256 b91a26feca5896dd453a138e004a4e5337d733ac2e376431eba8ed4fcc167a02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22e9a41585f179e0e70a3e2697acd4be0fb2e9d0f6a2423290ea937eaa1ab1b1
MD5 689f3b467079648e0957265a70c19277
BLAKE2b-256 e93d32a11e116341211a6903c13edff7f89d8800023dc38ca187282412ab3fdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 96a2216513e383e3f94cbdf79c8f3a96212ecc56abd2d8cf1bcde721ecec4476
MD5 8d85215e1ba7fe1b1efa9413983e59c3
BLAKE2b-256 d7162d77db1c0c207a55c65104c596172fecfa7e3eb7c60560300f04422a8753

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ca34c8640678514d437a77b52e41f6a85cc19818ed3c29a480b8824dbbfc7245
MD5 5a74cdbbb927c915d1a1b0ea56073d77
BLAKE2b-256 14ffa6ec445bd56e92528592b772f0e2996cb16409f2e778d7afc2655ccd3629

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.10-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 430.1 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.10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e02dcb431d8fc2390405de3868bec0fbbdd2199d9936a87d74bbc2d91ffbea37
MD5 8dbc660d6518d28db240d4f3b6d5fa4e
BLAKE2b-256 4954688b791bed0d2c953f3c6755905ee3f4a454af772295459530c28441d6dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba02a908b4a0b4f718c01bdc90925003bc219139a8a4255e3ce5b3ff5b11f6cf
MD5 8d6f978d1c53b7ac4c0ab176c0632f1f
BLAKE2b-256 683c5d0d8aef7c2f30994609d3ceb5683ce3e2a81893c2b3d3df2b3afad1a6dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6ee44a9426d6637fecead062b45e8dd961e545c172e01cb46e51ce2b5de5242e
MD5 388b9763bd3a0d99db7d9aeb10dae002
BLAKE2b-256 222943349b94795bf59b9bdc1860a9199bd5425293016eadde80d9803b281d4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.10-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6886d7c5a258f771ddcc60ef8d81b42a0c07e9772a31c0b1f37a3a56d7a96dd4
MD5 d8d3568e08da5fe501ccdafe2456c94f
BLAKE2b-256 022cc06bf77b1a61086157f1ac9143766870a4e261288ab4ae3a92ad90b7520d

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