Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.4] - 2025-06-09

- Fixed non-multichannel sessions bugging out after adding multichannel support


## [4.0.3] - 2025-06-06

- Fixed microphone transcription tests not working after adding multichan dz support
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.3
4.0.4
21 changes: 5 additions & 16 deletions speechmatics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,23 +808,12 @@ def rt_main(args):
translation_config=transcription_config.translation_config,
)

def run(stream=None, channel_stream_pairs=None):
def run(stream):
try:
# Pass in either stream or channel_stream_pairs depending on what != None
# Dynamically construct the args based on the input
args_list = [transcription_config]
if stream is not None:
args_list.append(stream)
elif channel_stream_pairs is not None:
args_list.append(None) # This skips the stream argument
args_list.append(channel_stream_pairs)
else:
raise SystemExit(
"Neither stream nor channel_stream_pairs were provided."
)
api.run_synchronously(
*args_list,
audio_settings=get_audio_settings(args),
stream,
transcription_config,
get_audio_settings(args),
from_cli=True,
extra_headers=extra_headers,
)
Expand Down Expand Up @@ -860,7 +849,7 @@ def run(stream=None, channel_stream_pairs=None):
# Here the order matters, as stream positions and diarization labels correspond to one another.
channel_name = transcription_config.channel_diarization_labels[i]
channel_stream_pairs[channel_name] = args["files"][i]
run(channel_stream_pairs=channel_stream_pairs)
run(stream=channel_stream_pairs)

else:
for filename in args["files"]:
Expand Down
14 changes: 11 additions & 3 deletions speechmatics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from collections import defaultdict
from contextlib import AsyncExitStack
import copy
from io import IOBase
import json
import logging
import os
Expand Down Expand Up @@ -521,9 +522,8 @@ async def _communicate(self, stream, audio_settings):

async def run(
self,
stream: Union[IOBase, Dict[str, IOBase]],
transcription_config: TranscriptionConfig,
stream: Optional[Any] = None,
channel_stream_pairs=None,
Comment thread
J-Jaywalker marked this conversation as resolved.
audio_settings: AudioSettings = None,
from_cli: bool = False,
extra_headers: Dict = None,
Expand Down Expand Up @@ -552,7 +552,14 @@ async def run(
:raises Exception: Can raise any exception returned by the
consumer/producer tasks.
"""
if channel_stream_pairs:
# Check we get either a dict or a file-like object
channel_stream_pairs = None
if isinstance(stream, dict):
# Case where stream is channel stream pairs
channel_stream_pairs = stream

# Set channel_stream pairs if provided
if channel_stream_pairs is not None:
Comment thread
J-Jaywalker marked this conversation as resolved.
opened_streams = {}
self._stream_exits = AsyncExitStack()
for channel_name, path in channel_stream_pairs.items():
Expand All @@ -564,6 +571,7 @@ async def run(
self.channel_stream_pairs = opened_streams
else:
self.channel_stream_pairs = None

self.transcription_config = transcription_config
self._language_pack_info = None
await self._init_synchronization_primitives()
Expand Down