Archive for March 30, 2014

Project Ryu Lagger – Guitar Effect

Lagger Slow Attack Guitar Effect facebooktwittergoogle_plusredditpinterestlinkedinmailby feather


Do you remember BOSS Slow Gear pedal? If your a guitarist you most likely do or at least you’ve heard of it. It was a great pedal sold from 1979 to 1982 and it was made in Japan. The pedal would cut the attack of your notes giving a swelling sound. It god famous for making the guitar sound kinda like a violin.

I always liked that effect and i even made a clone a few years back. It is based on a 2SK30 JFET and it was a pain getting these transistors. It was a lot of fun though and i though i should make a Project Ryu swell effect pedal and so LAGGER was born!

Recently i worked on a few projects with LM13600/LM13700, one of them is a nice noise gate / compressor unit which i will present at a later date, and i really like the VCAs that can be built with these chips.

To cut the attack of a note and then swell the volume basically we need a triggered fade in effect. This means that we need to control our VCA with a rising voltage using what i call a ramp generator.

In a previous article (Monitoring Amplifier モニターアンプ P3: Speaker Coupling Delay)   i described the circuit of such a ramp generator and it even has a command input. I will use this circuit with the LM13600 VCA all controlled digitally with a PIC18f1320.

Below you can see the block diagram of the Lagger:

Lagger slow attack pedal diagram
The input is fed into an ADC channel to be rectified and averaged in order to detect when a note is played. Once it is detected, the ramp generator is triggered and provides the control voltage for the first VCA.

Since LM13600/LM13700 is a dual amplifier the second one is configured as a VCA with manually set control voltage. In the picture below you can see how the circuit works. The top signal is the input signal, the middle signal is the output of the ramp generator and the bottom signal is the trigger.

Lagger Slow Attack Signal

There is a problem with using the ramp generator circuit this way. The capacitor is discharged too quickly when the trigger is interrupted and this causes an audible thump noise when trigger goes off. Looking below at the schematic we can see the discharge current goes through CE junction of Q1.

Speaker delay circuit schematic

We can lower this current by inserting a resistor between ground and Q1’s emitter but in our specific application that will cause an offset and the output will not be totally silent in absence of input signal.

Another way to solve the problem is by paralleling a capacitor with R3 (Q2’s emitter resistor) This will cause a fade out effect and eliminate the thump noise.

Lagger Slow Attack guitar pedal


Below you can find the schematic for the Lagger:

lagger slow attack guitar schematic

U5 shows as TL071 but you need an opamp with higher output current sink capability. Something like HA17358 with 50mA capability is good:


Trigger for the ramp generated is created when the microcontroller detects a signal from guitar. In my last article i have explained a way to rectify and average an analog signal using ADC and software. If the input level is higher than a set threshold level then ramp generator is triggered.

In the first units the middle pot was used to set a sustain period but that was changed to sensitivity control as it proved to be much more helpful.

J1 is a push-button which will generate an interrupt for the microcontroller and provide a true bypass via the SPDT relay.

You will notice some unusual supply voltages. For example the microcontroller’s Vdd is set to GND and Vss to  -5V. This is done in order to provide correct trigger levels and avoid using other active components to shift the level.

Below you can see the PCB for the unit:

Lagger Slow Attack Guitar Effect PCBLagger Slow Attack Guitar Effect PCBLagger Slow Attack Guitar Effect PCB

Here are some pictures with Project Ryu Lagger:

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect

Lagger Slow Attack Guitar Effect


Here is a short video with the unit in action:

I will be supplying the hex file for the PIC18f1320 microcontroller in my next newsletters so if you want to built the unit and your not a subscriber yet please use the top right form to subscribe.

Also in my newsletter you will find offer for kits and complete units for those who don’t do well with electronics.

Thank you for visiting.


Analog to Digital Signal Rectification

facebooktwittergoogle_plusredditpinterestlinkedinmailby feather


Often in my projects i need to detect the signal level and then feed it to an A/D Converter. Since Digital circuitry operate on a single rail power supply usually from 1.8V to 5V you cannot feed the analog signal to the ADC’s input referenced to digital ground because the negative polarity will be ignored or worse, could damage the ADC.

One way is to use an analog rectifier and convert this output to digital. This requires some extra components though and depending on maximum frequency of the signal can be expensive.

In audio domain I usually rectify it in software and I provide a DC offset on the ADC input in order to keep both positive and negative side of the signal within the ADC’s input range.

To have a symmetric voltage swing the offset is VDD/2. This of course gives a first limitation of peak input voltage of VDD/2 but it can be easily resolved by attenuating the signal first and keeping the attenuation level in mind in software side. This way we can scale the signal to fit our input requirements.

Digital Rectifier ADC Software signal rectifier



