11.1 p i t ch
koct, pitchpitchpitchpitch asig, iupdte, ilo, ihi, idbthresh[, ifrqs, iconf,\\
kamp istrt, iocts, iq, inptls, irolloff, iskip]
D
ESCRIPTIONUsing the same techniques as spectrum and specptrk, pitch tracks the pitch of the signal in octave point decimal form, and amplitude in dB.
I
NITIALIZATIONiupdte – length of period, in seconds, that outputs are updated
ilo, ihi – range in which pitch is detected, expressed in octave point decimal
idbthresh – amplitude, expressed in decibels, necessary for the pitch to be detected. Once started it continues until it is 6 dB down.
ifrqs – number of divisions of an octave. Default is 12 and is limited to 120.
iconf – the number of conformations needed for an octave jump. Default is 10.
istrt – starting pitch for tracker. Default value is (ilo + ihi)/2.
iocts – number of octave decimations in spectrum. Default is 6.
iq – Q of analysis filters. Default is 10.
inptls – number of harmonics, used in matching. Computation time increases with the number of harmonics. Default is 4.
irolloff – amplitude rolloff for the set of filters expressed as fraction per octave. Values must be positive. Default is 0.6.
iskip – if non-zero, skips initialization
P
ERFORMANCEpitch analyzes the input signal, asig, to give a pitch/amplitude pair of outputs, for the strongest frequency in the signal. The value is updated every iupdte seconds.
The number of partials and rolloff fraction can effect the pitch tracking, so some
experimentation may be necessary. Suggested values are 4 or 5 harmonics, with rolloff 0.6, up to 10 or 12 harmonics with rolloff 0.75 for complex timbres, with a weak fundamental.
The Public Csound Reference Manual Version 4.10 Instrument Control: Sensing and Control Page 11-2
A
UTHORJohn ffitch
University of Bath, Codemist Ltd.
Bath, UK April, 1999
New in Csound version 3.54
The Public Csound Reference Manual Version 4.10 Instrument Control: Sensing and Control Page 11-3
11.2 p i t ch a m df
kcps, pitchamdfpitchamdfpitchamdfpitchamdf asig, imincps, imaxcps [, icps[, imedi[, idowns[,//
krms iexcps]]]]
D
ESCRIPTIONFollows the pitch of a signal based on the AMDF method (Average Magnitude Difference Function). Outputs pitch and amplitude tracking signals. The method is quite fast and should run in real-time. This technique usually works best for monophonic signals.
I
NITIALIZATIONimincps – estimated minimum frequency (expressed in Hz) present in the signal imaxcps – estimated maximum frequency present in the signal
icps – estimated initial frequency of the signal. If 0, icps = (imincps+imaxcps) / 2. The default is 0.
imedi – size of median filter applied to the output kcps. The size of the filter will be imedi*2+1. If 0, no median filtering will be applied. The default is 1.
idowns – downsampling factor for asig. Must be an integer. A factor of idowns>1 results in faster performance, but may result in worse pitch detection. Useful range is 1 – 4. The default is 1.
iexcps – how frequently pitch analysis is executed, expressed in Hz. If 0, iexcps is set to imincps. This is usually reasonable, but experimentation with other values may lead to better results. Default is 0.
P
ERFORMANCEkcps – pitch tracking output krms – amplitude tracking output
pitchamdf usually works best for monophonic signals, and is quite reliable if appropriate initial values are chosen. Setting imincps and imaxcps as narrow as possible to the range of the signal’s pitch, results in better detedtion and performance.
Because this process can only detect pitch after an initial delay, setting icps close to the signal’s real initial pitch prevents spurious data at the beginning.
The median filter prevents kcps from jumping. Experiment to determine the optimum value for imedi for a given signal.
Other initial values can usually be left at the default settings. Lowpass filtering of asig before passing it to pitchamdf, can improve preformance, especially with complex waveforms.
The Public Csound Reference Manual Version 4.10 Instrument Control: Sensing and Control Page 11-4
E
XAMPLEginput ftgenftgenftgenftgen 1, 0, 0, -1, "input.wav", 0, 4, 0 ; input signal giwave ftgenftgenftgenftgen 2, 0, 1024, 10, 1, 1, 1, 1 ; synth wave
instr instr instr instr 1
asig loscilloscilloscilloscil 1, 1, ginput, 1 ; get input signal
; with original freq asig tonetonetonetone asig, 1000 ; lowpass-filter
kcps, krms pitchamdfpitchamdfpitchamdfpitchamdf asig, 150, 500, 200 ; extract pitch
; and envelope asig1 osciloscilosciloscil krms, kcps, iwave ; "resynthesize"
; with some waveform outout
outout asig1 endin
endin endin endin
A
UTHORPeter Neubäcker Munich, Germany August, 1999
New in Csound version 3.59
The Public Csound Reference Manual Version 4.10 Instrument Control: Sensing and Control Page 11-5
11.3 t e m p e s t
ktemp tempesttempesttempesttempest kin, iprd, imindur, imemdur, ihp, ithresh, ihtim, ixfdbak, istartempo, ifn[, idisprd, itweek]
D
ESCRIPTIONEstimate the tempo of beat patterns in a control signal.
I
NITIALIZATIONiprd – period between analyses (in seconds). Typically about .02 seconds.
imindur – minimum duration (in seconds) to serve as a unit of tempo. Typically about .2 seconds.
imemdur – duration (in seconds) of the kin short-term memory buffer which will be scanned for periodic patterns. Typically about 3 seconds.
ihp – half-power point (in Hz) of a low-pass filter used to smooth input kin prior to other processing. This will tend to suppress activity that moves much faster. Typically 2 Hz.
ithresh- loudness threshold by which the low-passed kin is center-clipped before being placed in the short-term buffer as tempo-relevant data. Typically at the noise floor of the incoming data.
ihtim – half-time (in seconds) of an internal forward-masking filter that masks new kin data in the presence of recent, louder data. Typically about .005 seconds.
ixfdbak – proportion of this unit’s anticipated value to be mixed with the incoming kin prior to all processing. Typically about .3.
istartempo – initial tempo (in beats per minute). Typically 60.
ifn – table number of a stored function (drawn left-to-right) by which the short-term memory data is attenuated over time.
idisprd (optional) – if non-zero, display the short-term past and future buffers every idisprd seconds (normally a multiple of iprd). The default value is 0 (no display).
itweek (optional) – fine-tune adjust this unit so that it is stable when analyzing events controlled by its own output. The default value is 1 (no change).