Csound Csound-dev Csound-tekno Search About

[Csnd-dev] k-rate control over ftable parameters

Date2015-11-26 11:46
FromPeter Burgess
Subject[Csnd-dev] k-rate control over ftable parameters
Hi there, I have been playing around with altering the ftable parameters to alter the shapes of waveforms (using gen 16 and similar), and been getting great results. The only drawback is that I have to do it all at i-rate. Is there ftable opcodes that allow k-rate control of the gen routine parameters? Or is there another way of making/reading waveforms altogether that would allow flexible k-rate control over the shape of waveforms?

I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap opcodes that allow me to alter the shapes of waveforms, and I am making good use of them too, but what I'm doing with my direct ftables goes above and beyond what these opcodes alone will achieve.

Cheers in advance,

Pete

Date2015-11-26 12:24
FromRory Walsh
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
I normally use something like this to modify table parameters in real time(see code below). Whenever a slider moves, the table is updated with the new value/values. Expect some audio glitches if you change dramatically from one shape to another on a single k-cycle. But gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"
 
a1 oscili .5, 200, 1
outs a1, a1
 
kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
    ;if a slider changes trigger instrument 2 to update table
    event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif
 
endin
 
instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8  
endin

On 26 November 2015 at 11:46, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi there, I have been playing around with altering the ftable parameters to alter the shapes of waveforms (using gen 16 and similar), and been getting great results. The only drawback is that I have to do it all at i-rate. Is there ftable opcodes that allow k-rate control of the gen routine parameters? Or is there another way of making/reading waveforms altogether that would allow flexible k-rate control over the shape of waveforms?

I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap opcodes that allow me to alter the shapes of waveforms, and I am making good use of them too, but what I'm doing with my direct ftables goes above and beyond what these opcodes alone will achieve.

Cheers in advance,

Pete


Date2015-11-26 12:57
FromPeter Burgess
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
Hmm, I don't entirely understand. In your example, if instr 2 is already playing a note, will it stop that note and play a new note using the new ftable? So it will patch the different instr 2 instances together as if they were 1 instance?

On Thu, Nov 26, 2015 at 12:24 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I normally use something like this to modify table parameters in real time(see code below). Whenever a slider moves, the table is updated with the new value/values. Expect some audio glitches if you change dramatically from one shape to another on a single k-cycle. But gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"
 
a1 oscili .5, 200, 1
outs a1, a1
 
kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
    ;if a slider changes trigger instrument 2 to update table
    event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif
 
endin
 
instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8  
endin

On 26 November 2015 at 11:46, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi there, I have been playing around with altering the ftable parameters to alter the shapes of waveforms (using gen 16 and similar), and been getting great results. The only drawback is that I have to do it all at i-rate. Is there ftable opcodes that allow k-rate control of the gen routine parameters? Or is there another way of making/reading waveforms altogether that would allow flexible k-rate control over the shape of waveforms?

I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap opcodes that allow me to alter the shapes of waveforms, and I am making good use of them too, but what I'm doing with my direct ftables goes above and beyond what these opcodes alone will achieve.

Cheers in advance,

Pete



Date2015-11-26 13:01
FromRory Walsh
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
Instr 1 is always on. instr2 is only on for a split second whenever a slider moves, but it is not producing any sound, it only updates the f table. This is done at a k-boundaries so it's thread safe(afaik), but can cause some audio glitches as I've mentioned. I'm sure there are other and maybe better ways of doing this.

On 26 November 2015 at 12:57, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hmm, I don't entirely understand. In your example, if instr 2 is already playing a note, will it stop that note and play a new note using the new ftable? So it will patch the different instr 2 instances together as if they were 1 instance?

On Thu, Nov 26, 2015 at 12:24 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I normally use something like this to modify table parameters in real time(see code below). Whenever a slider moves, the table is updated with the new value/values. Expect some audio glitches if you change dramatically from one shape to another on a single k-cycle. But gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"
 
a1 oscili .5, 200, 1
outs a1, a1
 
kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
    ;if a slider changes trigger instrument 2 to update table
    event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif
 
endin
 
instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8  
endin

