Skip to content

mp3scal

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

mp3scal implements phase-locked vocoder processing from mp3-format disk files, resampling if necessary.

This opcode allows for time and frequency-independent scaling. Time is advanced internally. The quality of the effect is generally improved with phase locking switched on.

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

Syntax

asig, asig2, ktime = mp3scal(Sfile, ktimescal, kpitch, kamp \
                             [, iskip, ifftsize, idecim, klock, kinterp])
asig, asig2, ktime mp3scal Sfile, ktimescal, kpitch, kamp \
                           [, iskip, ifftsize, idecim, klock, kinterp]

Initialization

Sfile -- source soundfile stereo mp3 files.

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

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

iskip -- skip time in seconds, defaults to 0.

Performance

klock (optional, default=1) -- 0 disables phase locking; 1 enables it. Can change at k-rate.

kinterp (optional, default=1) -- enables linear interpolation when resampling for pitch changes. Set to 0 to read samples without interpolation. Can change at k-rate.

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)

ktime -- time stamp

asig, asig2 -- stereo output signals

Examples

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

Example of the mp3scal opcode.
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
nchnls=2
ksmps=64
sr=44100
0dbfs=1
instr 1
SFile = p4
p3 = mp3len(SFile)/p5
a1,a2,k2 mp3scal SFile,p5,1,1
 outs a1,a2

endin

</CsInstruments>
<CsScore>
i1.1 0 1 "beats.mp3" .75
</CsScore>
</CsoundSynthesizer>

See also

Short-time Fourier Transform (STFT) Resynthesis

Credits

Author: Victor Lazzarini
April 2016

New in version 6.07

April 2016.