kfreq, kamp atsread ktimepnt, ifile, ipartial kenergy atsreadnz ktimepnt, ifile, iband
atsread and atsreadnz read 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. atsreadnz returns the energy (kenergy) of a user specified noise band (1-25 bands) at the time indicated by the time pointer ktimepnt.
ifile – the ATS number (n in ats.n) or the name in quotes of the analysis file made using ATS.
ipartial / iband – the number of the analysis partial to return the frequency in Hz and amplitude (in the case of atsread) or the number of the noise band to return the energy data (in the case of atsreadnz).
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; this happens at the k-rate. The output is dependent on the data in the analysis file and the ktimepnt.
kenergy – output of the atsreadnz unit. At the k-rate the linearly interpolated energy of the noise band indicated in iband is output. The output is dependent on the data in the analysis file and the ktimepnt.
ktimepnt – used for atsread and atsreadnz exactly the same as for pvoc and atsadd.
ktime line 0, p3, 2.5 kfreq, kamp atsread ktime, "clarinet.ats", 2 aout oscili 1000000 * kamp, kfreq, 1
Here we're using atsread to get the 2nd partial's frequency and amplitude data out of the clarinet.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.2.
ktime line 2.5, p3, 0 kenergy atsreadnz ktime, "clarinet.ats", 5
Here we are extracting the noise energy from band 5 in the clarinet.ats ATS analysis file. We're actually reading backwards from 2.5 seconds to the beginning of the analysis file. We could use this to synthesize noise like this:
anoise randi sqrt(kenergy), 55 aout oscili 4000000000000000000000000, 455, 2 aout = aout * anoise
Function table 2 used in the oscillator is a cosine, which is needed to shift the band limited noise into the correct place in the frequency spectrum. The randi function creates a band of noise centered about 0 Hz that has a bandwidth of about 110 Hz; multiplying it by a cosine will shift it to be centered at 455 Hz, which is the center frequency of the 5th critical noise band. This is only an example, for synthesizing the noise you'd be better off just using atsaddnz unless you want to use your own noise synthesis algorithm. Maybe you could use the noise energy for something else like applying a small amount of jitter to specific partials or for controlling something totally unrelated to the source sound?
Alex Norman (edited from Richard Karpen's pvread documentation)