Talk:TimeStretch

From Avisynth wiki
Jump to: navigation, search


[edit] Questions

  1. Is TimeStretch deprecated in preference to TimeStretchPlugin?
  2. Or conversely, is TimeStretch equally good after the latest updates? (it sounds OK to me)
  3. I cannot find where (in the source code) the default arguments are applied -- are they SoundTouch defaults? Are the doc'd defaults up to date?
  4. From listening tests, it seems to me quickseek is true by default, which can really degrade the sound. True?
  5. "This is NOT a sample exact plugin..." -- this section refers to audio track duration, I assume?
  6. "In 2.61 an updated SoundTouch library is used..." -- what is 2.61 and how do I know whether I have it?

Thanks and cheers,
--Raffriff42 23:07, 16 February 2016 (CET)


[edit] Possible answers
  1. The changes in TimeStretchPlugin will be included in TimeStretch in AviSynth 2.6.1[1]. So until then it's probably best to use the plugin since it uses an updated SoundTouch library (v1.8.0) and has multichannel support[2].
  2. Looking at SoundTouch.cpp it seems AviSynth is currently using the SoundTouch library from 2006 (v1.13). The plugin uses the latest library so there may or may not be some differences in the quality. Have not checked. Just took a look at the SoundTouch changelog and there's definitely been some changes that improve quality since v1.13.
  3. Wilbert said this: "If you don't supply these values, i guess the library sets default values. But i don't know what these default values are or where exactly they are set. Will check later."[3]. There's also some information in the SouchTouch readme (3.4 Tuning the algorithm parameters): The time-stretch algorithm default parameter values are set by the following #defines in file "TDStretch.h"[4]
  4. SoundTouch read me (3.5 Performance Optimizations): The time-stretch routine has a 'quick' mode that substantially speeds up the algorithm but may slightly compromise the sound quality. This mode is activated by calling SoundTouch::setSetting() function with parameter id of SETTING_USE_QUICKSEEK and value "1"[5]

Hope it helps. http://www.surina.net/soundtouch/ is not working for me so I used archived links.

@Wilbert
The latest SoundTouch is v1.9.2 released on Sept. 2015, do you plan on updating the plugin to reflect that? Also a good idea to use the latest in AviSynth 2.6.1. Reel.Deal 03:08, 17 February 2016 (CET)

"The changes in TimeStretchPlugin will be included in TimeStretch in AviSynth 2.6.1"
Thanks, Reel.Deal. I've done what I can with the page for the time being. Still TODO: determine default parameters. --Raffriff42 12:18, 19 February 2016 (CET)

[edit] default values of the advanced parameters

I think the default values that are mentioned in the history, come from this comment in the source of SoundTouch:

TDStretch.cpp:
// Sets routine control parameters. These control are certain time constants
// defining how the sound is stretched to the desired duration.
//
// 'sequenceMS' = one processing sequence length in milliseconds (default = 82 ms)
// 'seekwindowMS' = seeking window length for scanning the best overlapping position (default = 28 ms)
// 'overlapMS' = overlapping length (default = 12 ms)

I found out that this comment is wrong after a lot of debugging (perhaps it was correct in an older verion of SoundTouch?).

  • aa = 64 is set in RateTransposer.cpp (the value doesn't change unless you use the advanced parameter to change it):
// Constructor
RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer)
{
   bUseAAFilter = true;

   // Instantiates the anti-alias filter
   pAAFilter = new AAFilter(64);
   pTransposer = TransposerBase::newInstance();
}
  • overlap is set in TDStretch.h (the value doesn't change unless you use the advanced parameter to change it):
TDStretch.h:
#define DEFAULT_OVERLAP_MS      8
  • sequence and seekwindow are set in TDStretch.cpp:
/// Calculates processing sequence length according to tempo setting
void TDStretch::calcSeqParameters()
{
   // Adjust tempo param according to tempo, so that variating processing sequence length is used
   // at varius tempo settings, between the given low...top limits
   (...)
   
   if (bAutoSeqSetting)
   {
       seq = AUTOSEQ_C + AUTOSEQ_K * tempo;
       seq = CHECK_LIMITS(seq, AUTOSEQ_AT_MAX, AUTOSEQ_AT_MIN);
       sequenceMs = (int)(seq + 0.5);
   }

   if (bAutoSeekSetting)
   {
       seek = AUTOSEEK_C + AUTOSEEK_K * tempo;
       seek = CHECK_LIMITS(seek, AUTOSEEK_AT_MAX, AUTOSEEK_AT_MIN);
       seekWindowMs = (int)(seek + 0.5);
   }

   (...)
}

The default values are set when the code executes:

sampler = new SoundTouch();

The default values are updated when the code executes:

 sampler->setTempo(_tempo);
 sampler->setPitch(_pitch);

Admin 23:38, 7 July 2016 (CEST) Wilbert

Personal tools