[Csnd] Exponential Stairstepping
Date | 2012-07-30 16:07 |
From | Jim Aikin |
Subject | [Csnd] Exponential Stairstepping |
Is there a k-rate equivalent of cpsxpch? I'd like to be able to take a smoothly varying signal (from an LFO, perhaps) and quantize it to discrete pitches. Quantizing to a linear series of values is easy, but I haven't yet figured out how to create stair-stepping if I intend to use the signal as an oscillator frequency. -- View this message in context: http://csound.1045644.n5.nabble.com/Exponential-Stairstepping-tp5714530.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2012-07-30 17:11 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Csnd] Exponential Stairstepping |
> Is there a k-rate equivalent of cpsxpch? I'd like to be able to take a > smoothly varying signal (from an LFO, perhaps) and quantize it to discrete > pitches. Quantizing to a linear series of values is easy, but I haven't > yet > figured out how to create stair-stepping if I intend to use the signal as > an > oscillator frequency. Simple answer is no there is no k-rate cpsxpch. Longer answers are: a: It would not be hard to write if really necessary b: cpsxpch follows a simple mathematical formula in many cases so that could be used at k-rate. ==John ff |
Date | 2012-07-30 17:38 |
From | Justin Smith |
Subject | Re: [Csnd] Exponential Stairstepping |
I think the code would be somthing like this: (untested code, but this should be about right) koct = int(kpch) kdegree = (kpch-koct)*100 knote = kbase*((2^(1/krepeat))^(kdegree+koct*krepeat)) to fix a very common bug with cpsxpch, report some warning if kdegree > kdivisions (by bug here I mean silent incompatibility between user expectation and opcode behavior) On Mon, Jul 30, 2012 at 9:11 AM, |
Date | 2012-07-30 17:50 |
From | Justin Smith |
Subject | Re: [Csnd] Exponential Stairstepping |
I read the docs for cpsxpch to hastily, here is an improved version that actually fits the docs for cpsxpch ; defined by user: kpch, krepeat, iequal, kbase (as specified in the docs for cpsxpch) koct = int(kpch) ; octave part of the specification kdeg = kpch-koct ; number between 0.0 and 0.9999... kdegree = kdeg*100 ; number between 0 and 99.99999..., may want to mod by krepeat ksteps = kdegree+koct*krepeat ; number of steps above kbase kroot = kequal^(1/krepeat) ; multiplier for each step of the scale kresult = kabse*(kroot^ksteps) On Mon, Jul 30, 2012 at 9:38 AM, Justin Smith |
Date | 2012-07-30 20:28 |
From | Jim Aikin |
Subject | [Csnd] Re: Exponential Stairstepping |
Thanks, Justin. I'm having some problems with your algorithm. I keep trying different modifications, and it's still not working for me. More significant, I wasn't thinking at all of an input in octave/pitch-class format. I should have been clearer about that. What I was thinking of was an input that's an arbitrary value (assuming it's for oscillator frequency, perhaps between 110 and 440), which an algorithm would then quantize to an arbitrary number of steps each time the base value (in this case, ibase would be 110) doubles ... or rather, increases by ^krepeat. This is what an analog quantizer circuit does. You plug a rising/falling voltage into it, and it clamps its output to a series of steps. The difference being, an analog synth is running at 1V/octave, so the exponentiation is handled in the oscillator, not in the quantizer. -- View this message in context: http://csound.1045644.n5.nabble.com/Exponential-Stairstepping-tp5714530p5714538.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2012-07-30 20:37 |
From | Victor |
Subject | Re: [Csnd] Re: Exponential Stairstepping |
But cpsxpch takes a pch input and produces a cps output. Maybe what you want is something else? Victor On 30 Jul 2012, at 20:28, Jim Aikin |
Date | 2012-07-30 20:39 |
From | Justin Smith |
Subject | Re: [Csnd] Re: Exponential Stairstepping |
ok, cpsxpch does not quantize at all to quantize that code, you need to use int(kdeg*100) instead of kdeg*100 in the definition of kdegree On Mon, Jul 30, 2012 at 12:28 PM, Jim Aikin |
Date | 2012-07-30 20:39 |
From | Justin Smith |
Subject | Re: [Csnd] Re: Exponential Stairstepping |
and of course kabse was a typo it should have been kbase On Mon, Jul 30, 2012 at 12:39 PM, Justin Smith |