~ atsinfo Signal Generators: STFT Resynthesis (Vocoding)

atsinfo

 idata      atsinfo      iatsfile, ilocation

Description

atsinfo reads data out of the header of an ATS file.

Initialization

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

ilocation – indicates which location in the header file to return. The data in the header gives information about the data contained in the rest of the ATS file. The possible values for ilocation are given in the following list:

  1. Sample rate (Hz)
  2. Frame Size (samples)
  3. Window Size (samples)
  4. Number of Partials
  5. Number of Frames
  6. Maximum Amplitude
  7. Maximum Frequency (Hz)
  8. Duration (seconds)
  9. ATS file Type

Performance

Macros can really improve the legibility of your csound code, I've provided my Macro Definitions below:

	#define ATS_SAMP_RATE #0#
	#define ATS_FRAME_SZ #1#
	#define ATS_WIN_SZ #2#
	#define ATS_N_PARTIALS #3#
	#define ATS_N_FRAMES #4#
	#define ATS_AMP_MAX #5#
	#define ATS_FREQ_MAX #6#
	#define ATS_DUR #7#
	#define ATS_TYPE #8#

atsinfo can be useful for writing generic instruments that will work with many ATS files, even if they have different lengths and different numbers of partials etc. Example 2 is a simple application of this.

Examples

1.
  imax_freq	atsinfo "cl.ats", $ATS_FREQ_MAX

In the example above we get the maximum frequency value from the ATS file "cl.ats" and store it in imax_freq. We use at Csound Macro (defined above) $ATS_FREQ_MAX, which is equivalent to the number 6

2.
  i_npartials	atsinfo p4, $ATS_N_PARTIALS
  i_dur		atsinfo p4, $ATS_DUR
  ktimepnt	line 0, p3, i_dur
  aout		atsadd ktimepnt, 1, p4, 1, i_npartials

In the example above we use atsinfo to retrieve the duration and number of partials in the ATS file indicated by p4. With this info we synthesize the partials using atsadd. Since the duration and number of partials are not "hard-coded" we can use this code with any ats file.

Author

Alex Norman
Seattle, Washington
2004