Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Envelope filter - Attack and Release?

Status
Not open for further replies.
Hey there,

I have a microprocessor which outputs music in square-waves form, and now I need some improvement there, which is the natural damping effect which music instruments have, or the "Attack-and-release" method.

However, I can't get it to work, despite how I wired these correctly. I followed the reference from this site: Making Music
9097-image004.gif

Since this thing requires a buffer, I wired it up that way:

9098-envelope.gif

My circuit has a problem: when I put that test pin to +5V, the sound was cut off, and then when I ground it, either the sound becomes distorted or it decayed in an improper manner.

By right, when I charge it, it should get louder, and then when I discharge it, the sound will bleed off and decay until I hook up the test pin back to +5V.:confused:
 

kchriste

New Member
Forum Supporter
Did you set RB0 as an input?
Did you then output a high to RB0?
Did you then momentarily toggle RB0 to an output?
Same with RB4....
ie: Did you use them as open drain outputs as shown in the example code?

You OpAmp circuit doesn't look right. Put the buffer after R3 in the diagram above. What are the supply voltages for the LM324?
 
Last edited:
Did you set RB0 as an input?
Did you then output a high to RB0?
Did you then momentarily toggle RB0 to an output?
Same with RB4....
ie: Did you use them as open drain outputs as shown in the example code?

You OpAmp circuit doesn't look right. Put the buffer after R3 in the diagram above. What are the supply voltages for the LM324?

Oh I see. Right now I didn't connect the "Gate" or the "Test" pin to the microcontroller pin because I want to see whether the decay circuit works or not.

In that case, the RB0 is an output - it comes out the square wave, which then the envelope is applied by using the RB4, and with the 220 ohm and the 4.7µF capacitor.
 

audioguru

Well-Known Member
Most Helpful Member
The attack/decay circuit is completely wrong and will not make the square-wave change its volume. It needs a voltage-controlled-amplifier (VCA) to do that.

A long time ago, music keyboards used a CA3080 transconductance amplifier IC as a VCA. Now you could use an LM13700 transconductance amplifier. It has a DC input that controls its gain.

Years ago, I made a background music circuit for an expensive intercom system that used a JFET to fade-in and fade-out the music. The JFET was a voltage-controlled-attenuator. It also had bass-boost and sounded pretty good.
 
The attack/decay circuit is completely wrong and will not make the square-wave change its volume. It needs a voltage-controlled-amplifier (VCA) to do that.

A long time ago, music keyboards used a CA3080 transconductance amplifier IC as a VCA. Now you could use an LM13700 transconductance amplifier. It has a DC input that controls its gain.

Years ago, I made a background music circuit for an expensive intercom system that used a JFET to fade-in and fade-out the music. The JFET was a voltage-controlled-attenuator. It also had bass-boost and sounded pretty good.

I see. So if I used the LM13700, and hook up the RC combination and a switch (hold and discharge) I could make it to attack-and-decay?

Are they any other transconductance amplifier that could be recommended? I only can find SMD versions of the LM13700, when I want the DIP ones. :)
 

audioguru

Well-Known Member
Most Helpful Member
You must study how to control the gain of the LM13700 with voltage.

Manufactures do not use DIP ICs anymore.
There are very few hobbiests who use transconductance amplifiers anymore.
 

kchriste

New Member
Forum Supporter
9106-image004.gif

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.
 
Last edited:

MrAl

Well-Known Member
Most Helpful Member
9107-image004.gif

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.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top