That sketch is playing a tune making square waves of different
frequencies. That's not really the same as PWM, which varies the length
of the pulse, but the frequency stays constant. There are a few ways to
generate a square wave of a given freq. in Pd, if that is your goal. If
you want to do it by modeling the Arduino's use of a timer to turn a
signal on and off, that might be an interesting exercise. One easier
way, though, would be to amplify and clip a sine wave.
[osc~ 440]
|
[*~ 50]
|
[clip~ -0.5 0.5]
then if you plug a 50 cent piezo buzzer into the sound card of your
$1000 laptop, it will sound just like a $3 avr!
hehe... thanks for your suggestion :)
enrike
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list