[sdiy] My latest project

cheater cheater cheater00 at gmail.com
Wed Feb 17 22:12:31 CET 2010


Caveat: I am not used to microcontroller programming. However, the
following guidelines could get you onto some ideas.

Tom,
You might find it possible to do what you want if you can write
self-modifying code, which copies the relevant functions to the place
in memory where your loop will happen. Not sure if microcontrollers
(the one you are using, in particular) allow this, though. This would
require you to keep the image size of interchangable functions
(different kinds of envelopes, for example) at the same size.

Or you could use jumps to set up your execution path correctly (but
this would also take self modifying code).

Then you would write your loop to look like this:

loopbegin:
jmp sub_envelope
afterenvelope:
jmp sub_vco
aftervco:
jmp sub_lfo1
afterlfo1:
jmp sub_lfo2
afterlfo2:
jmp loopbegin


----------

sub_envelope:
jmp sub_envelope_lin //you change the jump address to the right type of envelope

----------
sub_envelope_lin:
....
jmp afterenvelope
----------
sub_envelope_exp:
...
jmp afterenvelope


The two approaches are a bit different, the jmp's might make it
perform worse. This way you can compose your "pipeline". You might
even be able to do this while the process is running: if you have two
such "pipelines" set up, you could compose the second one "in the
background", and the nonce it is finally done, jump to the second one.

Both approaches use the fact that code *is* data.

Is this the sort of thing you have been thinking of?

Cheers
D.

On Wed, Feb 17, 2010 at 17:34, Tom Wiltshire <tom at electricdruid.net> wrote:
>
> On 17 Feb 2010, at 12:35, cheater cheater wrote:
>
>> What are you using the if branches for currently?
>>
>> There are quite some techniques that can let you refactor your code,
>> but we would need to see the situation right now :)
>>
>> D.
>
> Here's some examples of the sort of choices that get made in the LFOs and
> Envs:
>
> LFO waveshape - which lookup table? (Sine, triangle, ramp, etc)
> Envelope - Which curve? (expo attack, expo decay, linear, cosine, etc)
> Envelope - release instantly on gate low, or go through all remaining stages
> Envelope -  start from zero level on gate on, or start from current level
> Envelope - if loop mode is on, loop back to stage X.
>
> Some of these are easily modified into a pointer, but not everything is so
> straightforward.
>
> T.
>
>




More information about the Synth-diy mailing list