mincer

Contents

mincer#

csoundengine.csoundlib.mincer(sndfile, outfile, timecurve, pitchcurve, dt=0.002, lock=False, fftsize=2048, ksmps=128, debug=False)[source]#

Stretch/Pitchshift a output using csound’s mincer opcode (offline)

Parameters:
  • sndfile (str) – the path to a soundfile

  • timecurve (Union[Callable[[float], float], float]) – a func mapping time to playback time or a scalar indicating a timeratio (2 means twice as fast, 1 to leave unmodified)

  • pitchcurve (Union[Callable[[float], float], float]) – a func time to pitchscale, or a scalar indicating a freqratio

  • outfile (str) – the path to a resulting outfile. The resulting file is always a 32-bit float .wav file. The samplerate and number of channels match those of the input file

  • dt – the sampling period to sample the curves

  • lock – should mincer be run with phase-locking?

  • fftsize – the size of the fft

  • ksmps – the ksmps to pass to the csound process

  • debug – run csound with debug information

Returns:

outfile, csdstr, csd)

Return type:

a dict with information about the process (keys

Note

If the mapped time excedes the bounds of the sndfile, silence is generated. For example, a negative time or a time exceding the duration of the sndfile

Examples

# Example 1: stretch a output 2x

>>> from csoundengine import csoundlib
>>> import bpf4
>>> import sndfileio
>>> snddur = sndfileio.sndinfo("mono.wav").duration
>>> timecurve = bpf4.linear(0, 0, snddur*2, snddur)
>>> mincer(sndfile, "mono2.wav", timecurve=timecurve, pitchcurve=1)