🎙️
@radzor/audio-capture
Capture audio from the user's microphone using the Web Audio API and getUserMedia. Provides a real-time audio stream suitable for speech recognition, voice chat, or recording.
Audio & Voicev0.1.0typescriptvoicewebrtcmicrophonestreamingrecording954 downloadsby Radzor
Install
View source on GitHub →$npx radzor add audio-capture
⚠ Constraints: Browser environment only. Requires HTTPS for getUserMedia. User must grant microphone permission.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| sampleRate | number | 44100 | Audio sample rate in Hz. |
| channels | number | 1 | Number of audio channels (1 = mono, 2 = stereo). |
| codec | string | opus | Audio codec to use for encoding (opus, pcm, aac). |
Outputs
| Name | Type | Description |
|---|---|---|
| audioStream | ReadableStream<Float32Array> | Raw PCM audio stream from the microphone. |
| audioBlob | Blob | Recorded audio as a Blob after stopRecording() is called. |
Actions
startRecording()→ Promise<void>Request microphone permission and begin capturing audio.
stopRecording()→ Promise<Blob>Stop capturing and return the recorded audio as a Blob.
pause()→ voidPause the current recording without releasing the microphone.
resume()→ voidResume a paused recording.
getVolume()→ numberGet the current input volume level (0.0 to 1.0).
Events
onSpeechStart{timestamp: number}Fired when voice activity is detected in the audio stream.
onSpeechEnd{duration: number, timestamp: number}Fired when a speech segment ends (silence detected).
onError{code: string, message: string}Fired when an error occurs (permission denied, device unavailable, etc.).
Composability
audioStream→
@radzor/speech-to-text.input.audioStream@radzor/audio-visualizer.input.audioStream
radzor.manifest.json
{
"llm": {
"constraints": "Browser environment only. Requires HTTPS for getUserMedia. User must grant microphone permission.",
"usageExamples": "llm/examples.md",
"integrationPrompt": "llm/integration.md"
},
"name": "@radzor/audio-capture",
"tags": [
"voice",
"webrtc",
"microphone",
"streaming",
"recording"
],
"events": [
{
"name": "onSpeechStart",
"payload": {
"timestamp": "number"
},
"description": "Fired when voice activity is detected in the audio stream."
},
{
"name": "onSpeechEnd",
"payload": {
"duration": "number",
"timestamp": "number"
},
"description": "Fired when a speech segment ends (silence detected)."
},
{
"name": "onError",
"payload": {
"code": "string",
"message": "string"
},
"description": "Fired when an error occurs (permission denied, device unavailable, etc.)."
}
],
"inputs": [
{
"name": "sampleRate",
"type": "number",
"default": 44100,
"required": false,
"description": "Audio sample rate in Hz."
},
{
"name": "channels",
"type": "number",
"default": 1,
"required": false,
"description": "Number of audio channels (1 = mono, 2 = stereo)."
},
{
"name": "codec",
"type": "string",
"default": "opus",
"required": false,
"description": "Audio codec to use for encoding (opus, pcm, aac)."
}
],
"radzor": "1.0.0",
"actions": [
{
"name": "startRecording",
"params": [],
"returns": "Promise<void>",
"description": "Request microphone permission and begin capturing audio."
},
{
"name": "stopRecording",
"params": [],
"returns": "Promise<Blob>",
"description": "Stop capturing and return the recorded audio as a Blob."
},
{
"name": "pause",
"params": [],
"returns": "void",
"description": "Pause the current recording without releasing the microphone."
},
{
"name": "resume",
"params": [],
"returns": "void",
"description": "Resume a paused recording."
},
{
"name": "getVolume",
"params": [],
"returns": "number",
"description": "Get the current input volume level (0.0 to 1.0)."
}
],
"outputs": [
{
"name": "audioStream",
"type": "ReadableStream<Float32Array>",
"description": "Raw PCM audio stream from the microphone."
},
{
"name": "audioBlob",
"type": "Blob",
"description": "Recorded audio as a Blob after stopRecording() is called."
}
],
"version": "0.1.0",
"category": "audio",
"languages": [
"typescript"
],
"description": "Capture audio from the user's microphone using the Web Audio API and getUserMedia. Provides a real-time audio stream suitable for speech recognition, voice chat, or recording.",
"dependencies": {
"packages": {}
},
"composability": {
"connectsTo": [
{
"output": "audioStream",
"compatibleWith": [
"@radzor/speech-to-text.input.audioStream",
"@radzor/audio-visualizer.input.audioStream"
]
}
]
}
}Version History
0.1.0
Initial release
4/3/2026