Skip to main content

timesquash

timesquash(
@duration 1
@timeunit 2
@timeblock 4096
@mode 1
@xfade 4096
@xfadecurve 0
@xfadetype 1
@glbleed 4
@glnumiter 10
@glrandomize 0
@glrect 1
@batchsize 1
@batchinterrupt 0
@energy 2
@forwardenergy 1
@forwardenergyembed 1
@forwardenergytype 1
@framesize 2048
@hopsize 1024
@phasehandling 2
@regularization 0.01
@wintype 'sqrthann' 'sqrthann'
) -> llll

Generates an audio process operation for applying timesquash time compression to a buffer. This removes time from a sample by shifting portions of the spectrogram while preserving the relevant content.


Arguments

  • @duration [int/float]: Target duration, based on @timeunit. (default: 1).
  • @timeunit [int]: Time unit for @duration. (default: 2).
    • 0: Milliseconds
    • 1: Samples
    • 2: Duration ratio
    • 3: Milliseconds difference
    • 4: Samples difference
  • @timeblock [int]: Duration of each time block to be removed. (default: 4096).
  • @mode [int]: Working mode. (default: 1).
    • 0: Frequency domain
    • 1: Time domain
  • @xfade [int/float]: Duration of the crossfade, in samples. (default: 4096).
  • @xfadecurve [int/float]: Curve parameter for the crossfade. (default: 0).
  • @xfadetype [int]: Cross fade type. (default: 1).
    • 0: Linear
    • 1: Sine
    • 2: Curve
    • 3: S-curve
  • @glbleed [int]: Number of frames of invalidation for the Griffin-Lim algorithm, when @phasehandling is 2. (default: 4).
  • @glnumiter [int]: Number of Griffin-Lim iterations, when @phasehandling is 2. (default: 10).
  • @glrandomize [int]: Randomize the phases of the regions subject to the Griffin-Lim algorithm, when @phasehandling is 2. (default: 0).
    • 0: Off
    • 1: On
  • @glrect [int]: Invalidate whole rectangular regions whose phases are recomputed via the Griffin-Lim algorithm, when @phasehandling is 2. (default: 1).
    • 0: Off
    • 1: On
  • @batchsize [int]: Number of seams processed in batch. (default: 1).
  • @batchinterrupt [int]: Interrupt batch when crossing. (default: 0).
  • @energy [int]: Energy function used for computing seams. (default: 2).
    • 0: Magnitude
    • 1: Gradient magnitude
    • 2: Sobel
  • @forwardenergy [int/float]: Amount of forward energy contribution. (default: 1).
  • @forwardenergyembed [int]: Embed forward energy in cumulative matrix. (default: 1).
    • 0: Off
    • 1: On
  • @forwardenergytype [int]: Forward energy type. (default: 1).
    • 0: Gradient L1 norm
    • 1: Energy L2 norm
  • @framesize [int]: Window size, in samples (default: 2048).
  • @hopsize [int]: Hop size, in samples (default: 1024).
  • @phasehandling [int]: Phase handling mode. (default: 2).
    • 0: Keep
    • 1: Compensate
    • 2: Griffin-Lim
  • @regularization [int/float]: How much energy of a bin smears on the ones above and below, between 0 and 1. (default: 0.01).
  • @wintype [list/symbol]: Window type. (default: 'sqrthann' 'sqrthann').
    • 'rectangular'
    • 'triangular'
    • 'sine'
    • 'hann'
    • 'hamming'
    • 'blackman'
    • 'nuttall'
    • 'blackmannuttall'
    • 'blackmanharris'
    • 'gaussian'
    • 'sqrthann'
    • 'sqrthamming'

Output

Timesquash operation [llll]


Usage

timesquash is meant to be used with the process function:

$buffer = importaudio('singing.wav'); ## input buffer
$op = timesquash(@duration 0.5); ## processing operation
$buffer = $buffer.process($op); ## apply processing
$buffer.view('after timesquash process')