Stream audio to Paraformer with the C# SDK and receive recognition results.
Quick start
Follow SDK overview to install the SDK and configure your API key. Replace WorkspaceId in the example endpoint with your workspace ID from the same region.
Save the sample audio as asr_example.wav. The example reads the file in chunks to simulate live input without a microphone.
Transcribe the audio and print the final text of each sentence to the console.
Call workflow
- Create a
FunAsrSpeechTranscriberinstance withModelset toparaformer-realtime-v2(orparaformer-realtime-8k-v2) and subscribe to events such asSentenceEnd. - Call
StartAsyncto connect, sendrun-task, and wait fortask-started. - After
TranscriberStarted, callSendAudioAsynccontinuously at the audio playback rate. - Receive final sentence results in
SentenceEnd. - After all audio is sent, call
StopAsyncand wait fortask-finished(Completed). - Call
DisposeAsyncto release the connection when done.
Request parameters
Pass FunAsrTranscriberOptions to the FunAsrSpeechTranscriber constructor. Optional values set to null are omitted from the request.
| Parameter | Type | Default | Description |
|---|---|---|---|
Model | string | qwen-audio-3.1-asr-flash-streaming | Model ID. Set the model for this family explicitly. |
Format | string | pcm | Audio format. |
SampleRate | int | 16000 | Set the sample rate in Hz to match the input audio. paraformer-realtime-v2 supports any sample rate; paraformer-realtime-8k-v2 supports only 8000 Hz. |
SemanticPunctuationEnabled | bool? | null | Semantic sentence segmentation. |
MaxSentenceSilence | int? | null | VAD end-of-sentence silence threshold in milliseconds. |
MultiThresholdModeEnabled | bool? | null | Enable multi-threshold VAD segmentation. |
DisfluencyRemovalEnabled | bool? | null | Remove disfluencies. |
Heartbeat | bool? | null | Keep the connection alive while sending silent audio. |
VocabularyId | string? | null | Precompiled vocabulary ID. |
LanguageHints | IList<string>? | null | Language hints. |
ExtraParametersJson | string? | null | Pass a JSON object as a string. Its fields are merged into the protocol parameters object. |