Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 34

KATHMANDU UNIVERSITY

SCHOOL OF ENGINEERING
DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

PROJECT REPORT

GUITAR MULTI-EFFECTS

A Third year project report submitted in partial fulfilment


of the requirements for the degree of
Bachelor of Engineering

by:
Biraj Singh Thakuri (19023)
Puspa Joshi (32039)

June, 2024
CERTIFICATION

THIRD YEAR PROJECT REPORT


ON
GUITAR MULTI-EFFECTS

by:
Biraj Singh Thakuri (19023)
Puspa Joshi (32039)

Approved by:

1. Project Supervisor:
Madhav Prasad Pandey

___________________
(Signature)

2. Head of the Department :


Dr.Ram Kaji Budhathoki

___________________
(Signature)

ii
ABSTRACT

Our engineering project presents a MATLAB-based system for post-processing guitar audio
signals. Unlike real-time setups, this system applies various effects (e.g., distortion, delay, reverb,
fuzz, wah-wah, overdrive, tremolo, etc.) to pre-recorded guitar tracks. It features a user-friendly
interface, utilizing MATLAB's signal processing capabilities to modify audio files non-
destructively while maintaining original quality. The project demonstrates the potential of
MATLAB for efficient, customizable, and high-quality post-processing of guitar recordings,
benefiting musicians, audio engineers, and enthusiasts seeking versatile signal manipulation tools.

iii
TABLE OF CONTENTS
ABSTRACT.................................................................................................................................................iii
TABLE OF CONTENTS................................................................................................................................iv
List of Figures.............................................................................................................................................v
SYMBOLS AND ABBREVIATIONS...............................................................................................................vi
CHAPTER 1: BACKGROUND AND INTRODUCTION.....................................................................................7
1.1. Introduction:.............................................................................................................................7
1.2. Problem Definition:...................................................................................................................7
1.3. Objective of the Project............................................................................................................8
1.4. Significance of Study.................................................................................................................8
1.5. Limitation..................................................................................................................................9
CHAPTER 2: LITERATURE SURVEY............................................................................................................10
CHAPTER 3: PROJECT METHODOLOGY....................................................................................................11
3.1. Methodology................................................................................................................................11
3.1.1. Effect Specification....................................................................................................................11
3.1.1.1. Clean Effect:........................................................................................................................11
3.1.1.2. Distortion Effect:.................................................................................................................11
3.1.1.3. Fuzz Effect:..........................................................................................................................13
3.1.1.4. Delay Effect:........................................................................................................................14
3.1.1.5. Reverb Effect.......................................................................................................................14
3.1.1.6. Flanger effect......................................................................................................................14
3.1.1.7. Tremolo effect.....................................................................................................................15
3.1.1.8. Overdrive Effect:.................................................................................................................15
3.1.1.9. Wah-wah effects.................................................................................................................16
3.1.1.10. Chorus effects...................................................................................................................16
3.1.2. Implementation of Code............................................................................................................17
3.2. Block Diagram...............................................................................................................................24
3.3. Gantt Chart...................................................................................................................................25
CHAPTER 4: RESULT OF PROJECT.............................................................................................................26
4.1. Effects Obtained after digital processing of the guitar signal:..........................................................26
CHAPTER 5: CONCLUSION AND DISCUSSION..........................................................................................32
REFRENCES..............................................................................................................................................33

iv
List of Figures
Figure 1 block diagram.............................................................................................................................................................
Figure 2 before loading file......................................................................................................................................................
Figure 3 Original audio signal..................................................................................................................................................
Figure 4 Reverb effect..............................................................................................................................................................
Figure 5 Delay effect................................................................................................................................................................
Figure 6 Flanger effect.............................................................................................................................................................
Figure 7 Distortion effect.........................................................................................................................................................
Figure 8 Fuzz effect..................................................................................................................................................................
Figure 9 Chorus effect..............................................................................................................................................................
Figure 10 Overdrive effect.......................................................................................................................................................
Figure 11 Wah-wah effect........................................................................................................................................................
Figure 12 Tremolo effect..........................................................................................................................................................

v
SYMBOLS AND ABBREVIATIONS

Symbol Full Form

DSP……………………………Digital Signal Processing


ADC…………………………..Analog to Digital converter
DAC…………………………...Digital to Analog Converter
Amp……………………………Amplifier
LFO……………………………Low Frequency Oscillator
GUI……………………………Graphical User Interface

vi
CHAPTER 1: BACKGROUND AND INTRODUCTION

1.1. Introduction:

The guitar is a popular musical instrument, especially for beginners. Our project is a bit different.
Instead of changing the sound of the guitar while playing, we're working on a way to change the
sound after it has been recorded. We're using a program called MATLAB to do this. Our goal is
to make different effects like making the sound louder (distortion), creating echoes (delay), and
changing the tone (modulation). These effects are really important in today's music. We found
that a lot of young people are really interested in these guitar effects.
Our project focuses on making these effects such as distortion, fuzz, delays, wah-wah, etc. We're
showing how MATLAB can help improve recorded guitar music by adding cool effects to it.

