Skip to main content

gain

gain(
@gain 1
@resamplingfiltersize 11
@resamplingmode 'sinc'
@ampunit 0
@envampunit 0
@envtimeunit 2
) -> llll

Generates an audio process operation for modifying a buffer's gain.


Arguments

  • @gain [int/float/llll]: Gain amount, as either a single number or envelope. (default: 1).
  • @resamplingfiltersize [int]: Resampling filter size, in samples. (default: 11).
  • @resamplingmode [symbol]: Resampling mode. (default: 'sinc').
    • 'sinc'
    • 'nearest neighbor'
    • 'sample and hold'
    • 'linear'
    • 'quad'
    • 'cubic'
  • @ampunit [int]: Amplitude unit. (default: 0).
    • 0: Linear
    • 1: Decibels
  • @envampunit [int]: Amplitude unit for @gain envelope. (default: 0).
    • 0: Linear
    • 1: Decibels
  • @envtimeunit [int]: Time unit for @gain envelope. (default: 2).
    • 0: Milliseconds
    • 1: Samples
    • 2: Duration ratio
    • 3: Milliseconds difference
    • 4: Samples difference

Output

Gain operation [llll]


Usage

gain is meant to be used with the process function:

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