| Here is one way that I have gotten spectral UGs to help
with pitch tracking:
;While this is not a complete .orc file, it represents the heart of a
;pitch-tracking instrument that reads input and spectrally extracts
;the fundamental using octdown, noctdft, specsum, and specptrk.
;William Kleinsasser
;Towson University
;Baltimore, MD
;--------------------------------------------------------------------------
;INITIALIZE VARIABLES
;--------------------------------------------------------------------------
;SET MANUALLY:
ianalperiod = .01 ;set period for spectral
analysis
ianalsamps = ianalperiod*sr ;set number of samples in
spectral anal
;FROM SCORE:
ipartialcount = p4 ;number of partials for analysis (from score)
inum = p5 ;soundfile id number (from score)
;--------------------------------------------------------------------------
;READ SOUNDFILE IN (mono)
;--------------------------------------------------------------------------
;.5 = octave down, 2 = octave up, etc.
;(use ; to comment-out the options you do not wish to use)
; asig soundin inum ;read soundfile "inum"
; OR
asig soundin "soundfile_name";read soundfile "file name"
; OR
; asig in ;real-time sound input from ADC
;--------------------------------------------------------------------------
;ANALYZE THE SPECTRUM
;--------------------------------------------------------------------------
;downsample in 6 octaves:
dsamp octdown asig,6,ianalsamps,0
;calculate 72-point dft (dB):
wsig noctdft dsamp,ianalperiod,12,33,1,1,1
;sum the spec bins, and ksmooth:
ksum specsum wsig, 1
;analyze for pitch-tracking:
koct specptrk wsig, ipartialcount, .8, 0
;set kpitch to = the tracked pitch in cpsoct mode:
kpitch =
cpsoct(koct)
;**************
On Thu, 26 Jun 1997, Mike Berry wrote:
> The spectral operators, as far as I know, don't do anything,
> other than supply each other with data. They do not interact in any way
> with other csound opcodes. So you can't use them to in the way you are
> describing.
>
> Mike Berry
|