Project Overview
A sequencer is used to loop a recorded segment of melody. In traditional sequencers and also this sequencer, you turn a knob (potentiometer) to set the note for each step. So 4 knobs for a 4-step potentiometer. Modern sequencers are connected to a keyboard or a launchpad. A sequencer can record in step time or real time. Step time means that you can only record in evenly spaced time steps. Real time means you can play freely and the sequencer will replay almost exactly how you played it.
Step-by-Step Instructions
I started with a CD4017B decade counter IC. See Fig. 1 for a pinout diagram.
I powered Vdd with 6V. According to the datasheet, the ENABLE is active low, so I connected it to ground. I used a function generator to send in a 5V 5Hz clock signal. At each clock pulse OUT 0 to 9 swings high and then low in sequence. At every instant, exactly one output will be high. Because I was building a 4-step sequencer, I connected OUT 5 to reset so that after OUT 4 the counter looped back to OUT 1. The output voltage level followed the Vdd – approximately Vdd-2.5V.
Even though the datasheet said Vdd could be as high as 15V, but as I tested, the output of the IC that I had started to distort if Vdd was higher than 8V. At Vdd=6V, the 4017 behaved as expected.
You can use LEDs to test out the 4017. I connected an LED and a 1kΩ resistor to ground after OUT 1 to 4. The LEDs lit up and turned off consecutively. See Fig. 2.
I used 4 potentiometers to control the output voltage of each step. See Fig 3.
The diodes are there so that no current will flow back into the other outputs when one output is high. The 1kΩ limits the maximum current. The buffer prohibits any loading effect from the oscillator that I will connect to the CV (control voltage) output.
My output ranged between 0V and 3.5V, which was appropriate for my oscillator. If you want to increase the range, you can replace the buffer with a noninverting amplifier. If you want to reduce the range, you can add a voltage divider before the buffer.
An example CV output is shown in Fig. 3. The voltage level at each step was controlled by a potentiometer.
I built a voltage controlled oscillator(VCO) to convert the CV to frequency.
See Fig. 4. This circuit consists of an integrator, a discharge and a schmitt trigger. The right op-amp serves as a schmitt trigger with trigger thresholds at 68k/(100k+68k)*15V and 68k/(100k+68k)*(-15V); that is, 6V and -6V.
Notice V1=V2=Vcv/2. Assume Vout2 is initially low. The transistor is off because the base voltage is low. There is no current through the collector. Consider the capacitor. V=Q/C, so dV/dt=I/C. The current through the capacitor is constant and equal to I_cv = Vcv/(2*100kΩ). Thus, the integrator outputs a constantly decreasing voltage, until Vout1 reaches the lower threshold of the Schmitt trigger.
Then Vout2 becomes high. The transistor is on and saturates. The collector voltage will be zero. The current into the collector is Vcv/(2*50kΩ) = 2*I_cv. Therefore the current through the capacitor is again I_cv. The integrator outputs a constantly increasing voltage, where the rate of change is the same as before. So Vout1 keeps decreasing, until it reaches the upper threshold of the Schmitt trigger.
Then Vout2 becomes low and the cycle repeats. The resultant Vout1 is a triangle wave oscillating between 6V and -6V. The frequency is determined by I_cv, which is determined by Vcv.
We can already make sounds with the triangle waves. However, if we connect this directly to a speaker, the tone is not very pleasant. That is because the sharp corners of the triangle waves are made of high-frequency Fourier components.
A triangle to dirty sine waveshaper
See Fig. 5. This part exploits the nonlinear behavior near 0.6V of the diodes. Without the diodes, the voltage divider would output V1=2Vpp if we input the 12Vpp triangle wave from our triangle VCO. However, as V1 goes beyond 0.6V or -0.6V, the diodes will source more and more current, gradually shaving off the sharp corners. The 200Ω potentiometer is used to tune the output voltage to be less than 70mVpp, because the subsequent voltage-controlled amplifier needs a small input.
With the sine wave, we can now properly play four notes with the sequencer. To make the sounds more realistic, we need envelopes so each note goes through an attack and decay.
I built a voltage-controlled amplifier (VCA) to do this. See Fig. 6.
This circuit is almost like an inverting amplifier, except that a resistor is replaced by a transistor. Because the input signal is low, this circuit doesn’t use the transistor as a switch like we have learned, but instead as a variable resistance. The transistor is in the linear region. A higher CV means that the transistor conducts more current. Consequently, there is lower effective resistance and a higher gain. On the other hand, a lower CV means a lower gain.
With the input signal as a 70mVpp sine wave, the gains at various CV values are
CV (V)
Decay envelope generator
To generate a short decaying sound, I built a decay envelope generator to use together with the VCA.
See Fig. 8. This is a parallel RC circuit. The variable resistor lets you tune the decay length. I needed a trigger input that is essentially just a very short pulse. I simply used the clock signal for input.
Finally connect the output to a speaker.
Potential upgrades:
1. More steps. Also add gates to turn each step on or off.
2. There is some unwanted dependence of the output frequency on clock frequency. Changing the BPM affects the pitch. The sequencer also seems to malfunction when the clock frequency is higher than 1kHz.
3. A better solution for finding the right note. The current potentiometers are too coarse to tune a note to the right frequency. An ideal but complicated alternative is to use a keyboard.
4. A cleaner triangle to sine waveshaper. The sine wave in the current design is technically a smoothed-off triangle wave. This method yields an approximate sine wave, i.e. dirty. There are better ways to design such a waveshaper.