[Csnd] Karplus-Strong instrument using deltapx
Date | 2013-03-08 07:34 |
From | Forrest Cahoon |
Subject | [Csnd] Karplus-Strong instrument using deltapx |
I'm starting to work with precise intonation again, and I'm following up on something Steven Yi said back in this thread: http://csound.1045644.n5.nabble.com/Where-do-these-beat-frequencies-come-from-td5478171.html#a5481118 At the time I thought Steven's suggestion meant writing new plucked-string opcodes in C which would be more precisely tuned, but now when I look back I realize I should be able to design a Karplus-Strong instrument entirely in Csound using deltapx to specify the delay line, and (hopefully) get the pitch precision I'm after without diving into internals. |
Date | 2013-03-08 17:23 |
From | Russell Pinkston |
Subject | RE: [Csnd] Karplus-Strong instrument using deltapx |
Here is a CSD with some example “roll your own” Karplus-Strong instruments I made for my Csound class: http://ems.music.utexas.edu/dwnld/classcsd/karplus2.csd They don’t use deltapx, but they could, easily enough. Hope they are helpful. From: Forrest Cahoon
[mailto:forrest.cahoon@gmail.com] I'm starting to work with precise intonation again, and I'm following up on something Steven Yi said back in this thread: http://csound.1045644.n5.nabble.com/Where-do-these-beat-frequencies-come-from-td5478171.html#a5481118 At the time I thought Steven's suggestion meant writing new plucked-string opcodes in C which would be more precisely tuned, but now when I look back I realize I should be able to design a Karplus-Strong instrument entirely in Csound using deltapx to specify the delay line, and (hopefully) get the pitch precision I'm after without diving into internals. However, I'm having trouble putting an instrument like that together -- still a bit confused about how deltapx is actually supposed to work -- and I thought I'd appeal to the list to see if I could get some help. |
Date | 2013-03-09 17:01 |
From | Forrest Cahoon |
Subject | Re: [Csnd] Karplus-Strong instrument using deltapx |
On Fri, Mar 8, 2013 at 11:23 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote:
Thanks, Russell! Since these examples use delayr/delayw they are very close to what I need. I remember reading somewhere that the tone LPF opcode introduces a delay, and for precise tuning the delay introduced by tone has to be subtracted from the length of the Karplus-Strong delay line in order to compensate. So I think your instruments may be off a little bit from their advertised frequencies -- much more than the subsample differences in delay I'm currently worried about. I can't find the reference to where I read that; it was a K/S example that was online years ago. Does anyone know about this? I suppose I will be able to find the value empirically, since the delay was a specific whole number of samples, but it would be nice if someone who actually knows could weigh in. |
Date | 2013-03-09 18:22 |
From | Russell Pinkston |
Subject | RE: [Csnd] Karplus-Strong instrument using deltapx |
Tone is a very simple, first order recursive filter. It would only introduce 1 sample of delay. From: Forrest Cahoon
[mailto:forrest.cahoon@gmail.com] On Fri, Mar 8, 2013 at 11:23 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote:
Thanks, Russell! Since these examples use delayr/delayw they are very close to what I need. I remember reading somewhere that the tone LPF opcode introduces a delay, and for precise tuning the delay introduced by tone has to be subtracted from the length of the Karplus-Strong delay line in order to compensate. So I think your instruments may be off a little bit from their advertised frequencies -- much more than the subsample differences in delay I'm currently worried about. I can't find the reference to where I read that; it was a K/S example that was online years ago. Does anyone know about this? I suppose I will be able to find the value empirically, since the delay was a specific whole number of samples, but it would be nice if someone who actually knows could weigh in. |
Date | 2013-03-09 18:43 |
From | Justin Smith |
Subject | Re: [Csnd] Karplus-Strong instrument using deltapx |
A recursive filter is IIR, and IIR filters introduce frequency dependent delay, meaning that while there may be strictly N samples of delay, it will effectively delay each sinusoidal partial by a different number of samples (some more and some less than the nominal delay size of the filter). I don't know how a delay on input that varies with spectrum interacts with Karplus-Strong though - Karplus-Strong is itself effectively a special case of an (unstable?) IIR filter IIRC.
On Sat, Mar 9, 2013 at 10:22 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote:
|
Date | 2013-03-09 23:51 |
From | Russell Pinkston |
Subject | RE: [Csnd] Karplus-Strong instrument using deltapx |
I think the 1 sample of actual delay is what’s important in this case, because the whole idea of K/S is that the length of the delay line is what determines the fundamental frequency of the “pluck.” So it seems to me that the one extra sample in the delay loop shouldn’t be significant. From: Justin Smith
[mailto:noisesmith@gmail.com] A recursive filter is IIR, and IIR filters introduce frequency dependent delay, meaning that while there may be strictly N samples of delay, it will effectively delay each sinusoidal partial by a different number of samples (some more and some less than the nominal delay size of the filter). I don't know how a delay on input that varies with spectrum interacts with Karplus-Strong though - Karplus-Strong is itself effectively a special case of an (unstable?) IIR filter IIRC. On Sat, Mar 9, 2013 at 10:22 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote: Tone is a very simple, first order recursive filter. It would only introduce 1 sample of delay.
From: Forrest Cahoon [mailto:forrest.cahoon@gmail.com]
On Fri, Mar 8, 2013 at 11:23 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote:
Thanks, Russell! Since these examples use delayr/delayw they are very close to what I need. I remember reading somewhere that the tone LPF opcode introduces a delay, and for precise tuning the delay introduced by tone has to be subtracted from the length of the Karplus-Strong delay line in order to compensate. So I think your instruments may be off a little bit from their advertised frequencies -- much more than the subsample differences in delay I'm currently worried about. I can't find the reference to where I read that; it was a K/S example that was online years ago. Does anyone know about this? I suppose I will be able to find the value empirically, since the delay was a specific whole number of samples, but it would be nice if someone who actually knows could weigh in. |
Date | 2013-03-10 00:10 |
From | Oli Larkin |
Subject | Re: [Csnd] Karplus-Strong instrument using deltapx |
as you lower the cutoff of the 1pole IIR LPF in the feedback loop, the phase shift of the filter affects the tuning of the upper harmonics. You can use a linear phase FIR to avoid this. Faust is really excellent for playing with this stuff. here's a PM tanpura i've been working on using Karplus strong plus some tricks... On 9 Mar 2013, at 23:51, Russell Pinkston wrote:
|
Date | 2013-03-11 17:31 |
From | Russell Pinkston |
Subject | RE: [Csnd] Karplus-Strong instrument using deltapx |
Thanks for this, Oli. That does look like a useful filter for physical modeling. I checked out the tanpura sound file (sounds nice!), but couldn’t find the Csound code on the wiki. Did you mean to share that? From: Oli Larkin
[mailto:olilarkin@googlemail.com] as you lower the cutoff of the 1pole IIR LPF in the feedback loop, the phase shift of the filter affects the tuning of the upper harmonics. You can use a linear phase FIR to avoid this. Faust is really excellent for playing with this stuff. here's a PM tanpura i've been working on using Karplus strong plus some tricks... On 9 Mar 2013, at 23:51, Russell Pinkston wrote:
I think the 1 sample of actual delay is what’s important in this case, because the whole idea of K/S is that the length of the delay line is what determines the fundamental frequency of the “pluck.” So it seems to me that the one extra sample in the delay loop shouldn’t be significant. From: Justin Smith
[mailto:noisesmith@gmail.com] A recursive filter is IIR, and IIR filters introduce frequency dependent delay, meaning that while there may be strictly N samples of delay, it will effectively delay each sinusoidal partial by a different number of samples (some more and some less than the nominal delay size of the filter). I don't know how a delay on input that varies with spectrum interacts with Karplus-Strong though - Karplus-Strong is itself effectively a special case of an (unstable?) IIR filter IIRC. On Sat, Mar 9, 2013 at 10:22 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote: Tone is a very simple, first order recursive filter. It would only introduce 1 sample of delay.
From: Forrest Cahoon [mailto:forrest.cahoon@gmail.com]
On Fri, Mar 8, 2013 at 11:23 AM, Russell Pinkston <pinkstonrf@austin.utexas.edu> wrote:
Thanks, Russell! Since these examples use delayr/delayw they are very close to what I need. I remember reading somewhere that the tone LPF opcode introduces a delay, and for precise tuning the delay introduced by tone has to be subtracted from the length of the Karplus-Strong delay line in order to compensate. So I think your instruments may be off a little bit from their advertised frequencies -- much more than the subsample differences in delay I'm currently worried about. I can't find the reference to where I read that; it was a K/S example that was online years ago. Does anyone know about this? I suppose I will be able to find the value empirically, since the delay was a specific whole number of samples, but it would be nice if someone who actually knows could weigh in. |
Date | 2013-03-11 17:51 |
From | Oli Larkin |
Subject | Re: [Csnd] Karplus-Strong instrument using deltapx |
On 11 Mar 2013, at 17:31, Russell Pinkston wrote:
no... maybe I will at some point though. It's made in faust not csound
|