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 76. 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

; by Menno Knevel - 2023

;ATSA wants a mono file!
;it takes a while to analyze these files...
ires1 system_i 1,{{ atsa finneganswake1.flac finneganswake.ats }} 
prints "\n***1st analyzed file is ready***\n\n"

ires2 system_i 1,{{ atsa drumsMlp.wav drumsMlp.ats }} 
prints "\n***2nd analyzed file is ready***\n\n"


instr 1
ires1 ATSinfo "finneganswake.ats", 3                  ; get number of partials
ires2 ATSinfo "drumsMlp.ats", 3                  ; get number of partials
prints "\n***number of partials of finneganswake.ats = %d***\n\n", ires1
prints "\n***number of partials of drumsMlp.ats = %d***\n\n", ires2
ktime1	line	0, p3, 12.67
ktime2	line	0, p3, 2
kline	line    p4, p3, p5                            
        ATSbufread ktime1, 1, "finneganswake.ats", ires1
aout	ATScross   ktime2, 1, "drumsMlp.ats", 1, kline, 1, 68 ; cross from p4 to p5
	outs aout*2.5, aout*2.5

endin

</CsInstruments>
<CsScore>
; sine wave.
f 1 0 16384 10 1
;          start    end
i 1 0 12.7   0       1 ; voice --> drums
i 1 15 12.7  1       0 ; drums --> voice
e
</CsScore>
</CsoundSynthesizer>


See also

ATS Spectral Processing

Credits

Author: Alex Norman
Seattle,Washington
2004