**broken link removed**
The way the original circuit (At the very top of this thread) work is this:
RB4 and RB0 are set to input mode. (High impedance)
The output for RB4 is set high but nothing happens because the pin is in high impedance input mode. Same for RB0 but it's output is set low.
Then you start switching RB0 to output mode and back to input mode at a 1Khz rate.
Then, at the same time, you switch RB4 to output mode for apx 5ms and then back to input mode. This charges C1 up to apx 5V.
Now R2 acts as a pullup resistor for RB0 which is behaving like a open drain FET being switched at 1Khz. C1 supplies the voltage for the pullup function, but since C1 now is slowly discharging through R2 and the RB0 open drain circuit, you get a gradual decay in the square wave at RB0.
Hi there,
I havent looked at this in great detail but as soon as i saw the basic
schematic i assumed that same thing. The modulation comes in the
form of varying the pullup voltage for the RB0 pin which in turn means
that the output amplitude gets modulated in accordance with a
charging (or discharging) cap voltage which is exponential. This
would modulate the envelope in the same way a string eventually
comes to rest after being plucked.
What i havent looked at is how exactly they are modulating the
'square waves'. If they are modulated with respect to 2.5v instead
of 0.0v there could be a problem in the sound of the output because
we dont want to change the relative amplitude of the negative and
positive half cycles, but i have no way of looking into this effect
since i dont have the source code. It's worth a try though i think
without worrying about that just yet. I would bet they took that
into consideration when they wrote the code and did it so that
the amplitude is relative to 0v.