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(); ## processing operation
$buffer = $buffer.process($op); ## apply processing
$buffer.inspect('after timesquash process')