Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Physical modeling synthesis

Date2009-03-29 00:48
From" Partev Barr Sarkissian"
Subject[Csnd] Re: Physical modeling synthesis
Duhh,... set ksmps=1, Thank you Victor. Why didn't I 
think of that. No wonder my feedback loops never work.
How is that for patches with cross-correlation signal 
lines? Like out of a filter on one line, cross-correlating
with the input of a filter on another line?

Also, check out the Stanford University website and 
the work on Physical Modeling by Julius Orion Smith III, PhD
and CCRMA.

Thank you Victor,
-Partev
(hoist a pint of Guiness for me, will you?)



=========================================================================
==================================================================



From:  	Victor.Lazzarini@nuim.ie
Reply-To:  	csound@lists.bath.ac.uk
To:  	csound@lists.bath.ac.uk
Subject:  	[Csnd] Re: Physical modeling synthesis
Date:  	Sat 03/28/09 11:34 AM

	 
if you want to use a variable as input before it gets filled, initialise it first.
Say you want to do an allpass filter in direct form

ayprev init 0
axprev init 0

...

ay = axprev - icoef*(ax + ayprev)
axprev = ax
ayprev = ay

Also, don't forget to set ksmps = 1 too, if you are
using feedback (as above). This can be done in a UDO with

setksmps 1 

without forcing all instruments to use 1-sample blocks.

Victor

----- Original Message -----
From: Aki Laaksovirta 
Date: Saturday, March 28, 2009 7:04 pm
Subject: [Csnd] Physical modeling synthesis
To: csound@lists.bath.ac.uk

> I have recently tried to establish some bidirectional delay 
> lines, but Csound always only replies that "***** used before 
> defined." So, my suggestion would be that the orchestra be split 
> up in two parts: first one, which describes the needed opcodes, 
> and second one, which describes the connections between the 
> opcodes. Would that sound fair?
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body 
> "unsubscribe csound"

Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth




_____________________________________________________________
Netscape.  Just the Net You Need.

Date2009-03-29 06:53
FromGraham Breed
Subject[Csnd] Re: Re: Physical modeling synthesis
  Partev Barr Sarkissian wrote:
> Duhh,... set ksmps=1, Thank you Victor. Why didn't I 
> think of that. No wonder my feedback loops never work.
> How is that for patches with cross-correlation signal 
> lines? Like out of a filter on one line, cross-correlating
> with the input of a filter on another line?

You don't have to use ksmps=1.  You can use delayr and 
delayw (with deltapi for fine tuning).  There is still a 
constraint on ksmps but it isn't as strict.  It isn't clear 
in my mind now where that comes from.  It's related to the 
highest note you play.  The delay has to be at least one 
control rate, maybe?  You can set the control rate locally 
so that it doesn't bog down the whole orchestra.

I don't know about your cross-correlations.  delayr and 
delayw are supposed to nest.  Good luck!


                   Graham


Date2009-03-29 09:21
FromVictor.Lazzarini@nuim.ie
Subject[Csnd] Re: Re: Re: Physical modeling synthesis
AttachmentsNone  None  

Date2009-03-29 11:59
FromGraham Breed
Subject[Csnd] Re: Re: Re: Re: Physical modeling synthesis
Victor.Lazzarini@nuim.ie wrote:
> No, for 1-sample delays and waveguide stuff you
> do need ksmps=1. It will not work otherwise.

I don't know about 1-sample delays and I didn't see that 
up-thread.  If they require ksmps=1 it should be documented 
here:

http://www.csounds.com/manual/html/delay1.html

Waveguides must work because I have them working.  I am 
having trouble with clicks, and if that's because of the 
control rate you'll have to explain why.  The code's below.

; based on the example in The Csound Book Chapter 19
         opcode  ClarinetTimbre, a, aiaa
; aamp:    amplitude
; ifqc:   frequency
; apressm: breath pressure
; aemboff: SUPPOSEDLY HAS SOMETHING TO DO WITH REED STIFFNESS?
aamp, ifqc, apressm, aemboff xin

         setksmps        sr/2100
; valid for sr=44100 and kr=210

