Comments (5)
What overloads for src_short_to_float_array
and why?
from libsamplerate.
Have 1 function each for converting from/to float to allow for more generic user code:
std::vector<short> doConvert(std::vector<short> data){
std::vector<float> floats(data.size());
to_float_array(data.data(), data.size(), floats.data());
// Work with floats
from_float_array(floats.data(), floats.size(), data.data());
return data;
}
The overloads allow to change the type of parameter data to e.g. std::vector<int>
without touching the rest of the code.
This gets more powerful the more conversion functions exist (see e.g. #72)
from libsamplerate.
You have not even read (or maybe misunderstood) the documentation for those auxiliary functions. I actually regret having ever added them to this library, because having them encourages suggestions like this one.
This library does sample rate conversion. It should not do anything else.
This gets more powerful the more conversion functions exist (see e.g. #72)
Audio data stored 8 bit has a dynamic range of 42db which is about nowhere near adequate fidelity for professional audio purposes and significantly less that even extremely primitive audio compression algorithms like u-law and A-law. As far as I am concerned providing conversion functions to convert to and from that format is waste of time unless it is to provide the ability to read legacy file formats (for which you would use libsndfile).
from libsamplerate.
You have not even read (or maybe misunderstood) the documentation for those auxiliary functions.
Then I'm missing your point. What exactly do you mean? The linked docu states There are <n> auxillary functions for converting arrays of float data to and from <other types> data. [...] [values are] automatically scaled [...] values which would overflow [...] are clipped.
(shortened to be slightly more general and show how I read it)
This library does sample rate conversion. It should not do anything else.
Ok sure, understand this. Then cut those overloads from this issue. The C++ wrapper would still be a nice addition to have RAII provided by the library.
to read legacy file formats (for which you would use libsndfile).
Just a note: That legacy format is not readable by libsndfile. We still need the conversion to float without round-tripping via a WAV file (create WAV header, write to file, load with libsndfile, convert, optionally store) Having the conversions of raw data in a library would avoid having to reimplement (and test) it in user code and this looked like the place to do that (see above note about how I understood the docu).
from libsamplerate.
The scaling mentioned in that documentation is correct for short
but unlikely to be correct for any type which is not short
.
As for your legacy format, it makes far more sense to add support for it to libsndfile than it does adding the conversion functions here.
from libsamplerate.
Related Issues (20)
- Deprecation warning CMP0091 HOT 4
- src_simple with sndfile HOT 2
- No anti-aliasing filter for linear resampling HOT 5
- Input samples needed to get n output samples? HOT 1
- src_process - zipper noise HOT 3
- Libsamplerate as fractional sample rate converter ? HOT 2
- Slow `lrint()` `lrintf()` functions in the release Windows build. HOT 12
- Fix Gihub Actions CI
- fail to build with Xcode in universal binary on OSX HOT 4
- need help with resampling the waveform in macOS HOT 1
- Don't work with more than 15 channels HOT 2
- Varispeed but preserve pitch HOT 1
- typo in libsamplerate/docs/api_full.md HOT 3
- Inconsistent input_frames_used/output_frames_gen among the numbers of channels
- Out of bound array access in src_linear.c HOT 2
- (minor) Warnings for lrint when compiling in Xcode for iOS HOT 1
- CI macOS build fails with 'You must have libtool installed to compile libsamplerate.'
- Int16 support? HOT 5
- CMake deprecation warning
- One input frame is not enough for variable ratio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsamplerate.