additional Interpolation methods for resampling

Bug #1775164 reported by Dale
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mixxx
Confirmed
Wishlist
Unassigned

Bug Description

Feature request:

I would like to see additional Interpolation options to increase the audio quality when not using Key Lock.

Currently there is no option for this, with Linear being the only possible choice. This may be good for low powered devices but does not provide overly good audio quality.

Minimum options I would like to see are:
None
Linear
Sinc

I can find a number of examples where these are provided, often with various different quality settings for Sinc (how many convolutions of the sinx/x curve it iterates over) if this might be of help (eg I believe the Audacious and its Plugins are written in C++ so be a possible source of inspiration if needed) but I feel the learning curve would be too high for me to attempt myself with any reasonable timeframe.

Additionally I would suggest a look into Cubic Spline Interpolation. I haven't really come across this so commonly in open source software but have seen it well used in propriety software and it gives a quality close to that of Sinc while being far easier on the processor.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

We originally had a cubic interpolation in Mixxx which was considered as sound not better.
https://github.com/mixxxdj/mixxx/commit/21c869ccc1065ab2dcfda7d138a5119cbeb203b3

The file of question now lives here:
https://github.com/mixxxdj/mixxx/blob/f3a1442138ea0a93374bd09dcd73ee2206235671/src/engine/enginebufferscalelinear.cpp#L328

I think a good and easy to implement feature would be to add an option to use either rubber band or Soundtouch for the linear case as well.

Does anyone know what they do in the linear case (vinyl pitch) ?

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Ok, Soundtouch uses it's own cubic interpolation.
Rubberband uses libsamplerate by default with a sinc interpolator. SRC_SINC_FASTEST.

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Dale (dj-kaza) wrote :

SoundTouch, being a frames based method of timestrectch, I really don't think would work well at all. The only way I could imagine RubberBand doing it would be double processing, first timestretching as normal, then pitchshifting to the pitch it should be. I could well be wrong but if that's the case that would be an excessive amount of processing to achieve this!

And I've done quite a lot of comparison of Linear Vs Cubic Interpolation at the output of a DAW and Cubic has nearly always sounded far superior. If it didn't then my guess would be a faulty implementation previously.....

Is there a PR number or similar I can use to test myself? Or is it just a matter of copying over the file you have specified with the one with the same name in Master/2.1 and compiling?

Revision history for this message
Daniel Schürmann (daschuer) wrote :
Revision history for this message
Dale (dj-kaza) wrote :

"Ok, Soundtouch uses it's own cubic interpolation.
Rubberband uses libsamplerate by default with a sinc interpolator. SRC_SINC_FASTEST."

Happy to hear I'm wrong and they have included these use cases. So your solution sounds like it could be a good one.

Revision history for this message
Dale (dj-kaza) wrote :

Not managed to find the different Scalers, or not one that seems to use interpolation rather than change play_pos (probably due to not being used to the code and have zero C++ skills) but I did come across this comment:

"// When no time-stretching or pitch-shifting is needed we use our own linear
// interpolation code (EngineBufferScaleLinear). It is faster and sounds
// much better for scratching."

When talking about scratching I can fully believe that Linear will sound better than Cubic, I would ague that in this case it's very likely that Nearest Neighbour will sound even better than Linear. Scratching for digital DJs is a bit of a niche though really and I don't think a reason to lose a configurable option for modes that sounds better during normal playback....

Revision history for this message
Daniel Schürmann (daschuer) wrote :

There is also the question after group delay, that may be an issue when scratching.
I think we need to distinguish one case more in the future.
* Scratching
* Linear interpolation for sample rate adjusting and vinyl speed changes
* Keylock/Keyschift

We may consider to use libsamplerate directly, to bypass the rubberband overhead when doing only interpolation.

Revision history for this message
Dale (dj-kaza) wrote :

DO you mean add an internal switch so that Mixxx will automatically switch between a method optimised for Scratching under certain conditions and then use the user selected mode at other times, which itself depends on whether Key Lock is active or not?

Revision history for this message
Dale (dj-kaza) wrote :

Have you considered trying libzita-resample? Their claims are to be faster and better quality than libsamplerate and on the whole my experience with all the Zita tools is pretty positive. Something makes me think you don't use single-precision floats in the audio engine though, so it might not be suitable at all.....

" Libzita-resampler is a C++ library for resampling audio signals. It is designed to be used within a real-time processing context, to be fast, and to provide high-quality sample rate conversion.

The library operates on signals represented in single-precision floating point format. For multichannel operation both the input and output signals are assumed to be stored as interleaved samples.

The API allows a trade-off between quality and CPU load. For the latter a range of approximately 1:6 is available. Even at the highest quality setting libzita-resampler will be faster than most similar libraries, e.g. libsamplerate. "

http://kokkinizita.linuxaudio.org/linuxaudio/zita-resampler/resampler.html

summary: - (req) additional Interpolation methods
+ additional Interpolation methods for resampling
Revision history for this message
Daniel Schürmann (daschuer) wrote :

We may add a new comobox:

Vinyl-Pitch Engine: "Linear (faster) / Sinc (better)"

https://demonstrations.wolfram.com/SincInterpolationForSignalReconstruction/

Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/9328

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.