Add CXX examples for NeMo TDT ASR. (#2363)

# New Features
- Added new example programs demonstrating streaming speech recognition from a microphone using Parakeet-TDT CTC and Zipformer Transducer models with voice activity detection.
- These examples support microphone input via PortAudio and display recognized text incrementally.

# Bug Fixes
- Improved error handling and logic when opening microphone devices in several example programs for more reliable device initialization.

# Chores
- Updated build configuration to include new executable examples when PortAudio support is enabled.
This commit is contained in:
Fangjun Kuang
2025-07-09 18:30:42 +08:00
committed by GitHub
parent f0960342ad
commit e2b2d5ea57
6 changed files with 512 additions and 9 deletions

View File

@@ -49,6 +49,15 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO)
portaudio_static
)
add_executable(parakeet-tdt-ctc-simulate-streaming-microphone-cxx-api
./parakeet-tdt-ctc-simulate-streaming-microphone-cxx-api.cc
${CMAKE_CURRENT_LIST_DIR}/../sherpa-onnx/csrc/microphone.cc
)
target_link_libraries(parakeet-tdt-ctc-simulate-streaming-microphone-cxx-api
sherpa-onnx-cxx-api
portaudio_static
)
add_executable(zipformer-ctc-simulate-streaming-microphone-cxx-api
./zipformer-ctc-simulate-streaming-microphone-cxx-api.cc
${CMAKE_CURRENT_LIST_DIR}/../sherpa-onnx/csrc/microphone.cc
@@ -57,6 +66,15 @@ if(SHERPA_ONNX_ENABLE_PORTAUDIO)
sherpa-onnx-cxx-api
portaudio_static
)
add_executable(zipformer-transducer-simulate-streaming-microphone-cxx-api
./zipformer-transducer-simulate-streaming-microphone-cxx-api.cc
${CMAKE_CURRENT_LIST_DIR}/../sherpa-onnx/csrc/microphone.cc
)
target_link_libraries(zipformer-transducer-simulate-streaming-microphone-cxx-api
sherpa-onnx-cxx-api
portaudio_static
)
endif()
if(SHERPA_ONNX_HAS_ALSA)