Skip to main content

chans2buf

chans2buf(
@buffers ## llll (required)
@resamplingfiltersize 11
@resamplingmode 'sinc'
@resamplingpolicy 3
) -> llll

Combines multiple buffers into a single buffer, each as a separate channel. Channels in non-mono buffers are still kept separate.


Arguments

  • @buffers [llll]: Audio samples to convert to a buffer. (required)
  • @resamplingfiltersize [int]: Resampling filter size. (default: 11).
  • @resamplingmode [symbol]: Resampling mode. (default: 'sinc').
    • 'sinc'
    • 'nearest neighbor'
    • 'sample and hold'
    • 'linear'
    • 'quad'
    • 'cubic'
  • @resamplingpolicy [int]: Resampling policy. (default: 3).
    • 0: Don't
    • 1: To lowest
    • 2: To highest
    • 3: To most common
    • 4: To max. current

Output

New buffer [llll]


Usage

$dur = 1000;
$chan1 = cycle(440, $dur).process(
gain([0 0.1 0] [1 0 0.125])
);
$chan23 = noise($dur).process(
gain([0 0 0] [1 0.1 0.125])
panning(@position [0 0 0] [1 1 0]) ## becomes stereo
);
$chan1.view('first channel');
$chan23.view('second and third channel');
$packed = chans2buf($chan1 $chan23);
$packed.view('packed channels')