1.2. Problem Definition:

The aim of this project is to design and implement a Guitar Multi-Effects System and Digital
equalizer using MATLAB. The system is intended to enhance the audio output of an electric
guitar by incorporating various effects such as delay, distortion, clean tones, and more. Along
with real-time systems, this project also focuses on post-processing effects, allowing users to
apply and experiment with different effects after recording their guitar performance.
The key challenges include:
 Algorithm Implementation: Develop efficient algorithms for each effect, ensuring that the
applied transformations accurately replicate the desired audio effects without introducing
undesirable artifacts.
 Signal Processing: Design and implement signal processing techniques to handle the non-
real-time nature of the system, enabling users to manipulate recorded guitar tracks with
minimal latency.
 User Interface: Create an intuitive and user-friendly interface to facilitate the selection
and customization of various effects. This interface should provide users with control
over parameters such as distortion, delay, reverb, fuzz, wah-wah, overdrive, tremolo, etc
and more.

7
 Compatibility: Ensure compatibility with a range of audio file formats to allow users
flexibility in utilizing their existing recordings. Compatibility with various guitar tones
and playing styles should also be considered.
 Optimization: Optimize the computational efficiency of the system to handle large audio
files and multiple effects simultaneously, without compromising the quality of the
processed sound.

1.3. Objective of the Project

Develop MATLAB-Based Effects: Implement a range of guitar effects (distortion, delay,


modulation, etc.) using MATLAB's signal processing tools for post-processing pre-recorded
guitar audio.
User-Friendly Interface: Create an intuitive and accessible user interface within MATLAB to
allow musicians and enthusiasts to easily apply and customize these effects to recorded guitar
tracks.
Preserve Audio Quality: Ensure non-destructive application of effects to maintain the original
quality of the guitar audio while enhancing its tonal characteristics through the signal processing
algorithms.

1.4. Significance of Study

The project, "MATLAB-Based Guitar Multi-Effects Signal Processing System for Post-
Processing," carries substantial significance across multiple fronts within the realm of musical
technology. It represents a groundbreaking departure from conventional guitar effect pedals,
introducing a pioneering approach to signal processing that extends beyond real-time alterations.
By harnessing MATLAB's powerful signal processing capabilities, this initiative serves as a
technological vanguard, advancing the domain through tailored algorithms designed specifically
for enhancing recorded guitar audio. Notably, the project prioritizes preserving the original
sound quality while seamlessly incorporating effects such as distortion, delay, and modulation.

Moreover, the project accentuates the user experience by focusing on the creation of an intuitive
interface within MATLAB. This user-friendly design empowers musicians and enthusiasts to
effortlessly apply and personalize these effects, potentially setting new benchmarks for
accessibility in music software. The outcomes of this endeavor offer a comprehensive blueprint
for future developments, providing insights into the integration of hardware and software for
8
compact, versatile systems suitable for various musical contexts. By delving into hardware-
software integration, compatibility, and power optimization, this project lays the groundwork for
potential innovations in musical equipment design.

Beyond technical advancements, the impact of this project extends to the music industry,
promising benefits for musicians across skill levels. It presents a cost-effective solution that
nurtures creativity and elevates performance quality, potentially catalyzing collaborations,
inspiring further research, and fostering innovation within the industry. Ultimately, the project's
overarching goal is to revolutionize the creation and integration of guitar effects, amplifying and
enriching musicians' artistic expression in unprecedented and transformative ways

1.5. Limitation

 Real-time Limitation: The project focuses solely on post-processing pre-recorded guitar


audio signals and music using MATLAB, lacking real-time application capabilities. It
does not cater to live performance settings where immediate effects manipulation during
guitar play is required.
 Effect Range and Complexity: While implementing various effects like distortion,
delay, and modulation, the project's effects library might be limited in comparison to
dedicated hardware solutions. Additionally, complexities in replicating certain intricate
analog effects through digital processing could pose limitations.
 Computational Resource Intensity: MATLAB's signal processing capabilities might
demand significant computational resources, potentially causing limitations in real-time
processing for lengthy or complex audio tracks, impacting system performance.

9
CHAPTER 2: LITERATURE SURVEY

Digital signal processing (DSP) has revolutionized guitar effects, as shown in the research by F.
Miranda and J. Huovilainen (2015). They explored how DSP techniques transformed traditional
analog guitar effects into versatile digital solutions. Their work demonstrated how digital
processing allows the replication of classic effects and the creation of innovative ones. This shift
from analog to digital systems paved the way for programmable, cost-effective, and diverse
guitar effects.[1]

