speechline-sdk
Speechline's API from Python 3.10 or later: transcription, translation and speech, live and from files, over REST and the WebSocket.
pip install speechline-sdk
export SPEECHLINE_API_KEY=lp_... # the app's Keys page: https://app.speechline.ai
The source, a tag a release: https://github.com/speechline-dev/speechline-python
(pip install git+https://github.com/speechline-dev/speechline-python@vVERSION).
Transcribe a file
from speechline import Client
client = Client()
media = client.upload(open("talk.wav", "rb").read(), filename="talk.wav", content_type="audio/wav")
job = client.create_job(template_id="file-transcription",
params=[{"name": "media", "value": {"string_value": media.id}}])
end = client.watch_job(job.run.id, timeout=600).wait()
print(client.download(end.run_id, "subtitles.srt").decode())
file-translation takes targets too ({"list_value": {"values": ["de", "uk"]}}); file-speech takes text.
Live
A session streams audio in and results out as they come: 16 kHz mono PCM (s16le) by default, or the rate given in
format.
from speechline import Client, frames, stream_pcm, translation_of
client = Client()
targets = {"name": "targets", "value": {"listValue": {"values": ["de"]}}}
with client.session(open={"templateId": "stream-translation", "params": [targets]}) as s:
s.ready.result(10)
stream_pcm(s, pcm, pace="realtime") # a microphone's chunks: s.send(chunk)
s.finish(60)
for e in s.events():
t = frames.Transcript()
if e.kind == "output.transcript" and e.data.Unpack(t) and t.final:
tr = translation_of(t) # None: the transcript itself
print(f"{tr['target']}: {tr['text']}" if tr else t.text)
stream-transcription transcribes alone; stream-speech speaks the text you send (s.send_text(text),
audio_of(e) for the audio, write_wav(path, chunks)).
A pipeline of your own
Any graph of the elements, in one line:
s = client.session(dsl="input source=client ! queue policy=block ! asr ! translate targets=[de] mode=final ! "
"tts targets=[de] ! output to=client")
Errors
A refused call raises PipelineError: code_name and reason (branch on the reason: no_key, bad_key,
scope, ...), and a message for people.
The API: https://www.speechline.ai/docs. Licence: Apache-2.0.
Metadata
Release files for speechline-sdk 2612.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| speechline_sdk-2612.0.tar.gz | 67.7 kB | Without provenance | Details for speechline_sdk-2612.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| speechline_sdk-2612.0-py3-none-any.whl | Python 3 | none | any | Details for speechline_sdk-2612.0-py3-none-any.whl |
Total release size: 160.7 kB
Release files / speechline_sdk-2612.0.tar.gz
| Download URL | speechline_sdk-2612.0.tar.gz |
|---|---|
| Size | 67.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7a6a0db1809fe93753ced0779b02eeb9dd0bdfe024d2be5a4a46d4db325c8f4
|
|
BLAKE2b-256 checksum How to use checksums |
07715fc4a1503394a12a5d92459bd3a2d6876ec767c1de8b673f4ce2ebb7b87f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / speechline_sdk-2612.0-py3-none-any.whl
| Download URL | speechline_sdk-2612.0-py3-none-any.whl |
|---|---|
| Size | 93.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b9a341517a406a8666c806b27ac33f93473763ead4b8e09f3e40dc4624c5ff9
|
|
BLAKE2b-256 checksum How to use checksums |
1bf9d87ee89c047b2e6260a198be27e749dcf95dbe378eba152baa3548c4e460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for speechline-sdk 2612.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.