ATScross

ATScross — perform cross synthesis from ATS analysis files.

Description

ATScross uses data from an ATS analysis file and data from an ATSbufread to perform cross synthesis.

Syntax

ar ATScross ktimepnt, kfmod, iatsfile, ifn, kmylev, kbuflev, ipartials \
          [, ipartialoffset, ipartialincr]

Initialization

iatsfile – integer or character-string denoting a control-file derived from ATS analysis of an audio signal. An integer denotes the suffix of a file ATS.m; a character-string (in double quotes) gives a filename, optionally a full pathname. If not full-path, the file is sought first in the current directory, then in the one given by the environment variable SADIR (if defined).

ifn – table number of a stored function containing a sine wave.

ipartials – number of partials that will be used in the resynthesis

ipartialoffset (optional) – is the first partial used (defaults to 0).

ipartialincr (optional) – sets an increment by which these synthesis opcodes counts up from ipartialoffset for ibins components in the re-synthesis (defaults to 1).

Performance

ktimepnt – The time pointer in seconds used to index the ATS file. Used for ATScross exactly the same as for pvoc.

kfmod – an input for performing pitch transposition or frequency modulation on all of the synthesized partials, if no fm or pitch change is desired then use a 1 for this value.

kmylev - scales the ATScross component of the frequency spectrum applied to the partials from the ATS file indicated by the ATScross opcode. The frequency spectrum information comes from the ATScross ATS file. A value of 1 (and 0 for kbuflev) gives the same results as ATSadd.

kbuflev - scales the ATSbufread component of the frequency spectrum applied to the partials from the ATS file indicated by the ATScross opcode. The frequency spectrum information comes from the ATSbufread ATS file. A value of 1 (and 0 for kmylev) results in partials that have frequency information from the ATS file given by the ATScross, but amplitudes imposed by data from the ATS file given by ATSbufread.

ATScross uses data from an ATS analysis file (indicated by iatsfile) and data from an ATSbufread to perform cross synthesis. ATScross uses ktimepnt, kfmod, ipartials, ipartialoffset and ipartialincr just like ATSadd. ATScross synthesizes a sine-wave for each partial selected by the user and uses the frequency of that partial (after scaling in frequency by kfmod) to index the table created by ATSbufread. Interpolation is used to get in-between values. ATScross uses the sum of the amplitude data from its ATS file (scaled by kmylev) and the amplitude data gained from an ATSbufread (scaled by kbuflev) to scale the amplitude of each partial it synthesizes. Setting kmylev to one and kbuflev to zero will make ATScross act exactly like ATSadd. Setting kmylev to zero and kbuflev to one will produce a sound that has all the partials selected by the ATScross ugen, but with amplitudes taken from an ATSbufread. The time pointers of the ATSbufread and ATScross do not need to be the same.

Examples

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

Example 61. Example of the ATScross opcode.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;RT audio out
;-iadc    ;;;uncomment -iadc for RT audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o ATScross.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1	; "beats.ats" and  "fox.ats" are created by atsa

ktime	line	0, p3, 4
ktime2	line	0, p3, 4
kline	expseg	0.001, .3, 1, p3-.3, 1
kline2	expseg	0.001, p3, 3
  	ATSbufread ktime2, 1, "fox.ats", 20
aout	ATScross   ktime, 2, "beats.ats", 1, kline, 0.001 * (4 - kline2), 180
	outs aout*2, aout*2

endin

</CsInstruments>
<CsScore>
; sine wave.
f 1 0 16384 10 1

i 1 0 4 
e
</CsScore>
</CsoundSynthesizer>


This example performs cross synthesis using two ATS-files, "fox.ats" and "beats.ats". The result of this will be a sound that starts out with the shape (in frequency) of fox.ats, and ends with the shape of beats.ats. All the sine-wave frequencies come from beats.ats. The kbuflev value is scaled because the energy produced by applying fox.ats's frequency spectrum to beats.ats's partials is very large. Notice also that the time pointers of the ATSbufread (fox.ats) and ATScross (beats.ats) need not have the same value, this way you can read through the two ATS files at different rates.

See also

ATSread, ATSreadnz, ATSinfo, ATSsinnoi, ATSbufread, ATSinterpread, ATSpartialtap, ATSadd, ATSaddnz

Credits

Author: Alex Norman
Seattle,Washington
2004