Moreover, MATLAB's role in audio signal processing has been extensively studied by A. Rix,
M. Applebaum, and M. Duraiswami (2001). Their research focused on showcasing MATLAB's
effectiveness in implementing various algorithms for sound enhancement and modification. They
highlighted MATLAB's capabilities in handling complex audio tasks, indicating its significance
in applications related to music processing.[2]

In another study, J. Smith (2018) delved into post-processing guitar effects, emphasizing the
importance of altering pre-recorded guitar tracks rather than using real-time effects pedals.
Smith's work discussed the value of non-real-time manipulation in preserving the original audio
quality while applying effects like distortion, delay, and modulation. This approach offers a
different perspective on enhancing recorded guitar audio and diverges from traditional real-time
effects methods.[3]

Studies by L. Chen and K. Johnson (2020) investigated innovative methods for implementing
guitar effects using machine learning algorithms. Their work focused on creating intelligent
systems capable of recommending and customizing effects based on a guitarist's playing style
and preferences. This exploration of machine learning in guitar effects signifies a promising
direction, potentially revolutionizing the way effects are personalized and applied in musical
compositions by using ADC and DAC.[4]

10
CHAPTER 3: PROJECT METHODOLOGY

3.1. Methodology

The project was implemented in a systematic process, beginning with defining inputs—audio
signals from either a microphone or pre-recorded files. Specific procedures involved designing
and coding individual modules for distortion, fuzz, delay, flanger, wah-wah, overdrive, chorus,
tremolo and reverb effects. These modules were developed separately to ensure a modular
structure, facilitating easier management and expansion. MATLAB served as the primary tool
for coding and non real-time processing due to its convenience in signal processing tasks. The
final outcome was a cohesive system featuring a graphical user interface for users to apply and
visualize effects on their audio inputs in real-time as well as for recorded audio. In simpler terms,
we began by obtaining audio inputs, then followed specific steps to design and code effects like
distortion and fuzz using MATLAB code. MATLAB acted as a toolbox for building and testing
the project, resulting in a system where users can easily experiment with their sound, observing
instant changes on the computer screen.

3.1.1. Effect Specification

3.1.1.1. Clean Effect:

The Clean effect aims to reproduce the natural sound of the guitar without any additional
processing. While it may seem straightforward, achieving a faithful representation of the clean
guitar signal involves careful consideration of factors such as frequency response, dynamics, and
tonal balance. The algorithm for the clean effect should maintain the original characteristics of
the guitar sound, ensuring minimal coloration or alteration.
3.1.1.2. Distortion Effect:

The Distortion effect involves the intentional clipping or saturation of the guitar signal, resulting
in a gritty and harmonically rich sound. The following steps involve in distortion effects:
 Pre-processing: High-pass filtering removes low-frequency components from the signal.
This is useful to prevent unwanted low-frequency signals from affecting the distortion
process. The mathematical operation can be described as:

11
M N
y [n]=∑ ( b kx [n−k ] ) −¿ ∑ ( a ky [n−k ] ) ¿
k=0 k=1

Where b and a are the filter coefficients, x[n] is the input signal, and y[n] is the filtered
output signal.
Impulse Response: The impulse response of a high-pass filter shows how the filter
responds to a delta function. For a Butterworth filter, this is characterized by a smooth
roll-off beyond the cutoff frequency.
 Nonlinear Transformation: The core of the distortion effect involves applying a
nonlinear transformation to the signal. This process introduces new frequency
components (harmonics) that are not present in the original signal.
 Hard clipping: Hard clipping limits the amplitude of the signal to a predefined threshold.

