My goodness! After reading some of the stuff online, I found this Envelope generator by Nathan Ramsden for one channel. To reduce the extra components used and as a prototype, I modified this to the following schematic: (apologies for my crappy handwriting, I used a cheap drawing tablet to do this!)
Note: You have to connect the +5V and the GND of the LM324 too! It is not shown in the schematic.
I placed them on the breadboard, and wired it accordingly. Ah, here is the test results too, using the Analog Discovery 2:
The decay works as usual, but I need to bump the resistor for the DECAY part to 100K for a longer chime sound.
To test this, I used a cheap Arduino Uno and connect:
- GATE to Arduino pin 3
- TONE to Arduino pin 11
And with the following Arduino sketch:
void setup() {
// put your setup code here, to run once:
tone(11,440);
pinMode(3, OUTPUT);
digitalWrite(3,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
tone(11,440);
digitalWrite(3, HIGH);
delay(250);
digitalWrite(3, LOW);
delay(1500);
noTone(11);
tone(11,880);
digitalWrite(3, HIGH);
delay(250);
digitalWrite(3, LOW);
delay(1500);
noTone(11);
}
This test loops between playing 440Hz and 880Hz tone, the input high time is 250ms, and then 1500ms for the low time.
Unfortunately I have to use a few more extra components like the op-amp, two diodes, some resistors and the transistor for each channel. Luckily, the cheap LM324 has four inside, and with all that, you can wire three of them as shown in the PICBasic article. I suggest to use a perfboard for this, since shaky connections on the breadboard doesn't really help in having a good clean sound out.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.