Add non-streaming ASR (#92)

This commit is contained in:
Fangjun Kuang
2023-03-26 08:53:42 +08:00
committed by GitHub
parent 6f92bc7362
commit 5572246253
48 changed files with 1526 additions and 150 deletions

View File

@@ -248,14 +248,21 @@ int32_t main(int32_t argc, char *argv[]) {
std::string wave_filename = po.GetArg(1);
bool is_ok = false;
int32_t actual_sample_rate = -1;
std::vector<float> samples =
sherpa_onnx::ReadWave(wave_filename, sample_rate, &is_ok);
sherpa_onnx::ReadWave(wave_filename, &actual_sample_rate, &is_ok);
if (!is_ok) {
SHERPA_ONNX_LOGE("Failed to read %s", wave_filename.c_str());
return -1;
}
if (actual_sample_rate != sample_rate) {
SHERPA_ONNX_LOGE("Expected sample rate: %d, given %d", sample_rate,
actual_sample_rate);
return -1;
}
asio::io_context io_conn; // for network connections
Client c(io_conn, server_ip, server_port, samples, samples_per_message,
seconds_per_message);