In the picture above (a) shows you the signal with a VDD/2 offset presented at the input of our A/D converter. We will sample this signal in time as shown on the x axis. and the black lines represent the result after sampling

(b) shows how to reconstruct the analog signal. You can see that for values above the VDD/2 line the green part exists in our sample value from (a) and for samples below VDD/2 line we need to add the green part.

Looking at our analog input signal and samples in (a) and looking at the green parts in (b) we can say that the signal value v(t) for each sample s[n] is:

v(t1) = s[1]-VDD/2

v(t2) = s[2]-VDD/2

v(t3) = s[3]-VDD/2

v(t4) = s[4]-VDD/2

v(t5) = s[5]-VDD/2


What the above list describes are actually the green parts in (b). The problem that remains is that v(t3) and v(t4) (corresponding for the negative voltage swing in the input signal) are negative because sample 3 and 4 are lower in value than VDD/2.

What we did so far is eliminate the input offset and now in order to rectify it we need to make all the negative values positive. This is simply done this way:

v(t1) = s[1]-VDD/2

v(t2) = s[2]-VDD/2

v(t3) = VDD/2-s[3]

v(t4) = VDD/2-s[4]

v(t5) = s[5]-VDD/2


Now the signal is rectified. v(t3) and v(t4) are positive and the list above describes now figure (c), the rectified output.

There are a couple of drawbacks in using this technique. First is the stability of the offset VDD/2. This voltage will need to be extremely stable for accurate result. If offset fluctuates then sample values will fluctuate too. If you can eliminate drift caused by temperature, load fluctuations etc then you can have a very accurate and fast rectifier.

There is a way to make this problem disappear by using a second A/D converter channel. And this is the second drawback if your number of channels is very limited. When using a microcontroller this isnt really a problem as usually there are a sufficient number of channels available.

I usually use the second solution and i always get the VDD/2 value from the second ADC channel and then get the input signal value. Lets look below at at example on how to do this;

/* we will use channel 0 for VDD/2 input and channel 1 for signal input */

int READ_ADC(int channel); //function prototype to read ADC value on channel 

int RECTIFY(void)












Output of RECTIFY function can then be stored into a vector and perform various calculations to get your desired result. I usually average the values:

#define SUM_LENGTH 512 //how many samples you want to average

int AVERAGE(void)


double SUM=0; // depending on the ADC resolution choose the data type

int RESULT, i;







return RESULT;


To choose the SUM_LENGTH you should consider the speed of the A/D conversion and the lowest frequency of the input signal so that you can capture an entire period. This, of course is application dependant but you can play around with the values and check the result.

Holding the RECTIFY value in a vector you can then get max value which is peak value or RMS, envelope and so many more things.

I hope this will be useful and if there is anything you want to ask go ahead and leave a comment.

Thank you for visiting.

Microphone Preamplifier Part 1: Restoration

facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Some years ago, i got my hands on an old and obscure mono mixing console. It was labeled just as PM5200. It wasnt of much use to me so i tore it down and salvaged parts for my own projects.

The other day i was looking through my things and found the mic preamp modules from that console and i thought this would be a great weekend project. I remember i used one of the modules for a guitar recording rig. Battery powered and with a transformer input it worked very well with Shure SM57.

The circuit uses only solid state discrete components and uses capacitor coupling. It allows for 3 gain settings and a nice line in/mic feature.

Original Mic Preamp Module

Original Mic Pre PCB

I do like the shield. 1mm thick steel.

You can see the original module with the busted gain setting. First i had to do is to reverse engineer and draw a schematic. It wasn’t very difficult, old PCB single sided, resistors all 500mW clear marked. You can see the schematic below:

PM5200 MIC PRE Original Schematic


With +/-15V the circuit draws about 10mA so its running pretty hot.

T101 along with D101, D102, R109, R110 for a constant current source. T102 and T103 form a long tail pair. You can attack it with balanced/unbalanced signal. You can use an input for more feedback or if you use the inputs together you can get a nice line in input with about 10x gain. T104 and T105 forms the main voltage amplification stage.

Next i took down all the components. Nothing was worth keeping.




I changed the NPN transistors to 2SC2240 from Toshiba. I really like these transistors in audio applications. PNP transistors i used BC559C, low noise and i have alot of these.

Also i replaced R119 with a multiturn pot of 5k in value. I hope i can get rid of the last coupling capacitor. We will see. One thing that surprised me was the lack of any power rail decoupling on board. I added 2 100n MKT caps.

Modified Mic PReamp

Modified Mic PReamp PCB


After that i recorded frequency response which you can see below. It is pretty linear with just 1dB dropping at high frequency.

PM5200 Mic pre frequency response


In next part i will explore some improvements and just put it in a box, add controls and make it ready to be used.

Thank you for visiting.