ATSread — reads data from an ATS file.


ATSread returns the amplitude (kamp) and frequency (kfreq) information of a user specified partial contained in the ATS analysis file at the time indicated by the time pointer ktimepnt.


kfreq, kamp ATSread ktimepnt, iatsfile, ipartial


iatsfile – the ATS number (n in ats.n) or the name in quotes of the analysis file made using ATS.

ipartial – the number of the analysis partial to return the frequency in Hz and amplitude.


kfreq, kamp - outputs of the ATSread unit. These values represent the frequency and amplitude of a specific partial selected by the user using ipartial. The partials' informations are derived from an ATS analysis. ATSread linearly interpolates the frequency and amplitude between frames in the ATS analysis file at k-rate. The output is dependent on the data in the analysis file and the pointer ktimepnt.

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


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

Example 64. Example of the ATSread opcode.

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

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

instr 1	; "beats.ats" is created by atsa

ktime	line    0, p3, 2
kfreq, kamp	ATSread  ktime, "beats.ats", 100
aout	oscili  0.8, kfreq, 1
	outs	aout, aout

;sine wave.
f 1 0 16384 10 1

i 1 0 2 


Here we're using ATSread to get the 100th partial's frequency and amplitude data out of the 'beats.ats' ATS analysis file. We're using that data to drive an oscillator, but we could use it for anything else that can take a k-rate input, like the bandwidth and resonance of a filter etc.

See also

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


Author: Alex Norman