{
threshold ,if x∧[n]> threshold
Mathematically: y[n]= −threshold if ∧ x [n ]←threshold
x [ n ] othewise
This operation can be considered as a piecewise linear function that restricts the signal
within a range. Clipping distorts the signal by flattening peaks, creating additional
harmonics, particularly odd harmonics, which contribute to the characteristic sound of
distortion.
 Post processing: After the nonlinear transformation, a low-pass filter is applied to
smooth the harsh high-frequency components introduced by the distortion. The low-pass
filter operation is similar to the high-pass filter, but with coefficients designed to
attenuate frequencies above a certain cutoff.
 Impact on signal properties:
 Frequency domain
 Before Distortion: The signal has its original frequency
components.
 After Distortion: Nonlinear transformations introduce harmonics.
For instance, if the input is a sinusoidal signal of frequency f, the
output will contain f, 3f, 5f, etc. The intensity and presence of these
harmonics depend on the type and degree of nonlinearity applied.

12
 Time domain
 Before Distortion: The waveform is smooth, without abrupt
changes.
 After Distortion: The waveform shows flattened peaks (in hard
clipping) reflecting the nonlinearity applied.

3.1.1.3. Fuzz Effect:

The fuzz effect is a soft version of distortion effect used in electric guitar playing. It is
characterized by a buzzy, saturated sound and is often associated with rock, blues, and
psychedelic music. The primary goal of the fuzz effect is to clip the guitar signal in a way that
produces a heavily distorted and sustaining tone.
 Pre-processing includes High-pass filtering same as distortion.
 Nonlinear transformation is implemented using wave shaping technique. Wave shaping
introduces harmonics by transforming the waveform in a nonlinear manner.
 Polynomial Wave Shaping is a common method, where the input signal is
transformed using a polynomial function: y [ n ] =x [ n ] −ax [ n ]3
This creates a type of soft clipping that adds harmonics to the signal.
 The nonlinear transformation stage does not have a straightforward impulse
response because it is a memoryless nonlinear operation. Instead, its effect is best
understood by examining its impact on the signal's amplitude and harmonic
content.
 Post-processing: After the nonlinear transformation, the signal often contains harsh
high-frequency components. A low-pass filter is applied to smooth out these components,
making the distortion more pleasant to the ear.
 In frequency Domain: The original signal has a certain spectral content. After applying
the nonlinear transformation (wave shaping), new frequency components (harmonics) are
introduced. The low-pass filter then attenuates some of these high-frequency components.

13
3.1.1.4. Delay Effect:

A delay effect involves playing back the audio signal after a short time interval. This creates an
echo-like effect
In signal processing term, a delay is implemented using a delay line, which stores the signal and
plays it back after a specified number of samples. The delay can be described as:

y [n]=x [n]+αx [n−D]

where:

 x [n] is the input signal.


 y [n] is the output signal.
 D is the delay in samples.
 α is the feedback gain.

3.1.1.5. Reverb Effect

Reverb simulates the reflections of sound in an environment, creating a sense of space. Reverb is
typically created by combining multiple delay lines with feedback and low-pass filtering to
simulate the natural decay of reflections.
 Combo and All-Pass Filters: Reverb can be built using comb filters and all-pass
filters to create a dense series of echoes that decay over time.

Combo filter: y [n]=x [n]+αy [n−D]

All-Pass Filter: y [n]=αx [n]+ x [n−D]−αy[n−D]

3.1.1.6. Flanger effect

A flanger effect is created by mixing the input signal with a delayed version of itself, where the
delay time is modulated by a low-frequency oscillator (LFO).
 LFO Modulation: The delay time varies over time, creating a sweeping effect.
The delayed signal is mixed back with the original signal to create constructive
and destructive interference.

y [n]=x [n]+αx [ n−D (t ) ] where D(t) is the time-varying delay.

14
3.1.1.7. Tremolo effect

The tremolo effect involves modulating the amplitude of the audio signal with a low-frequency
oscillator (LFO). This modulation causes the volume of the sound to increase and decrease
periodically, creating a tremolo effect.
 Amplitude Modulation: The core of the tremolo effect is amplitude modulation.
The input signal x [n] is multiplied by a modulation signal m[n], which is
typically a sine wave or another low-frequency waveform.
y [n]=x [n]⋅ m[n ]
 Modulation Signal (LFO): The modulation signal m[n] is generated using an
LFO, which oscillates at a frequency typically between 1 Hz and 10 Hz. This
signal controls the depth and rate of the tremolo effect.
m[n]=1+ β sin ⁡(2 π f LFO n /Fs)
Where:β is the modulation depth, controlling the extent of the amplitude
variation.
Fs is the sampling frequency.
 Applying Tremolo effect: The clean audio signal is multiplied by the modulation
signal to produce the tremolo effect

3.1.1.8. Overdrive Effect:

The overdrive effect is a type of distortion effect that simulates the sound of an overdriven tube
amplifier. It is achieved by non-linear processing of the audio signal, resulting in harmonic
distortion and increased sustain.
The core concept of the overdrive effect is to apply non-linear processing to the input signal,
which typically involves:

 Input Signal Amplification: The input signal x [n] is amplified by a gain factor
G.
y [n]=G⋅ x [n]
 Non-linear Transformation: The amplified signal is processed through a non-
linear function f [n] to introduce distortion. The amplified signal is passed through
a hyperbolic tangent function to apply soft clipping, introducing harmonic
distortion.
f ( y [n])=tanh( y [n])

15
 Filtering: A second-order Butterworth low-pass filter is designed to smooth the
harsh high frequencies introduced by the distortion.

3.1.1.9. Wah-wah effects

The wah-wah effect is a dynamic band-pass filter whose center frequency is modulated by a low-
frequency oscillator (LFO), creating a sweeping effect.
 Parameter Initialization: Set up the damping factor, LFO frequency, and
frequency range for the sweep.
 Cutoff Frequency Array: Generate a sequence of cutoff frequencies to modulate
the band-pass filter.
 Filter Coefficients: Calculate the filter coefficients dynamically based on the
current cutoff frequency.
 Filter Processing: Use a recursive loop to process each sample, updating the
high-pass, band-pass, and low-pass filter states iteratively.
 Normalization: Normalize the output to avoid clipping and maintain consistent
output levels.

3.1.1.10. Chorus effects

The chorus effect is a type of modulation effect that simulates the sound of multiple instruments
or voices playing in unison. This is achieved by mixing the original audio signal with delayed
versions of itself, where the delay times are modulated to create a slight detuning effect.
 Parameter Initialization: Set up the base delay time, modulation depth, and
modulation rate.
 Modulation Signal Generation: Generate an LFO signal (sine wave) to
modulate the delay time.
 Processing Loop: For each sample, calculate the current delay time, mix the
original and delayed signals, and update the output.
 Normalization: Normalize the output to avoid clipping and maintain consistent
levels.

16
3.1.2. Implementation of Code
function guitarMultiEffectsGUI
% Create the main GUI figure
fig = uifigure('Name', 'Guitar Multi Effects', 'Position', [100, 100, 1200, 800], 'Color', [0.8, 0.8, 0.8]);

% UI components for loading audio file


btnLoad = uibutton(fig, 'Text', 'Load Audio', 'Position', [20, 750, 100, 30], 'ButtonPushedFcn', @(btn, event)
loadAudio());
lblFileName = uilabel(fig, 'Position', [140, 750, 300, 30], 'Text', 'No file loaded');

% Dropdown for selecting effects


lblEffect = uilabel(fig, 'Position', [20, 700, 100, 30], 'Text', 'Select Effect:');
ddEffect = uidropdown(fig, 'Position', [140, 700, 150, 30], ...
'Items', {'Reverb', 'Delay', 'Flanger', 'Distortion', 'Fuzz', 'Chorus', 'Overdrive', 'Wah-Wah', 'Tremolo'}, ...
'ValueChangedFcn', @(dd, event) updateEffectParams());

% Effect parameter slider


lblParam = uilabel(fig, 'Position', [320, 700, 150, 30], 'Text', 'Effect Parameter:');
sldParam = uislider(fig, 'Position', [470, 715, 200, 3], 'Limits', [0, 1], 'Value', 0.5, 'ValueChangedFcn', @(sld, event)
applyEffect());

% Volume control slider


lblVolume = uilabel(fig, 'Position', [320, 650, 150, 30], 'Text', 'Volume:');
sldVolume = uislider(fig, 'Position', [470, 665, 200, 3], 'Limits', [0, 1], 'Value', 0.5, 'ValueChangedFcn', @(sld,
event) applyEffect());

% Buttons for audio playback controls


btnPlay = uibutton(fig, 'Text', 'Play', 'Position', [20, 650, 100, 30], 'ButtonPushedFcn', @(btn, event) playAudio());
btnPause = uibutton(fig, 'Text', 'Pause', 'Position', [140, 650, 100, 30], 'ButtonPushedFcn', @(btn, event)
pauseAudio());
btnStop = uibutton(fig, 'Text', 'Stop', 'Position', [260, 650, 100, 30], 'ButtonPushedFcn', @(btn, event) stopAudio());

% Axes for plotting original and processed audio


axOriginal = uiaxes(fig, 'Position', [20, 400, 550, 250]);
title(axOriginal, 'Original Audio');
axOriginal.XLabel.String = 'Samples';
axOriginal.YLabel.String = 'Amplitude';

axProcessed = uiaxes(fig, 'Position', [20, 100, 550, 250]);


title(axProcessed, 'Processed Audio');
axProcessed.XLabel.String = 'Samples';
axProcessed.YLabel.String = 'Amplitude';

% Global variables to store audio data and player object


audioData = [];
processedAudio = [];
fs = 44100;
player = [];
function loadAudio()
% Load an audio file
[file, path] = uigetfile('*.wav', 'Select an audio file');
if isequal(file, 0)
return;
end
17
[audioData, fs] = audioread(fullfile(path, file));
lblFileName.Text = file;
plot(axOriginal, audioData);
applyEffect();
end

function updateEffectParams()
% Effect parameters based on selected effect
effect = ddEffect.Value;
switch effect
case 'Reverb'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Short', 'Medium', 'Long'};
case 'Delay'
sldParam.Limits = [0, 2];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 1, 2];
sldParam.MajorTickLabels = {'Short', 'Medium', 'Long'};
case 'Flanger'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Weak', 'Medium', 'Strong'};
case 'Distortion'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Light', 'Medium', 'Heavy'};
case 'Fuzz'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Light', 'Medium', 'Heavy'};
case 'Chorus'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Weak', 'Medium', 'Strong'};
case 'Overdrive'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Light', 'Medium', 'Heavy'};
case 'Wah-Wah'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];
sldParam.MajorTickLabels = {'Low', 'Medium', 'High'};