On 26 November 2015 at 11:46, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi there, I have been playing around with altering the ftable parameters to alter the shapes of waveforms (using gen 16 and similar), and been getting great results. The only drawback is that I have to do it all at i-rate. Is there ftable opcodes that allow k-rate control of the gen routine parameters? Or is there another way of making/reading waveforms altogether that would allow flexible k-rate control over the shape of waveforms?

I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap opcodes that allow me to alter the shapes of waveforms, and I am making good use of them too, but what I'm doing with my direct ftables goes above and beyond what these opcodes alone will achieve.

Cheers in advance,

Pete




Date2015-11-26 13:07
FromPeter Burgess
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
Ah ok i think I've got it, so instr 1 reads the ftable, and triggers instr 2 to alter the ftable that it's reading from as needed. That sounds like a viable techhnique, i'll give it a go, thanks!

On Thu, Nov 26, 2015 at 1:01 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
Instr 1 is always on. instr2 is only on for a split second whenever a slider moves, but it is not producing any sound, it only updates the f table. This is done at a k-boundaries so it's thread safe(afaik), but can cause some audio glitches as I've mentioned. I'm sure there are other and maybe better ways of doing this.

On 26 November 2015 at 12:57, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hmm, I don't entirely understand. In your example, if instr 2 is already playing a note, will it stop that note and play a new note using the new ftable? So it will patch the different instr 2 instances together as if they were 1 instance?

On Thu, Nov 26, 2015 at 12:24 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I normally use something like this to modify table parameters in real time(see code below). Whenever a slider moves, the table is updated with the new value/values. Expect some audio glitches if you change dramatically from one shape to another on a single k-cycle. But gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"
 
a1 oscili .5, 200, 1
outs a1, a1
 
kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
    ;if a slider changes trigger instrument 2 to update table
    event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif
 
endin
 
instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8  
endin

On 26 November 2015 at 11:46, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Hi there, I have been playing around with altering the ftable parameters to alter the shapes of waveforms (using gen 16 and similar), and been getting great results. The only drawback is that I have to do it all at i-rate. Is there ftable opcodes that allow k-rate control of the gen routine parameters? Or is there another way of making/reading waveforms altogether that would allow flexible k-rate control over the shape of waveforms?

I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap opcodes that allow me to alter the shapes of waveforms, and I am making good use of them too, but what I'm doing with my direct ftables goes above and beyond what these opcodes alone will achieve.

Cheers in advance,

Pete





Date2015-11-27 15:09
Fromjoachim heintz
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
hi rory -

i am wondering whether this could be simplified to immediately sending 
an f-event, like:

if kChanged==1 then
      event "f", 1, 0, 1024, 10, k1, k2, k3, k4, k5
endif

i never tried, but think it should work.  best -

	joachim


On 26/11/15 13:24, Rory Walsh wrote:
> I normally use something like this to modify table parameters in real
> time(see code below). Whenever a slider moves, the table is updated with
> the new value/values. Expect some audio glitches if you change
> dramatically from one shape to another on a single k-cycle. But
> gradually modifying the parameters changes things quite smoothly.
>
> instr    1
> k1 chnget "harm1"
> k2 chnget "harm2"
> k3 chnget "harm3"
> k4 chnget "harm4"
> k5 chnget "harm5"
>
> a1 oscili .5, 200, 1
> outs a1, a1
>
> kChanged changed k1, k2, k3, k4, k5
> if kChanged==1 then
>      ;if a slider changes trigger instrument 2 to update table
>      event "i", 2, 0, .01, k1, k2, k3, k4, k5
> endif
>
> endin
>
> instr    2
> iNormal = (chnget:i("normal")==0 ? -1 : 1)
> iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8
> endin
>
> On 26 November 2015 at 11:46, Peter Burgess
> >
> wrote:
>
>     Hi there, I have been playing around with altering the ftable
>     parameters to alter the shapes of waveforms (using gen 16 and
>     similar), and been getting great results. The only drawback is that
>     I have to do it all at i-rate. Is there ftable opcodes that allow
>     k-rate control of the gen routine parameters? Or is there another
>     way of making/reading waveforms altogether that would allow flexible
>     k-rate control over the shape of waveforms?
>
>     I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap
>     opcodes that allow me to alter the shapes of waveforms, and I am
>     making good use of them too, but what I'm doing with my direct
>     ftables goes above and beyond what these opcodes alone will achieve.
>
>     Cheers in advance,
>
>     Pete
>

