+ Reply to Thread
Results 1 to 8 of 8

Thread: Envelope filter - Attack and Release?

  1. #1
    littletransistor Newbie
    Join Date
    Aug 2006
    Location
    Kuala Lumpur, Malaysia
    Posts
    223

    Default Envelope filter - Attack and Release?

    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
    Since this thing requires a buffer, I wired it up that way:


    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.


  2. #2
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default

    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 by kchriste; 31st October 2009 at 06:19 AM.
    Inside every little problem, is a big problem trying to get out.

  3. #3
    littletransistor Newbie
    Join Date
    Aug 2006
    Location
    Kuala Lumpur, Malaysia
    Posts
    223

    Default

    Quote Originally Posted by kchriste View Post
    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.

  4. #4
    audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent
    Join Date
    Mar 2004
    Location
    Canada, of course!
    Posts
    19,871

    Default

    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.
    Uncle $crooge

  5. #5
    littletransistor Newbie
    Join Date
    Aug 2006
    Location
    Kuala Lumpur, Malaysia
    Posts
    223

    Default

    Quote Originally Posted by audioguru View Post
    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.

  6. #6
    audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent audioguru Excellent
    Join Date
    Mar 2004
    Location
    Canada, of course!
    Posts
    19,871

    Default

    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.
    Uncle $crooge

  7. #7
    kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent kchriste Excellent
    Join Date
    Jul 2006
    Location
    Victoria BC, Canada
    Posts
    3,681

    Default


    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 by kchriste; 1st November 2009 at 01:20 AM.
    Inside every little problem, is a big problem trying to get out.

  8. #8
    MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent
    Join Date
    Sep 2008
    Location
    NJ
    Posts
    1,293

    Default

    Quote Originally Posted by kchriste View Post

    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 by MrAl; 1st November 2009 at 01:37 AM.

+ Reply to Thread

Similar Threads

  1. Latch release?
    By wod in forum General Electronics Chat
    Replies: 3
    Latest: 11th October 2009, 09:01 PM
  2. Attack of the Killer Dust Bunnies
    By Styx in forum Chit-Chat
    Replies: 10
    Latest: 11th July 2008, 08:48 PM
  3. GPRS AT comands for Release 99
    By Mking in forum Electronic Projects Design/Ideas/Reviews
    Replies: 0
    Latest: 28th April 2005, 07:26 AM
  4. HOW TO RELEASE PHONE LINE ??
    By jrgmayo in forum General Electronics Chat
    Replies: 6
    Latest: 15th April 2005, 04:10 PM

Tags for this Thread