[sdiy] simple octave divider questions/in ARDUINO w CODE
dan snazelle
subjectivity at hotmail.com
Sat Feb 5 20:05:42 CET 2011
thanks a lot
I had actually mapped my input to make sure it went from 0-255 but yes, it was just changing the volume.
using pin 8 out (which if i understand correctly is NOT a pwm out?) i was able to get some nice stuff by writing a sketch that looked at an osc on pin 0 and an osc on pin 1
and XORING them and multiplying them
and spitting it out on pin 8
nothing fancy but certainly fun on a saturday afternoon!
I WILL DEFINITELY TRY YOUR ADVICE ABOUT USING THE COMPARATOR IN!
thanks
On Feb 5, 2011, at 1:43 PM, Gordon JC Pearce wrote:
> On Sat, 2011-02-05 at 13:27 -0500, dan snazelle wrote:
>
>> I set up the code to label the input and output
>> and then I tried dividing the input by 4
>>
>> this did not work (on the PWM pin) it seemed to simply decrease the volume
>
> What you're actually doing there is reading in a voltage, and then
> setting the output width of the PWM depending on what you read.
>
> Now, the analogue inputs on the AVR go from 0-1023, and the PWM outputs
> (typically) go from 0-255. You'd need to divide by four for the full
> scale to fit into the PWM output scale.
>
> You're not actually dividing the frequency though. You're just dividing
> down the amplitude.
>
> To divide the frequency you'd need to detect the incoming frequency and
> generate an output at half that frequency. One way to do that would be
> to use the comparator input to detect zero-crossings and use a zero
> crossing to trigger a counter. Every two zero-crossings (or, every
> positive-going zero-crossing) you toggle the output pin.
>
> Gordon MM0YEQ
>
> _______________________________________________
> 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