Date2015-11-27 15:44
FromRory Walsh
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
You're absolutely right. I copied a pasted my code from a Cabbage instrument that was doing more in instrument two than simply updating a table.

On 27 November 2015 at 15:09, joachim heintz <jh@joachimheintz.de> wrote:
hi rory -

i am wondering whether this could be simplified to immediately sending an f-event, like:

if kChanged==1 then
     event "f", 1, 0, 1024, 10, k1, k2, k3, k4, k5
endif

i never tried, but think it should work.  best -

        joachim



On 26/11/15 13:24, Rory Walsh wrote:
I normally use something like this to modify table parameters in real
time(see code below). Whenever a slider moves, the table is updated with
the new value/values. Expect some audio glitches if you change
dramatically from one shape to another on a single k-cycle. But
gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"

a1 oscili .5, 200, 1
outs a1, a1

kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
     ;if a slider changes trigger instrument 2 to update table
     event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif

endin

instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8
endin

On 26 November 2015 at 11:46, Peter Burgess
<pete.soundtechnician@gmail.com <mailto:pete.soundtechnician@gmail.com>>
wrote:

    Hi there, I have been playing around with altering the ftable
    parameters to alter the shapes of waveforms (using gen 16 and
    similar), and been getting great results. The only drawback is that
    I have to do it all at i-rate. Is there ftable opcodes that allow
    k-rate control of the gen routine parameters? Or is there another
    way of making/reading waveforms altogether that would allow flexible
    k-rate control over the shape of waveforms?

    I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap
    opcodes that allow me to alter the shapes of waveforms, and I am
    making good use of them too, but what I'm doing with my direct
    ftables goes above and beyond what these opcodes alone will achieve.

    Cheers in advance,

    Pete




Date2015-11-27 21:14
FromPeter Burgess
SubjectRe: [Csnd-dev] k-rate control over ftable parameters
Cheers for your input heintz! That's what I decided to do in the end too. It all works perfectly for my needs

On Fri, Nov 27, 2015 at 3:44 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
You're absolutely right. I copied a pasted my code from a Cabbage instrument that was doing more in instrument two than simply updating a table.

On 27 November 2015 at 15:09, joachim heintz <jh@joachimheintz.de> wrote:
hi rory -

i am wondering whether this could be simplified to immediately sending an f-event, like:

if kChanged==1 then
     event "f", 1, 0, 1024, 10, k1, k2, k3, k4, k5
endif

i never tried, but think it should work.  best -

        joachim



On 26/11/15 13:24, Rory Walsh wrote:
I normally use something like this to modify table parameters in real
time(see code below). Whenever a slider moves, the table is updated with
the new value/values. Expect some audio glitches if you change
dramatically from one shape to another on a single k-cycle. But
gradually modifying the parameters changes things quite smoothly.

instr    1
k1 chnget "harm1"
k2 chnget "harm2"
k3 chnget "harm3"
k4 chnget "harm4"
k5 chnget "harm5"

a1 oscili .5, 200, 1
outs a1, a1

kChanged changed k1, k2, k3, k4, k5
if kChanged==1 then
     ;if a slider changes trigger instrument 2 to update table
     event "i", 2, 0, .01, k1, k2, k3, k4, k5
endif

endin

instr    2
iNormal = (chnget:i("normal")==0 ? -1 : 1)
iTable    ftgen    1, 0,   1024, 10*iNormal, p4, p5, p6, p7, p8
endin

On 26 November 2015 at 11:46, Peter Burgess
<pete.soundtechnician@gmail.com <mailto:pete.soundtechnician@gmail.com>>
wrote:

    Hi there, I have been playing around with altering the ftable
    parameters to alter the shapes of waveforms (using gen 16 and
    similar), and been getting great results. The only drawback is that
    I have to do it all at i-rate. Is there ftable opcodes that allow
    k-rate control of the gen routine parameters? Or is there another
    way of making/reading waveforms altogether that would allow flexible
    k-rate control over the shape of waveforms?

    I'm aware already of pdhalf, pdhalfy and the mirror/fold/wrap
    opcodes that allow me to alter the shapes of waveforms, and I am
    making good use of them too, but what I'm doing with my direct
    ftables goes above and beyond what these opcodes alone will achieve.

    Cheers in advance,

    Pete