Csound Csound-dev Csound-tekno Search About

[Csnd] ++SPAM++ CONFLICT BETWEEN DISKGRAIN AND PVSPITCH?

Date2009-06-18 19:48
FromBruce McKinney
Subject[Csnd] ++SPAM++ CONFLICT BETWEEN DISKGRAIN AND PVSPITCH?
I have been attempting to call a diskgrain instrument in real-time from an instrument that
uses the pvsanal and pvspitch opcodes to analyse an incoming audio signal and then
eventually send it to the called instrument using diskgrain. In the example below, I
have simplified everything in my attempt to find out what is not working. The called instrument,
i 5, uses the CSound manual example verbatim, which works--obviously, I have substituted my
own sound file. However, when I include the line of code :

k1, k2 pvspitch f1, kthresh; in the calling instrument, the diskgrain output includes
a second invariant pitch. The pitch changes based on my choices for ksmps or overlap
in the pvsanal, but I can not get rid of it.

Is there some way in which it is not possible to use these two opcodes in this manner,
or am I doing something stupid!

Looking foward to suggestions.comments

Bruce M

the .csd in question is:




-odac0 -iadc0 -d -b128 -B192 -3 -+rtaudio=CoreAudio ;




sr = 44100
ksmps = 64
nchnls = 2

instr 1

koldtime init .50
kp4 init 1
kp5 init 1

kmymintime init 2.5; 2 ;.25
ktrigger init 0

gktimei4 timeinsts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INPUT SOUND ANALYSED::::::::::::::::

kthresh= .021;

a98 inch 1
f1 pvsanal a98, 512,256,1024,0;; this is bruce !!!

k1, k2 pvspitch f1, kthresh; kthresh 0-1 NB: COMMENTING OUT THIS LINE
; MAKES EVERYTTHING WORK, k1 k2 SOMEHOW CREATE A PROMINANT
; ADDITIONAL FREQUENCY IN THE SOUND. TO ME THE SOUND IS SIMILIAR TO
; WHAT HAPPENS WHEN A GLOBAL A VARIABLE THAT IS PART OF A REVERB
; INSTRUMENT IS NOT ZEROED OUT.

kmytime = gktimei4

; gkfrq1 port k1, 0.001 ; smooth freq was 0051
; gkamp1 port k2, 0.001 ; smooth amp

if ( kmytime-koldtime

f 1 0 8192 20 1 1

i1 0 600

e



Date2009-06-18 22:50
FromRichard Dobson
Subject[Csnd] Re: ++SPAM++ CONFLICT BETWEEN DISKGRAIN AND PVSPITCH?
Those analysis window sizes (and 50% overlap - the absolute minimum 
possible) are rather small - have you tried larger ones (e.g. 1024, 256, 
1024 or 2048)? Unless the source pitch is fairly high (say over 400Hz), 
any pitch-tracker will struggle to resolve things, as the whole bass 
register is covered by only a handful of bins.

Richard Dobson


Bruce McKinney wrote:
> I have been attempting to call a diskgrain instrument in real-time from 
> an instrument that
> uses the pvsanal and pvspitch opcodes to analyse an incoming audio 
> signal and then
> eventually send it to the called instrument using diskgrain. In the 
> example below, I
> have simplified everything in my attempt to find out what is not 
> working. The called instrument,
> i 5, uses the CSound manual example verbatim, which works--obviously, I 
> have substituted my
> own sound file. However, when I include the line of code :
> 
> k1, k2 pvspitch f1, kthresh; in the calling instrument, the diskgrain 
> output includes
> a second invariant pitch. The pitch changes based on my choices for 
> ksmps or overlap
> in the pvsanal, but I can not get rid of it.
> 
> Is there some way in which it is not possible to use these two opcodes 
> in this manner,
> or am I doing something stupid!
..
> 
> sr = 44100
> ksmps = 64
> nchnls = 2
..
> f1 pvsanal a98, 512,256,1024,0;; this is bruce !!!
>