MicSource¶
source extra: mic-source
Capture mono audio from a microphone, optionally only between two presses of Enter (push-to-talk).
- Node type:
MicSource- Input:
–
- Output:
AudioPayload- Extra:
mic-source
$ pip install "juturna-nodes[mic-source]"
The node README describes the system requirements, push-to-talk, the messages and the licenses of the node.
Push-to-talk¶
A terminal cannot tell when a key is released, so Enter works as a switch:
press it to start talking, press it again to stop. The node prints its state
([<node name>] listening, press Enter to stop). When you stop, it sends
trailing_silence seconds of silence, so a downstream TranscriberSherpa
closes the sentence at once. While push-to-talk is off the microphone is
still read, but the audio is dropped: an assistant that answers through a
speaker does not hear itself.
Push-to-talk works on POSIX systems (Linux, macOS) only: on Windows the
warmup fails with an error, so set push_to_talk to false there. It reads
the standard input, so:
run the pipeline in a terminal, with
python -m juturna launch --auto(without--autothe launcher reads Enter itself to start and stop the pipeline);use one
MicSourcewith push-to-talk per pipeline.
Without a terminal on the standard input (a container started without
-it, input redirected from a file, a service), the warmup fails with an
error. If the standard input is closed while the pipeline runs, push-to-talk
stays off and a warning is logged.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Input device, as a name (or part of it) or an index; empty for the system default |
|
|
|
Rate of the produced audio, in Hz |
|
|
|
Length of each chunk, in seconds |
|
|
|
Send audio only between two presses of Enter |
|
|
|
Seconds of silence sent when push-to-talk is turned off |
Input message¶
The node is a source: it receives no messages.
Output message¶
Field |
Content |
|---|---|
|
Mono |
|
|
|
|
|
Seconds of audio sent since the start, counting only the chunks that were sent |
meta is empty. TranscriberSherpa and AudioWriter read this format.
License¶
Code: this node is part of juturna-nodes, MIT (its
LICENSEfile).sounddevice: MIT (the
License-Expressionof sounddevice on PyPI).NumPy: BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0 (the
License-Expressionof numpy on PyPI).
Pipeline usage¶
{
"name": "mic",
"type": "MicSource",
"configuration": { "push_to_talk": true }
}
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
device = ""
sample_rate = 16000
block_size = 0.2
push_to_talk = true
trailing_silence = 1.0
[meta]
Reference¶
- class MicSource(
- device: str,
- sample_rate: int,
- block_size: float,
- push_to_talk: bool,
- trailing_silence: float,
- **kwargs,
Capture mono audio chunks from a microphone