case 'Tremolo'
sldParam.Limits = [0, 1];
sldParam.Value = 0.5;
sldParam.MajorTicks = [0, 0.5, 1];

18
sldParam.MajorTickLabels = {'Slow', 'Medium', 'Fast'};

end
applyEffect();
end

function applyEffect()
if isempty(audioData)
return;
end
effect = ddEffect.Value;
param = sldParam.Value;
volume = sldVolume.Value;
processedAudio = audioData;
switch effect
case 'Reverb'
processedAudio = reverbEffect(audioData, fs, param);
case 'Delay'
processedAudio = delayEffect(audioData, fs, param);
case 'Flanger'
processedAudio = flangerEffect(audioData, fs, param);
case 'Distortion'
processedAudio = distortionEffect(audioData, fs, param);
case 'Fuzz'
processedAudio = fuzzEffect(audioData, fs, param);
case 'Chorus'
processedAudio = chorusEffect(audioData, fs, param);
case 'Overdrive'
processedAudio = overdriveEffect(audioData, fs, param);
case 'Wah-Wah'
processedAudio = wahwahEffect(audioData, fs, param);

case 'Tremolo'
processedAudio = tremoloEffect(audioData, fs, param);

end
processedAudio = processedAudio * volume;
plot(axProcessed, processedAudio);

