harmon2
Prev | Orchestra Opcodes and Operators | Next

## harmon2

harmon2 — Analyze an audio input and generate harmonizing voices in synchrony with formants preserved.

## Description

Generate harmonizing voices with formants preserved.

## Syntax

    ares harmon2 asig, koct, kfrq1, kfrq2, icpsmode, ilowest[, ipolarity]

    ares harmon3 asig, koct, kfrq1, \
        kfrq2, kfrq3, icpsmode, ilowest[, ipolarity]

    ares harmon4 asig, koct, kfrq1, \
        kfrq2, kfrq3, kfrq4, icpsmode, ilowest[, ipolarity]

## Initialization

icpsmode -- interpreting mode for the generating frequency inputs kfrq1, kfrq2, kfrq2 and kfrq4: 0: input values are ratios w.r.t. the cps equivalent of koct. 1: input values are the actual requested frequencies in cps.

ilowest -- owest value of the koct input for which harmonizing voices will be generated.

ipolarity -- polarity of asig input, 1 = positive glottal pulses, 0 = negative. Default is 1.

## Performance

Harmon2, harmon3 and harmon4 are high-performance harmonizers, able to provide up to four pitch-shifted copies of the input asig with spectral formants preserved. The pitch-shifting algorithm requires an accurate running estimate (koct, in decimal oct units) of the pitched content of asig, normally gained from an independent pitch tracker such as specptrk. The algorithm then isolates the most recent full pulse within asig, and uses this to generate the other voices at their required pulse rates.

If the frequency (or ratio) presented to kfrq1, kfrq2, kfrq3 or kfrq4 is zero, then no signal is generated for that voice. If any of them is non-zero, but the koct input is below the value ilowest, then that voice will output a direct copy of the input asig. As a consequence, the data arriving at the k-rate inputs can variously cause the generated voices to be turned on or off, to pass a direct copy of a non-voiced fricative source, or to harmonize the source according to some constructed algorithm. The transition from one mode to another is cross-faded, giving seemless alternating between voiced (harmonized) and non-voiced fricatives during spoken or sung input.

harmon2, harmon3, harmon4 are especially matched to the output of specptrk. The latter generates pitch data in decimal octave format; it also emits its base value if no pitch is identified (as in fricative noise) and emits zero if the energy falls below a threshold, so that harmon2, harmon3, harmon4 can be set to pass the direct signal in both cases. Of course, any other form of pitch estimation could also be used. Since pitch trackers usually incur a slight delay for accurate estimation (for specptrk the delay is printed by the spectrum unit), it is normal to delay the audio signal by the same amount so that harmon2, harmon3, harmon4 can work from a fully concurrent estimate.

## Examples

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

Example 213. Example of the harmon2 opcode.

    a1,a2	ins						; get mic input
    w1	spectrum 	a1, .02, 7, 24, 12, 1, 3	; and examine it
    koct,kamp	specptrk  	w1, 1, 6.5, 9.5, 7.5, 10, 7, .7, 0, 3, 1
    a3	delay		a1, .065			; allow for ptrk delay
    a4	harmon2		a3, koct, 1.25, 0.75, 0, 6.9	; output a fixed 6-4 harmony
    	outs		a3, a4				; as well as the original

## Credits

Author: Barry L. Vercoe
M.I.T., Cambridge, Mass
2006

Prev | Up | Next
harmon | Home | hilbert