As libsamplerate is using too much CPU at the best quality, I replaced it by Soxr. The developper of Soxr has written an implementation using the libsamplerate API (libsoxr-lsr), so first I just linked to libsoxr-lsr and it worked. CPU usage decreases, but you have to keep the libsamplerate options in the config file, which is weird if you say you use soxr. So I modified the code to use only the soxr API.
I post the modifications of the file here, I hope you will be able to read and understand it. You also have to replace #HAVE_SAMPLERATE by #HAVE_SOXR in every file needed.
As you will see, the algorithm to use soxr_process is much simpler than for libsamplerate, but it seems to work. The options are "VeryHighQuality" (best quality), "HighQuality", "MediumQuality", "LowQuality" and "QuickQubic" (lowest quality).
I did it a few years ago, and you can compare your code with mine. You can find it at https://gitlab.com/tomaszg/mocp/tree/speex). It supports 3 additional resampling libraries: soxr, speex and zita.
PS. It would be better for people who would want to try your code to present it as a patch.
fabi78
Mon, 2020-05-11 11:38
Permalink
In the code I sent, in audio
In the code I sent, in audio_conversion.h, I forgot to remove
float *resample_buf;
size_t resample_buf_nsamples; /* in samples ( sizeof(float) ) */
tomaszg
Mon, 2020-05-11 12:54
Permalink
I did it a few years ago, and
I did it a few years ago, and you can compare your code with mine. You can find it at https://gitlab.com/tomaszg/mocp/tree/speex). It supports 3 additional resampling libraries: soxr, speex and zita.
PS. It would be better for people who would want to try your code to present it as a patch.
fabi78
Mon, 2020-05-11 17:30
Permalink
Ok, thank you,
Ok, thank you,
The codes are nearly identical, but as your version has also opus support I might adopt it.