ifco    =       1000
; calibration for 44.1 kHz sample rate and 2.1 kHz local 
control rate
; not perfect tuning and no indication it'll work for other 
sample rates
ibore   =       0.5/ifqc-5.6/sr
areedbell       delayr  ibore + 1/sr
areedbell       deltapi         ibore ; sub-sample accuracy

;       REFLECTION FILTER FROM THE BELL IS LOWPASS
arefilt tone    areedbell, ifco

;       REFLECTION FILTER FROM THE BELL IS LOWPASS
arefilt tone    areedbell, ifco

;       BACK PRESSURE AND REED TABLE LOOK UP
aout    =       - apressm -.95*arefilt - aemboff
areedtab        table   aout/4+.34, gi_reed_table, 1, .5
amult   =       aout * areedtab

;       FORWARD PRESSURE
aout    =       apressm + amult

         delayw  aout
         xout    aout*aamp
         endop



Date2009-03-29 13:52
Fromvictor
Subject[Csnd] Re: Re: Re: Re: Re: Physical modeling synthesis
Strictly speaking a simple waveguide implemented with delayw/r will require
ksmps < sr/fr; the example below demonstrates this. It does not work for
ksmps=64, but lower ksmps will do. However, it we are implementing
a waveguide with some sort of dampening, then filters are involved in the
feedbac loop and we will need ksmps=1 to make a proper mathematically
sound implementation.

As a rule of thumb, whenever we need feedback, setting ksmps=1 is a good
measure, as this avoids any possible implementation problems.





sr= 44100
ksmps = 64
nchnls = 1
0dbfs=1

instr 1
ifr = cpspch(p4)
kamp linseg 1, 1/ifr,0.001
asig rand kamp
adp delayr 1
atap deltapi 1/ifr
     delayw  asig+atap*0.999
      out atap*0.5
endin



f1 0 16384 10 1
i1 0 3 9.05



----- Original Message ----- 
From: "Graham Breed" 
To: 
Sent: Sunday, March 29, 2009 11:59 AM
Subject: [Csnd] Re: Re: Re: Re: Physical modeling synthesis


> Victor.Lazzarini@nuim.ie wrote:
>> No, for 1-sample delays and waveguide stuff you
>> do need ksmps=1. It will not work otherwise.
>
> I don't know about 1-sample delays and I didn't see that up-thread.  If 
> they require ksmps=1 it should be documented here:
>
> http://www.csounds.com/manual/html/delay1.html
>
> Waveguides must work because I have them working.  I am having trouble 
> with clicks, and if that's because of the control rate you'll have to 
> explain why.  The code's below.
>
> ; based on the example in The Csound Book Chapter 19
>         opcode  ClarinetTimbre, a, aiaa
> ; aamp:    amplitude
> ; ifqc:   frequency
> ; apressm: breath pressure
> ; aemboff: SUPPOSEDLY HAS SOMETHING TO DO WITH REED STIFFNESS?
> aamp, ifqc, apressm, aemboff xin
>
>         setksmps        sr/2100
> ; valid for sr=44100 and kr=210
>
> ifco    =       1000
> ; calibration for 44.1 kHz sample rate and 2.1 kHz local control rate
> ; not perfect tuning and no indication it'll work for other sample rates
> ibore   =       0.5/ifqc-5.6/sr
> areedbell       delayr  ibore + 1/sr
> areedbell       deltapi         ibore ; sub-sample accuracy
>
> ;       REFLECTION FILTER FROM THE BELL IS LOWPASS
> arefilt tone    areedbell, ifco
>
> ;       REFLECTION FILTER FROM THE BELL IS LOWPASS
> arefilt tone    areedbell, ifco
>
> ;       BACK PRESSURE AND REED TABLE LOOK UP
> aout    =       - apressm -.95*arefilt - aemboff
> areedtab        table   aout/4+.34, gi_reed_table, 1, .5
> amult   =       aout * areedtab
>
> ;       FORWARD PRESSURE
> aout    =       apressm + amult
>
>         delayw  aout
>         xout    aout*aamp
>         endop
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"