[sdiy] "lunetta"/CMOS sound-making equivalents in C Programming???
Dan Snazelle
subjectivity at hotmail.com
Thu Mar 22 21:23:02 CET 2012
Thanks for the info!
Sent from my iPhone
On Mar 22, 2012, at 1:04 PM, nvawter at media.mit.edu wrote:
>
> Heya Dan!
>
> I noticed you were on an electromusic thread about 4522s and 4015s my friend sent me this morning.
>
> uControllers can do lots of similar stuff to CMOS logic, with certain limitations (and certain advantages!)... One of my favorite resources for this is believe-it-or-not, the wikipedia page on LFSRs! It shows the "slow" (Fibonacci) and "fast" (Galois) way to make a shift register with feedback in C.
>
> Typically, you'll want to have a loop running and shifting a register every clock cycle. It's safe to use a nice wide variable like an unsigned 32-bit word.
>
> A divide-by-two could be implemented as:
> while(1){
> if( 0x1 == ((prev_div_in<<1)|(div_in)) ){div_out^=1;}
> prev_div_in=div_in;
> }
>
> that detects a transition from 0 to 1. On that transition, it inverts the output.
>
> I'm messing with this stuff, too, but aiming to place it inside a cheap CPLD to save space. Someone (this list?) showed me the Amani CPLD board with the AlteraEPMx064 on it. Those (reprogrammable, socketed PLCC) chips cost $2.10 in single quantity! and they can take the place of a dozen CMOS chips! Of course you have to learn a clumsy HDL language (and they are wonky, amiriteladies?), but it's not that hard, mostly C-like logic symbols. And the CPLDs can potentially run much faster than the CMOS logic equivalents, too! And there's a simulator (not with audio though, sadly!)
>
>
>
>
>
> Quoting dan snazelle <subjectivity at hotmail.com>:
>
>> Often I use counters, Logic, clocks, R2R's , shift registers and flip-flops to make sequencers, CV generators, cheap crazy sounds,etc.
>>
>>
>> I was wondering what is possible using a micro-controller and C to replicate or expand on some of those techniques to end up with a vocabulary of fun and quick
>> noisemakers.
>>
>>
>> for example, a common use for CMOS in sound making is taking a clock, putting it through a 4040 counter (12 bit) or similar, taking the taps, ANDING them with other clocks,
>> XORing the result, etc.
>>
>>
>> So...
>>
>> 1. How can you replicate something like a 4024/4040 in a program ( a counter with multiple outputs/taps ?
>>
>> i think a for loop is a counter, would i just set up a bunch of if statements ?
>>
>> for (i=0; i<12; i++)
>>
>> if (i=2)
>> dacTap1=HIGH;
>>
>>
>> 2. how can i make a simple divide by 2 in code?
>>
>>
>> 3. what about replicating shift registers?
>>
>>
>> thanks for ANY IDEAS!!
>>
>>
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at dropmix.xs4all.nl
>> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>>
>
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list