filescal
Prev | Orchestra Opcodes and Operators | Next

## filescal

filescal — Phase-locked vocoder processing with onset detection/processing, 'tempo-scaling'.

## Description

filescal implements phase-locked vocoder processing from disk files, resampling if necessary.

This opcode allows for time and frequency-independent scaling. Time is advanced internally, but controlled by a tempo scaling parameter; when an onset is detected, timescaling is momentarily stopped to avoid smearing of attacks. The quality of the effect is generally improved with phase locking switched on.

filescal will also scale pitch, independently of frequency, using a transposition factor (k-rate).

## Syntax

    asig[,asig2] filescal ktimescal, kamp, kpitch, Sfile, klock [,ifftsize, idecim, ithresh]

## Initialization

Sfile -- source soundfile, mono or stereo files are allowed, but need to match the number of outputs.

ifftsize -- FFT size (power-of-two), defaults to 2048.

idecim -- decimation, defaults to 4 (meaning hopsize = fftsize/4)

idbthresh -- threshold based on dB power spectrum ratio between two successive windows. A detected ratio above it will cancel timescaling momentarily, to avoid smearing (defaults to 1)

## Performance

ktimescal -- timescaling ratio, < 1 stretch, > 1 contract. Non-negative numbers only.

kamp -- amplitude scaling

kpitch -- grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)

klock -- switchec phase-locking on (non-zero) or off (zero).

## Examples

Here is an example of the filescal opcode. It uses the file filescal.csd.

Example 301. Example of the filescal opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

    instr 1
    p3 = filelen("fox.wav")/p4
    k1 linen 1,0.01,p3,0.1
    a1 filescal p4,0.5,1,"fox.wav",1
      out a1*k1
    endin

    </CsInstruments>
    <CsScore>
    i1 0 1 1.25
    i1 2.5 1 .75
    </CsScore>
    </CsoundSynthesizer>

## See Also

Short-time Fourier Transform (STFT) Resynthesis

## Credits

Author: Victor Lazzarini
April 2016

New in version 6.07

April 2016.

Prev | Up | Next
filepeak | Home | filesr