mackron / dr_libs

Audio decoding libraries for C/C++, each in a single source file.
Other
1.24k stars 205 forks source link

dr_wav resample? #191

Closed wushange closed 3 years ago

wushange commented 3 years ago

Hello, I'm an Android application developer. I'm working on JNI recently. I need to resample the wav file just like the resample method in MATLAB. Now I have no problem generating audio with drwav. I wonder if the example method is available for use.

mackron commented 3 years ago

Unfortunately there's no resampling available in dr_wav, nor any other dr_libs library. That's something you'll need to organise yourself. My miniaudio project has a simple linear resampler available that you might be able to extract or use a reference (search for ma_linear_resampler): https://github.com/mackron/miniaudio/blob/master/miniaudio.h

Alternatively there's other resampling libraries out there such as libresample and libsamplerate. I haven't used these before and cannot tell you whether or not they're high quality libraries.

wushange commented 3 years ago

Thank you very much for your timely reply. I'm going to use your miniaudio for the experiment.

Ghabry commented 3 years ago

I can recommend libspeexdsp. The library gives good results and is much faster than libsamplerate (never used libresample)