%The audio player with the new processed audio


if ~isempty(player)
stop(player);
end
player = audioplayer(processedAudio, fs);
end

function playAudio()
if ~isempty(player)
play(player);
end
end

function pauseAudio()
if ~isempty(player)
pause(player);

19
end
end

function stopAudio()
if ~isempty(player)
stop(player);
end
end
end

function output = reverbEffect(input, fs, param)


% Parameters:

depth = param; % Depth of the reverb effect (0 to 1)


delayTime = param * 0.1; % Scaling param to range of 0 to 0.1 seconds
feedback = 0.5; % Feedback gain
output = customReverb(input, depth, delayTime, feedback, fs);
end

function [out] = customReverb(in, depth, delay, feedback, fs)


% CUSTOMREVERB simulates a basic reverb effect
sampleDelay = ceil(delay * fs);
% Initialize delayed signal
delayedSignal = zeros(length(in) + sampleDelay, 1);
% Apply delay with feedback
for i = 1:length(in)
if i > sampleDelay
delayedSignal(i) = in(i) + feedback * delayedSignal(i - sampleDelay);
else
delayedSignal(i) = in(i);
end
end
% Apply depth control to delayed signal
out = in + depth * delayedSignal(1:length(in));
end
%Delay effect
function output = delayEffect(input, fs, param)
depth = 0.5; % Assuming a default depth of 0.5
delayTime = param * 2; % Scaling param to range of 0 to 2 seconds
feedback = 0.5; % Assuming a default feedback of 0.5
output = digdelay(input, depth, delayTime, feedback, fs);
end
function [out] = digdelay(in, depth, delay, feedback, fs)
dbstop if error
sampleDelay = ceil(delay * fs); % delay in sec * samp/sec = samples
delayedSignal = [zeros(sampleDelay, 1); in; zeros(64 * fs - sampleDelay, 1)];
in = [in; zeros(64 * fs, 1)];

n = 1; % iterator variable for # delays


while feedback >= 0.0001 % going to continually decrease feedback inside loop
delayedSignal = delayedSignal + ...
feedback * [zeros(sampleDelay * n, 1); ...
delayedSignal(1:end - sampleDelay * n)];
feedback = feedback ^ 2;
n = n + 1;

20
end
out = in + depth * delayedSignal;
content = find(out, 1, 'last');
out = out(1:content);
end
% Flanger effect
function output = flangerEffect(input, fs, param)
mix = 0.5; % Assuming a default mix of 0.5
delayTime = 5; % Assuming a default delay time of 5 milliseconds
width = 2; % Assuming a default width of 2 milliseconds
rate = param * 5; % Scaling param to range of 0.05 to 5 Hz
output = flanger(input, mix, delayTime, width, rate, fs);
end
% Flanger function
function [out] = flanger(in, mix, delay, width, rate, fs)
in = interp1(1:length(in), in, 1:0.25:length(in));
fsn = fs * 4;

minDelaySamp = ceil(delay * fsn / 1000); % convert to msec, then samples


maxDelaySamp = ceil((delay + width) * fsn / 1000); % convert to msec, then samples
n = (1:length(in) + maxDelaySamp)'; % how long to extend in by for LFO
LFO = sawtooth(2 * pi * rate / fsn * n, 0.5); % sawtooth more commonly used in flangers
delayTimeSamples = (delay + width / 2 + width / 2 * LFO) * fsn / 1000;
% instantaneous delay in samples
out = zeros(length(in) + minDelaySamp, 1); % initialized output vec
out(1:maxDelaySamp) = in(1:maxDelaySamp);
% copy front of signal before min delay

