Skip to main content

resample

resample(
@duration 1
@timeunit 2
@changesr 0
@antimeunit 1
@resamplingmode 'sinc'
@resamplingfiltersize 11
) -> llll

Generates an audio process operation for applying stretching/pitch shifting a buffer via resampling.


Arguments

  • @duration [int/float]: Target duration, based on @timeunit, as either a single number or envelope. (default: 1).
  • @timeunit [int]: Time unit for @duration. (default: 2).
    • 0: Milliseconds
    • 1: Samples
    • 2: Duration ratio
    • 3: Milliseconds difference
    • 4: Samples difference
  • @changesr [int]: Change sampling rate. (default: 0).
    • 0: Off
    • 1: On
  • @antimeunit [int]: Time unit for analysis. (default: 1).
    • 0: Milliseconds
    • 1: Samples
    • 2: Duration ratio
    • 3: Milliseconds difference
    • 4: Samples difference
  • @resamplingmode [symbol]: Resampling mode. (default: 'sinc').
    • 'sinc'
    • 'nearest neighbor'
    • 'sample and hold'
    • 'linear'
    • 'quad'
    • 'cubic'
  • @resamplingfiltersize [int]: Resampling filter size. (default: 11).

Output

Resample operation [llll]


Usage

resample is meant to be used with the process function:

$buffer = importaudio('singing.wav'); ## input buffer
$op = resample([0 1 0] [1 0.5 -0.25]); ## processing operation
$buffer = $buffer.process($op); ## apply processing
$buffer.view('after resample process')