I think I figured out the problem.  Soundtouch uses two values, seek
window length and sequence length, to re-tempo a track.  At slow speeds,
higher numbers are better.  But at high speeds, lower numbers are
better.  Soundtouch tries to guess optimal values automatically, using a
basic algorithm with lots of magic numbers.  

Unfortunately it's not very good at picking values.  I've played around
with the magic numbers and I've found some different values that improve
the performance of the engine.  I don't hear that many artifacts whether
I speed up or slow down the tempo.  It's still not optimal, though, and
some artifacts do sneak through.

Hopefully someone who knows more about how this algorithm works can
figure out if there's a solid mathematical way to pick good values,
perhaps based on the detected bpm of the file being played.

I've attached a diff which represents my changes.

Here's the test file I've been using, although this version of the song
might be too short to further tweak the algorithm:
http://ywwg.com/DJO/woody_short.wav


Owen


On Thu, 2009-07-23 at 17:22 -0700, Albert Santoni wrote:
> Hi Owen,
> 
> Mixxx uses an external library called SoundTouch to perform
> pitch-independent time stretch. I've never noticed the problem you've
> described, and I've never seen it reported before. It's possible that
> Mixxx is using SoundTouch incorrectly, or that SoundTouch is doing some
> processing that's distorting the audio slightly. I know that SoundTouch
> applies an anti-aliasing filter to its audio, but I have no idea if
> that's the culprit here. 
> 
> One thing you can check is trying a SoundTouch test app (one called
> soundstretch comes with ST) and comparing a stretched audio file with
> that vs. Mixxx. That should you if we botched something in the way we're
> using SoundTouch.
> 
> Thanks,
> Albert
> 
> On Wed, 2009-07-22 at 23:08 -0400, Owen Williams wrote:
> > I've noticed that, with pitch-independent stretching turned on,
> > sometimes high frequency drum hits disappear.  This leads to an ugly
> > smooshy "thump" in the bass kick, lacking the normal smack on the high
> > end.  This seems to happen once every few measures.  If I change the
> > pitch setting to "vinyl" style, the problem goes away.  What is causing
> > this problem, and is there any way to fix it?
> > 
> > thanks,
> > Owen
> > 
> > 
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Mixxx-devel mailing list
> > Mixxx-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mixxx-devel
> 
> 
> 
=== modified file 'mixxx/lib/soundtouch-1.4.1/TDStretch.cpp'
--- mixxx/lib/soundtouch-1.4.1/TDStretch.cpp	2009-03-29 22:22:06 +0000
+++ mixxx/lib/soundtouch-1.4.1/TDStretch.cpp	2009-07-25 05:01:15 +0000
@@ -494,18 +494,18 @@
 {
     // Adjust tempo param according to tempo, so that variating processing sequence length is used
     // at varius tempo settings, between the given low...top limits
-    #define AUTOSEQ_TEMPO_LOW   0.5     // auto setting low tempo range (-50%)
-    #define AUTOSEQ_TEMPO_TOP   2.0     // auto setting top tempo range (+100%)
+    #define AUTOSEQ_TEMPO_LOW   0.9     // auto setting low tempo range (-50%)
+    #define AUTOSEQ_TEMPO_TOP   1.07     // auto setting top tempo range (+100%)
 
     // sequence-ms setting values at above low & top tempo
-    #define AUTOSEQ_AT_MIN      125.0
-    #define AUTOSEQ_AT_MAX      50.0
+    #define AUTOSEQ_AT_MIN      120.0
+    #define AUTOSEQ_AT_MAX      30.0
     #define AUTOSEQ_K           ((AUTOSEQ_AT_MAX - AUTOSEQ_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
     #define AUTOSEQ_C           (AUTOSEQ_AT_MIN - (AUTOSEQ_K) * (AUTOSEQ_TEMPO_LOW))
 
     // seek-window-ms setting values at above low & top tempo
-    #define AUTOSEEK_AT_MIN     25.0
-    #define AUTOSEEK_AT_MAX     15.0
+    #define AUTOSEEK_AT_MIN     20.0
+    #define AUTOSEEK_AT_MAX     3.0
     #define AUTOSEEK_K          ((AUTOSEEK_AT_MAX - AUTOSEEK_AT_MIN) / (AUTOSEQ_TEMPO_TOP - AUTOSEQ_TEMPO_LOW))
     #define AUTOSEEK_C          (AUTOSEEK_AT_MIN - (AUTOSEEK_K) * (AUTOSEQ_TEMPO_LOW))
 
@@ -529,7 +529,8 @@
 
     // Update seek window lengths
     seekWindowLength = (sampleRate * sequenceMs) / 1000;
-    seekLength = (sampleRate * seekWindowMs) / 1000;
+    seekLength = (sampleRate * seekWindowMs) / 1000;
+    printf("seq: %i\nseek: %i\n", sequenceMs, seekWindowMs);
 }
 
 

=== modified file 'mixxx/lib/soundtouch-1.4.1/TDStretch.h'
--- mixxx/lib/soundtouch-1.4.1/TDStretch.h	2009-03-29 22:22:06 +0000
+++ mixxx/lib/soundtouch-1.4.1/TDStretch.h	2009-07-25 04:56:09 +0000
@@ -96,7 +96,7 @@
 /// by a large amount, you might wish to try a smaller value on this.
 ///
 /// Increasing this value increases computational burden & vice versa.
-#define DEFAULT_OVERLAP_MS      8
+#define DEFAULT_OVERLAP_MS      12
 
 
 /// Class that does the time-stretch (tempo change) effect for the processed

------------------------------------------------------------------------------
_______________________________________________
Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to