ATSsinnoi

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

Description

ATSsinnoi reads data from an ATS data file and uses the information to synthesize sines and noise together.

Syntax

ar ATSsinnoi ktimepnt, ksinlev, knzlev, kfmod, iatsfile, ipartials \
          [, ipartialoffset, ipartialincr]

Initialization

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

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

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 ATSsinnoi exactly the same as for pvoc.

ksinlev - controls the level of the sines in the ATSsinnoi ugen. A value of 1 gives full volume sinewaves.

knzlev - controls the level of the noise components in the ATSsinnoi ugen. A value of 1 gives full volume noise.

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.

ATSsinnoi reads data from an ATS data file and uses the information to synthesize sines and noise together. The noise energy for each band is distributed equally among each partial that falls in that band. Each partial is then synthesized, along with that partial's noise component. Each noise component is then modulated by the corresponding partial to be put in the correct place in the frequency spectrum. The level of the noise and the partials are individually controllable. An ATS analysis differs from a pvanal in that ATS tracks the partials and computes the noise energy of the sound being analyzed. For more info about ATS analysis read Juan Pampin's description on the the ATS web-page.

Examples

  ktime   line       0, p3, 2.5
  asig    ATSsinnoi  ktime, 1, 1, 1, "beats.ats", 42

Here we synthesize both the noise and the sinewaves (all 42 partials) contained in "beats.ats" together. The relative volumes of the noise and the partials are unaltered (each set to 1).

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

Example 83. Example of the ATSsinnoi opcode.

<CsoundSynthesizer>
<CsOptions>
; 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 ATSsinnoi.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; by Menno Knevel - 2021

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

ires1 system_i 1,{{ atsa -h.5 -c1 drumsMlp.wav drumsMlp1.ats }}
ires2 system_i 1,{{ atsa  drumsMlp.wav drumsMlp2.ats }} ; default settings -h.25 -c4
 

instr 1	

ktime	line	0,  p3, 2

aout	ATSsinnoi 	ktime, 1, 1, 1, p4, p5
	outs	aout*.4, aout*.4		
endin

</CsInstruments>
<CsScore>
s
;			atsfile		partial
i 1 0 2 "drumsMlp1.ats"		3
i 1 3 2 "drumsMlp2.ats"		3
s
i 1 0 2 "drumsMlp1.ats"		13
i 1 3 2 "drumsMlp2.ats"		13
s
i 1 0 2 "drumsMlp1.ats"		30
i 1 3 2 "drumsMlp2.ats"		30

e
</CsScore>
</CsoundSynthesizer>

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

Example 84. Example 2 of the ATSsinnoi opcode.

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

ires system_i 1,{{ atsa fox.wav fox.ats }} ; default settings

giSine    ftgen     0, 0, 1024, 10, 1
gSfile    =         "fox.ats"
giNumParts ATSinfo  gSfile, 3 ;overall number of partials
giDur     ATSinfo   gSfile, 7 ;duration 
          seed      0
          

  instr PlayList
event_i "i", "PlayAll", 0, 1, 1, 0, .5 ;sine only, half speed
event_i "i", "PlayAll", giDur*2+1, 1, 0, 1, .5 ;noise only
event_i "i", "PlayAll", giDur*4+2, 1, .5, .5, .5 ;half sine, half noise
  endin

  instr PlayAll
iSinAmnt  =         p4 ;sinee amount (0-1)
iNzAmnt   =         p5 ;noise amount (0-1)
iSpeed    =         p6 ;speed
p3        =         giDur/iSpeed
ktime     line      0, giDur/iSpeed, giDur
          prints    "Resynthesizing all partials with tone = %.1f and noise = %.1f.\n", iSinAmnt, iNzAmnt
aOut      ATSsinnoi ktime, iSinAmnt, iNzAmnt, 1, gSfile, giNumParts
          outs      aOut, aOut
  endin

  instr PlayBand
iOffset   =         p4 ;offset in partials
iSpeed    =         p5 ;speed
p3        =         giDur/iSpeed
ktime     line      0, giDur/iSpeed, giDur
          prints    "Resynthesizing partials %d to %d with related noise.\n", iOffset+1, iOffset+10
aOut      ATSsinnoi ktime, 1, .3, 1, gSfile, 10, iOffset, 1 ; a bit less noise (.3)
          outs      aOut*2, aOut    ; left channel a bit louder
;call itself again
 if iOffset < giNumParts - 20 then
          event_i   "i", "PlayBand", giDur/iSpeed+1, 1, iOffset+10, iSpeed
 endif
  endin

  instr PlayWeighted
  ;sine amount, noise amount and speeed are varying
kSinAmnt  randomi   0, 1, 1, 3
kNzAmnt   =         1-kSinAmnt
kSpeed    randomi   .01, .3, 1, 3
async     init      0
atime, aEnd syncphasor kSpeed/giDur, async
kTrig     metro     100
kEnd      max_k     aEnd, kTrig, 1 ;1 if phasor signal crosses zero
ktime     downsamp  atime
aOut      ATSsinnoi ktime*giDur, kSinAmnt, kNzAmnt, 1, gSfile, giNumParts
          outs      aOut*.6, aOut   ; pan a bit to the right
  ;exit if file is at the end 
if kEnd == 1 then
           event     "e", 0, 0
endif

endin

</CsInstruments>
<CsScore>
i "PlayList" 0 1
i "PlayBand" 20 1 0 .5
i "PlayWeighted" 110 100
</CsScore>
</CsoundSynthesizer>


See also

ATS Spectral Processing

Credits

Author: Alex Norman
Seattle,Washington
2004