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.13.tar.gz (263.0 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.13-cp313-cp313-win_amd64.whl (428.0 kB view details)

Uploaded CPython 3.13Windows x86-64

snorbyte-0.1.13-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.13-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.13-cp313-cp313-macosx_10_13_universal2.whl (646.5 kB view details)

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

snorbyte-0.1.13-cp312-cp312-win_amd64.whl (427.3 kB view details)

Uploaded CPython 3.12Windows x86-64

snorbyte-0.1.13-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.13-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.13-cp312-cp312-macosx_10_13_universal2.whl (648.9 kB view details)

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

snorbyte-0.1.13-cp311-cp311-win_amd64.whl (432.5 kB view details)

Uploaded CPython 3.11Windows x86-64

snorbyte-0.1.13-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.13-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.13-cp311-cp311-macosx_10_9_universal2.whl (654.2 kB view details)

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

snorbyte-0.1.13-cp310-cp310-win_amd64.whl (431.0 kB view details)

Uploaded CPython 3.10Windows x86-64

snorbyte-0.1.13-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.13-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

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

snorbyte-0.1.13-cp310-cp310-macosx_10_9_universal2.whl (657.5 kB view details)

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

snorbyte-0.1.13-cp39-cp39-win_amd64.whl (431.5 kB view details)

Uploaded CPython 3.9Windows x86-64

snorbyte-0.1.13-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.13-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.13-cp39-cp39-macosx_10_9_universal2.whl (659.2 kB view details)

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

File details

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

File metadata

  • Download URL: snorbyte-0.1.13.tar.gz
  • Upload date:
  • Size: 263.0 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.13.tar.gz
Algorithm Hash digest
SHA256 e7e6b4dba35a9e3c6874197f00bcd85a1ea4bdb81938576a70dd42d64624bd86
MD5 476a7563eed868a508a0132b34582dc5
BLAKE2b-256 81a928a90c9763c378be0db5e2bb0032335c47a99e747b380274da8398557b0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.13-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 428.0 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.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f59031359120d94ee0a445c66dd50e7ffed47397dab727b22d9a22e1fbc3b516
MD5 8bcf1ddfdae80079f019bc2dd1fbe2d9
BLAKE2b-256 a70e24b4a1d3aaa6477bbc77f17bf8595112d6696ebce6765f6087ecb86eaeed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e36b4a7aad012a60c8a031d088cb5cbc2d65c1534c7f8582d4869e92bec4aabb
MD5 d21b613c3db639b45210d1f016a60930
BLAKE2b-256 e444a6a485351e001305db44a130f5c4cdf749a8c07609038e2f8397d97cd09d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 0b811e35ae250fa6eeecd5d3690c18c124cc8c5c33c5d013916d7c2a5a7a528d
MD5 6792e39c16a5e44203c3edaa58f4ae8a
BLAKE2b-256 08bd6b273b3706612c0c35a6429cd28d5a2550ed5b12d381ca743873aa173070

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 e46ddb0b5d38c8fd9a87df9ac564366c52bfcc88cdc92638e16447d740adea08
MD5 cc017814093b2f26f2322c461adbee97
BLAKE2b-256 0da3251f7b12220cf51a031129809b5ec6e3163569c44cb6d2bd1130d4267b09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.13-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 427.3 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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f58f12119a7809621ab195bc5473ec071b2fafd69188c21e17a8cf9b0ff7e35d
MD5 f632ac0e12df4ad833a3e45113619030
BLAKE2b-256 00c2d8ade3528fec5d5c4d72359327459271e8956ce8e5709bc3fec73921e886

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7039ca2cd3ffb54279b149c94a3890670cea8a1da8dddf37dbe1de992421b030
MD5 f9f0aac950363520ee82ea374e36c402
BLAKE2b-256 3064c2948f45985dd205fbdd8bcb82f841d5bffb274c2d26eb4e3f6dc82e74c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7aea0c910dabac4319f2f60184b6a210fbc8578dfe2e8f5769bbed257ea2a8a3
MD5 fec11ecf4ac29d5892c51d09b260c4a2
BLAKE2b-256 7ca593a2e8b4763a2db8bacb306f38d80babe4e1066bf925a6437235eda7c5ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 1793431c60cd0b63954133f897f100e2c860213c3e708d3f322bdb1e9afa9b9c
MD5 e38004546f375c53659a08a62b4503eb
BLAKE2b-256 fae7cfe749414c2dd77c6bafd0656faaef8a963174c78bd1af136a886243f9d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 432.5 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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1e02a509942356ce417cbc549d8c33597d66f6a036ab63eeeeb972d0b44c6f7c
MD5 57606f4bf7a9bb20c50d648b57957286
BLAKE2b-256 9e1902f480bf4aa02e6b1a427ae0956c6bdb4d2ee7acbb86ddd76028db927699

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ab94eeeedab037f0dc2a121379f1e9203b4e40ae4868cb0df85b6cb6f2183d7
MD5 a29ff4648f7d1e2761020e1a6317bd3e
BLAKE2b-256 ece4cc982c47b8500285d6083226d09e114ab7dfc0d7bad2a8554526e9057038

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b03873044f7708c7e4379b040ad6b2aa68f65db8abdf036716886df977a7af53
MD5 ae96a1eaad3ee07b02b0dd397f7a5955
BLAKE2b-256 f54dd8197f12422d8299dd542c3e1dd3f29d76d4e5127de059d60bdb5443ac9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ff9eddb0585e122b0ea6cf7182690f19947b967da74e748c6fcd63822114e2ca
MD5 29c9ea9daa7c79553f2be8f6a800a648
BLAKE2b-256 b463e1bf3ff23d740ff1df3c7b457f3018b6d9ee276b3a16c2178782a890087d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.13-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 431.0 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.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ecec0385735f643d9097e670e295835452a52717f95d50979506aa6489cb92e0
MD5 bc6f36a9855f3f518ac13f320e314fb7
BLAKE2b-256 6455f3a9a263803babd8009c5cfe48f0f58ec5a6937edc2dbb7090a88750befc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c493b12a9c056edf1be2ab0226ee1e187481cbf6e9747258a5a1c4be9a60a16
MD5 a1554e62f2d06f4580b7f4a9951ebb38
BLAKE2b-256 9bf9befaf4b250d7289ab58b17e08395c8784e7e46897babd2631993420be571

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 58d8df45074f84eb398ff842ec4501ee0efa0bc9c709759d0a58664db98c4c34
MD5 982ff5a3c12ffe49d9bf2ac8df3d4c1d
BLAKE2b-256 f7355e2fda28bbc303b34d568b87fd108853fa0c5e37d22060cdf65c4be3914f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3905ac3dd8eb0d4e950a296dbf3f02ad0900e825ef0b7e77edd190e26cf5ff8b
MD5 67911100d22cc16c1b9967e1fad704d8
BLAKE2b-256 9d071acfd866d3a5c5676a7cb35c55cebd8e7f1710ce887bef4345730fad7320

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snorbyte-0.1.13-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 431.5 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.13-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fc3a02e814e15e989b98f33da002c091423f78e9942c223c0fadaddb7fbcc9b6
MD5 708c77032d6dbe39970dcfeaa865f6d2
BLAKE2b-256 6f485c885013cd2004276e2fc7e7d743147d8530e7e81f850f7bb6e502585b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f53a0512e926c0747cb1de68458b5a1ceebee62195ee36565ce14ab9292890a8
MD5 523792a6d3b4b9a5f70df8621b7d74d9
BLAKE2b-256 26d614e75c34d585be44b1e4142e7b759c3fe71f5fae530ec253d243874adbec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 699b453ba0350a027712acce064fcfc7c12f55adfa3e5573fa77c99abd134242
MD5 1dd8b1706b222a9b9c34dbea5cdc234e
BLAKE2b-256 48b5145306a8c26b9515f168a687749ea9b0d8f2b5c504968f899d062dcc056b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for snorbyte-0.1.13-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 67c90d4dddc6bcf0390008b4085e7a3f91af4aebca2173911cde48e9213b68c9
MD5 b74f83715fc240ac1f533bd396881bbd
BLAKE2b-256 ea266be8e8fcab6d0e6d9f92e8ab7f0ccd418e6995d47b12b1bd86f53dc0b201

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