for i = maxDelaySamp + 1:length(in) % starting from next sample


delaySamples = ceil(delayTimeSamples(i)); % whole number of current delay
out(i) = in(i) + mix * out(i - delaySamples); % add input and fraction of delay
end
out = downsample(out, 4);
end
%Distortion effect
function output = distortionEffect(input, fs, param)
gain = 1 + param * 10; % gain from 1 to 11
tone = param; % tone control from 0 (bass) to 1 (treble)
output = distortion(input, gain, tone, fs);
end
function [out] = distortion(in, gain, tone, fs)
B = in;
% B = B / max(abs(B)); % Uncomment this line if you need normalization
B = gain * B;
B = erf(B);
[ZL, PL, KL] = butter(1, 1200 / (fs / 2), 'low');
[ZH, PH, KH] = butter(1, 265 / (fs / 2), 'high');
[BL, AL] = zp2tf(ZL, PL, KL);
[BH, AH] = zp2tf(ZH, PH, KH);
% OUTPUT - filter based on position/value of tone control
out = (1 - tone) * filter(BL, AL, B) + tone * filter(BH, AH, B);
end
%Fuzz effect
function output = fuzzEffect(input, fs, param)
gain = 1 + param * 20;

21
output = tanh(gain * input);
end
% chorus effect
function output = chorusEffect(input, fs, param)
delay = round(0.02 * fs); % 20 ms delay
depth = round(param * 0.01 * fs); % depth of modulation
rate = 0.25; % modulation rate in Hz
modSignal = depth * sin(2 * pi * rate * (1:length(input))' / fs);
output = zeros(size(input));
for n = 1:length(input)
delaySamples = round(delay + modSignal(n));
if n > delaySamples
output(n) = input(n) + input(n - delaySamples);
else
output(n) = input(n);
end
end
output = output / max(abs(output)); % Normalize the output
end
% Overdrive effect
function output = overdriveEffect(input, fs, param)
gain = 1 + param * 10; % Amplification gain based on param
toneCutoff = 2000; % Low-pass filter cutoff frequency in Hz (can be adjusted)
% Amplify the input signal
amplifiedSignal = gain * input;
% Apply non-linear transformation (soft clipping)
distortedSignal = tanh(amplifiedSignal);
% Design a low-pass filter (2nd order Butterworth)
[b, a] = butter(2, toneCutoff / (fs / 2), 'low');
% Apply low-pass filter to smooth the distorted signal
output = filter(b, a, distortedSignal);
end
%wah-wah effect
function output = wahwahEffect(input, fs, param)
dampFactor = 0.05;
wahFreq = 1000;
min_f = 250;
max_f = 5000;
centre_f = wahFreq / fs;
cutoff_freq = min_f:centre_f:max_f;
while(length(cutoff_freq) < length(input))
cutoff_freq = [cutoff_freq max_f:-centre_f:min_f];
cutoff_freq = [cutoff_freq min_f:centre_f:max_f];
end
cutoff_freq = cutoff_freq(1:length(input));
coF = 2 * sin((pi * cutoff_freq(1) / fs));
Q = 2 * dampFactor;
highpass = zeros(size(input));
lowpass = zeros(size(input));
bandpass = zeros(size(input));
highpass(1) = input(1);
bandpass(1) = coF * highpass(1);
lowpass(1) = coF * bandpass(1);
for n = 2:length(input)
highpass(n) = input(n) - lowpass(n-1) - Q * bandpass(n-1);

22
bandpass(n) = coF * highpass(n) + bandpass(n-1);
lowpass(n) = coF * bandpass(n) + lowpass(n-1);
coF = 2 * sin((pi * cutoff_freq(n)) / fs);
end
output = bandpass / max(abs(bandpass));
end
%Tremolo effect
function output = tremoloEffect(input, fs, param)
rate = 1 + param * 9; % modulation rate from 1 to 10 Hz
depth = param; % modulation depth from 0 to 1
lag = 0; % no stereo lag for simplicity
LFO = 'sine'; % using sine wave for LFO
output = tremolo(input, fs, rate, depth, lag, LFO);
end
function [ out ] = tremolo( in, fs, rate, depth, lag, LFO )
lagSamples = ceil(lag/1000*fs); % converts ms of lag to # samples
n = (1:length(in))';
argWaveLeft = 2*pi*rate/fs * n;
argWaveRight = 2*pi*rate/fs * (n + lagSamples);
switch LFO
case {'squ', 'square'}
wave_left = depth * square(argWaveLeft);
wave_right = depth * square(argWaveRight);
case {'tri', 'triangle'}
wave_left = depth * sawtooth(argWaveLeft, 0.5);
wave_right = depth * sawtooth(argWaveRight, 0.5);
case {'sin', 'sine'}
wave_left = depth * sin(argWaveLeft);
wave_right = depth * sin(argWaveRight);
end
left = in .* (1 + wave_left);
right = in .* (1 + wave_right);
out = [left, right]; % creating a stereo output
end

23
3.2. Block Diagram

Recorded audio Choose desired effect


Load on GUI
from Guitar

Speaker Signal processing


using MATLAB

Figure 1 block diagram

1. Guitar Input: The project begins with the guitar as the primary input source. The
electrical signals generated by playing the guitar strings are the raw input signals for the
effects processing system.
2. Load on GUI: The recorded audio is fetched into the system using load panel GUI.
3. Choose desired effects: User chooses the desired effects to apply on fetched audio.
4. MATLAB Processing: Our custom signal processing algorithm is employed to apply
various effects such as delay, fuzz, reverb, chorus, distortion etc. to these recorded guitar
tracks. Custom Algorithms and functions are utilized to modify the audio signals based
on the desired effects.
5. Output for Playback or Usage: The processed audio files can be played back through
speakers.

24
3.3. Gantt Chart

MONTHS Aug Oct Dec Feb Apr June

Literature Review
Proposal
Conceptualization
MATLAB code

Effects Testing

Signal Analysis
Initial Test
Error Analysis
Final Presentation

Work completed
Work Remaining

25
CHAPTER 4: RESULT OF PROJECT

4.1. Effects Obtained after digital processing of the guitar signal:

We are all familiar with versatility of the digital domain. Signals are very easily and
effectively processed and transformed after converting them in digital format. Therefore,
we also intend to obtain the following effects of the guitar signal by processing them in a
MATLAB.
 Delay
 Distortion
 Fuzz
 Tremolo
 Overdrive
 Chorus
 Wah -wah
 Reverb
 Flanger

We tested all effects whose output signal are as follow

Figure 2 before loading file


26
Figure 3 Original audio signal

Figure 4 Reverb effect

27
Figure 5 Delay effect

Figure 6 Flanger effect

28
Figure 7 Distortion effect

Figure 8 Fuzz effect

29
Figure 9 Chorus effect

Figure 10 Overdrive effect

30
Figure 11 Wah-wah effect

Figure 12 Tremolo effect

31
CHAPTER 5: CONCLUSION AND DISCUSSION

This project successfully developed a user-friendly guitar multi-effects application utilizing


MATLAB. The application offers a comprehensive selection of guitar effects (reverb, delay,
flanger, distortion, fuzz, chorus, overdrive, wah-wah, and tremolo) with real-time parameter
control through an intuitive graphical user interface. Users can load audio files containing guitar
performances, experiment with various effects and their settings, and listen to the processed
sound through playback functionality.The project demonstrates the effectiveness of leveraging
DSP techniques for creating software-based guitar effects processors. While the implemented
algorithms represent basic models compared to professional hardware pedals, they provide a
solid foundation for understanding and exploring the principles of guitar effects.

The project successfully achieves its core objectives and highlights the potential of software-
based solutions for guitar effects processing. Here are some key points for further discussion:

 Future Enhancements: The application's functionality could be expanded by


incorporating additional effects, advanced DSP algorithms for more realistic
simulations, and the ability to process live guitar input through an audio interface.
 User Experience Optimization: The GUI design can be further improved for enhanced
user experience. Features such as presets for popular effect combinations, effect
chaining capabilities, and visual feedback during parameter adjustments could be
implemented.
 Platform Exploration: While the current implementation utilizes MATLAB, the core
concepts can be translated to other programming languages for potential mobile app
development or integration with digital audio workstations (DAWs).

This project serves as a stepping stone for further exploration in the realm of software-based
guitar effects processing. With continued development and refinement, such applications have
the potential to become valuable tools for both novice and seasoned guitarists, offering a
convenient and versatile platform for sonic experimentation and creative expression.

32
33
REFRENCES

[1] M. Karjalainen, H. Penttinen, and V. Valimaki, “Acoustic sound from the electric guitar
using DSP techniques,” ICASSP, IEEE Int. Conf. Acoust. Speech Signal Process. - Proc.,
vol. 2, no. June, pp. 773–776, 2000, doi: 10.1109/ICASSP.2000.859074.
[2] J. Galletta, S. Hwang, and Y. Shrestha, “Delong ’ s Fan Club : Designing a Cost- Efficient
Programmable Multi Effects Pedal For Electric Guitar,” pp. 1–30, 2020.
[3] M. S. Alencar and V. C. da Rocha, “Communication systems,” Commun. Syst., pp. 1–465,
2022, doi: 10.1007/978-3-031-12067-1.
[4] M. Space, P. Memory, P. Control, T. Multichannel, B. Serial, and R. Operations, “−
Programmable Code Parameters,” Office, no. August, 2005.

34

You might also like