ATSaddnz

ATSaddnz — uses the data from an ATS analysis file to perform noise resynthesis.

Description

ATSaddnz reads from an ATS analysis file and uses the data to perform additive synthesis using a modified randi function.

Syntax

ar ATSaddnz ktimepnt, iatsfile, ibands[, ibandoffset, ibandincr]

Initialization

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

ibands – number of noise bands that will be used in the resynthesis (the noise has a maximum of 25 bands)

ibandoffset (optional) – is the first noise band used (defaults to 0).

ibandincr (optional) – sets an increment by which these synthesis opcodes counts up from ibandoffset 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 ATSaddnz exactly the same as for pvoc and ATSadd.

ATSaddnz and ATSadd are based on pvadd by Richard Karpen and use files created by Juan Pampin's ATS (Analysis - Transformation - Synthesis).

ATSaddnz also reads from an ATS file but it resynthesizes the noise from noise energy data contained in the ATS file. It uses a modified randi function to create band limited noise and modulates that with a cosine wave, to synthesize a user specified selection of frequency bands. Modulating the noise is required to put the band limited noise in the correct place in the frequency spectrum.

Examples

  ktime line     0, p3, 2.5
  asig  ATSaddnz ktime, "clarinet.ats", 25
        

In the example above we are synthesizing all 25 noise bands from the data contained in the ATS analysis file called "clarinet.ats".

Here is a complete example of the ATSaddnz opcode. It uses the file ATSaddnz.csd.

Example 72. Example of the ATSaddnz 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 ATSaddnzwav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; by Menno Knevel - 2021

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

;ATSA wants a mono file!
ires system_i 1,{{ atsa beats.wav beats.ats }} ; default size

instr 1	

ktime	line     0, p3, p3
asig	ATSaddnz ktime, "beats.ats", 1, 4   ; only 1 noise band, the 4th noise band
	outs	asig*6, asig*6	;amplify
endin

</CsInstruments>
<CsScore>
i1 0 2 
e
</CsScore>
</CsoundSynthesizer>


Here is another example of the ATSaddnz opcode. It uses the file ATSaddnz-2.csd.

Example 73. Example 2 of the ATSaddnz opcode.

<CsoundSynthesizer>
<CsOptions>
-odac -d -m1
</CsOptions>
<CsInstruments>
;example by joachim heintz (& Menno Knevel)
sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

;ATSA wants a mono file!
ires system_i 1,{{ atsa -h.1 -c1 fox.wav fox.ats }} ; only 1 cycle and small hop size

instr AllTheNoise
Sfile    =        "fox.ats"
         prints   "Resynthesizing with all the noise.\n"
iDur     ATSinfo  Sfile, 7
p3       =        iDur
ktime    line     0, iDur, iDur
asig     ATSaddnz ktime, Sfile, 25
         outs     asig, asig

;start next instr
         event_i  "i", "NoiseInBandsOfFive", iDur+1, 1, 0
endin

instr NoiseInBandsOfFive
Sfile    =        "fox.ats"
         prints   "Resynthesizing with noise bands %d - %d.\n", p4, p4+5
iDur     ATSinfo  Sfile, 7
p3       =        iDur
ktime    line     0, iDur, iDur
asig     ATSaddnz ktime, Sfile, 5, p4
         outs     asig, asig

;start next instr
if p4 < 20 then
         event_i  "i", "NoiseInBandsOfFive", iDur+1, 1, p4+5
endif
endin
</CsInstruments>
<CsScore>
i "AllTheNoise" 0 1
e 25
</CsScore>
</CsoundSynthesizer>


See also

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

Credits

Author: Alex Norman
Seattle,Washington
2004