Democracy DEV

A Raspberry Pi + FPGA Platform for Real-time Embedded Audio Processing

Nov 14, 2016

Project update 1 of 3

First Week & Wah Effect Explained

Hi there!

First, thanks a lot to everyone supporting our Democracy DEV project.

We are receiving very good feedback from many developers and researchers working in the audio processing field. We look forward to get more and more backers, and reaching our funding goal!

Please help us by sharing the campaign page link with anyone willing to contribute to the success of our project.

In this first update, we are going to provide some technical details on the wah guitar effect demo shown in the video above.

Also, you can download the MATLAB code from here!

Wah Effect Technical Description

The wah effect is based on a bandpas filter with variable center frequency and a small bandwidth. Changing the bandpass center frequency leads to a spectrum shaping similar to speech and produces a kind of “wah-wah” sound.
The filtered wah signal is then mixed with the direct one to produce the final effect.

function y = wah(x,Fw,damp,mix,Fs,minf,maxf)
% difference equation coefficients
Q1 = single(2*damp);     % this dictates size of the pass bands
delta = single(Fw/Fs);
yw = zeros(size(x),'single');
y = zeros(size(x),'single');
% apply difference equation to the sample
for n=1:length(x)
    % auto wah function
    Fc = triWaveUpdate(minf,maxf,delta);
    F1 = single(2*sin((pi*Fc)/Fs));
    yw(n) = wahFilter(x(n),F1,Q1); 
    % wet/dry mix
    y(n) = (1 - mix)*x(n) + mix*yw(n);
end
end


Moving the center frequency may be achieved either with a control pedal or by defining a specific time varying function, for example a triangle wave.

function FcOut = triWaveUpdate(minf,maxf,delta)
persistent iFc zFc FcUp;
if isempty(iFc)
    iFc = 1;
    zFc = single(minf);
    FcUp = true;
end
if (zFc >= minf) && (zFc < maxf) && FcUp
    Fc = zFc + delta;
elseif (zFc >= minf) && (zFc < maxf) && ~FcUp
    Fc = zFc - delta;
elseif zFc >= maxf
    FcUp = false;
    Fc = zFc - delta;
elseif zFc < minf
    FcUp = true;
    Fc = zFc + delta;
else
    Fc = single(minf);
end
FcOut = zFc;
zFc = Fc;
end


The time varying filter is implemented as a State Variable Filter, which allows independent control over the center frequency and the damping factor in charge of tuning the filter bandwidth.

function yb = wahFilter(x,F1,Q1)
persistent zyl zyb
if isempty(zyl)
    zyl = single(0);
    zyb = single(0);
end
yh = x - zyl - Q1*zyb;
yb = F1*yh + zyb;
yl = F1*yb + zyl;
zyl = yl;
zyb = yb;
end

Sign up to receive future updates for Democracy DEV.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects