waveshaping 101

Time to start work on waveshaping. My synth is now able to generate 6 voices of musically tuned square waves. Nice, but pretty boring ;). First step is to shape the square wave to a sawtooth wave. This is the square wave from 1 voice:

Inspired by the following waveshaping schematic from the Roland Juno 6,

I came up with the following solution:

The OpAmp is a LM324N, suitable for single +5V power (remember my USB requirement). The transistor is a 2N3904 NPN instead of the PNP used in the Roland schematics. All resistor and capacitor values are determined by the parts I have in my stock. The minus voltage on the capacitor integrator loop is generated via an ICL7660 IC (transforms + voltages into – voltages). Result:

Tada: a sawtooth wave. The peak of the wave is not at 5v because of the maximum output swing of the LM324N OpAmp (+V – 1.5V).

Now I have to find the best values for all the components to generate a normalised saw wave (peak at 3.6v) for all frequencies. My synth should be able to handle all frequencies between 8Hz (midinote 0) and 4000Hz (around midinote 107).