This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex-mr_series-sherpa-onnx/sherpa-onnx/csrc/wave-reader.h

32 lines
940 B
C
Raw Normal View History

2023-02-19 19:36:03 +08:00
// sherpa-onnx/csrc/wave-reader.h
2023-02-18 21:35:15 +08:00
//
// Copyright (c) 2023 Xiaomi Corporation
#ifndef SHERPA_ONNX_CSRC_WAVE_READER_H_
#define SHERPA_ONNX_CSRC_WAVE_READER_H_
#include <istream>
#include <string>
#include <vector>
namespace sherpa_onnx {
/** Read a wave file with expected sample rate.
2023-03-26 08:53:42 +08:00
@param filename Path to a wave file. It MUST be single channel, 16-bit
PCM encoded.
@param sampling_rate On return, it contains the sampling rate of the file.
2023-02-18 21:35:15 +08:00
@param is_ok On return it is true if the reading succeeded; false otherwise.
@return Return wave samples normalized to the range [-1, 1).
*/
2023-03-26 08:53:42 +08:00
std::vector<float> ReadWave(const std::string &filename, int32_t *sampling_rate,
bool *is_ok);
2023-02-18 21:35:15 +08:00
2023-03-26 08:53:42 +08:00
std::vector<float> ReadWave(std::istream &is, int32_t *sampling_rate,
2023-02-18 21:35:15 +08:00
bool *is_ok);
} // namespace sherpa_onnx
#endif // SHERPA_ONNX_CSRC_WAVE_READER_H_