audionamix / wave Goto Github PK
View Code? Open in Web Editor NEWSimple C++ library for reading and writting wave files
License: MIT License
Simple C++ library for reading and writting wave files
License: MIT License
Using std::move on a wave::File object results in an undefined behavior when calling Read or Write method.
On read the Error Read(uint64_t frame_number, std::vector<float>* output);
does not fill the output
parameter but returns a kNoError
code
Usual way of handling error was to use exception or return error codes
signature should be something like
void Open(const std::string& path, OpenMode mode, std::error_code& err)
On Android, I recorded a 32 bits 48000hz and stereo wav file with this lib. When I open with the same lib, I get:
V/MultiChannelDiskPlaybackWav.cpp(10681): gonna try to open file path: /storage/emulated/0/Android/data/com.X.flutter_app/files/c677eff2-30cf-4aff-95b9-5d8ed87c8efc.wav
V/MultiChannelDiskPlaybackWav.cpp(10681): file opened successfully
V/MultiChannelDiskPlaybackWav.cpp(10681): sampleRate: 44100
V/MultiChannelDiskPlaybackWav.cpp(10681): mChannelCount: 1
V/MultiChannelDiskPlaybackWav.cpp(10681): bitsPerSample: 16
I saved the file and opened on Linux, I get
48000 Hz
stereo
32bits
File:
c677eff2-30cf-4aff-95b9-5d8ed87c8efc.zip
std::unique_lock<std::mutex> lk{recordingFileMutex};
wave::Error error = recordingFile.Open(filePath, wave::kIn);
if (error==wave::Error::kFailedToOpen) {
ALOGE(TAG, "failed to open recording");
} else if (error==wave::Error::kNotOpen) {
ALOGE(TAG, "not open");
} else if (error==wave::Error::kReadError) {
ALOGE(TAG, "kReadError");
} else if (error==wave::Error::kInvalidFormat) {
ALOGE(TAG, "kInvalidFormat");
} else if (error==wave::Error::kInvalidSeek) {
ALOGE(TAG, "kInvalidSeek");
} else if (error==wave::Error::kNoError) {
ALOGV(TAG, "file opened successfully");
} else {
ALOGE(TAG, "unknown file open error");
}
sampleRate = recordingFile.sample_rate();
mChannelCount = recordingFile.channel_number();
bitsPerSample = recordingFile.bits_per_sample();
I'm facing an issue reading waves from filenames containing chinese or other language specific characters. I'm using Visual Studio 2019 on Windows 10.
I made a local branch where I added std::wstring support, which at least solved the issue on my side.
I will now try to make a pull request (never did it before) so that you can review and hopefully merge it to main branch, so that others don't need to invest as much time as I did to find the cause of the issue.
Thanks a lot for the library so far, saved me some time, well done.
Hi,
First of all greate work.
Second of all, I found that you are missing fundamental function in case of working with file and it is a "close file" function or maybe I'm missing some point. In that case please correct me. Otherwise, if you could add it that would be greate.
Best Regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.