Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Audio Equalization System

Mudra Shah – 22BEC075


Marut Patel – 22BEC088

Problem Statement – Create an audio equalizer system that allows users to


adjust frequency bands to modify the sound of audio signals.
Description - An audio equalization system is a crucial component in audio
processing that allows for the manipulation of the frequency response of an
audio signal. It enables the adjustment of the relative levels of different
frequencies within the audio spectrum, thereby shaping the tonal characteristics
of the sound. The key components and functionalities of an audio equalization
system:
1) Frequency Bands: An equalization system typically consists of multiple
frequency bands, each representing a specific range of frequencies.
Common configuration include graphic equalizers with fixed frequency
bands or parametric equalizers with adjustable frequency bands.
2) Gain Control: Each frequency band in the equalizer allows for the
adjustment of gain, which determines the level of amplification or
attenuation applied to the corresponding range of frequencies. Positive
gain boosts the selected frequencies, while negative gain reduces them.
3) Filter Types: Different types of filters can be used within each frequency
band to achieve various equalization effects. Common filter types
include:
 Low-pass filters: Allow frequencies below a certain cutoff point to
pass through while attenuating higher frequencies.
 High-pass filters: Permit frequencies above a specified cutoff point
to pass through while attenuating lower frequencies.
 Band-pass filters: Only allow frequencies within a specific range to
pass through, attenuating frequencies outside this range.
 Peaking filters: Boost or cut frequencies around a centre frequency,
creating a peak or dip in the frequency response curve.
 Shelving filters: Adjust all frequencies above or below a specified
cutoff point, providing a shelf-like response.
4) Adjustable Parameters: Parametric equalizers offer more flexibility by
allowing adjustment of additional parameters such as centre frequency,
bandwidth (Q-factor), and filter slope. This enables precise control over
the shape and width of the frequency response curve for each band.
5) Real-time Processing: Modern equalization systems often operate in real-
time, allowing adjustments to be made dynamically while audio is being
played or recorded. This enables audio engineers and users to fine-tune
the sound to their preferences or requirements during playback or live
performances.
6) Presets and Profiles: Modern equalization systems often operate in real-
time, allowing adjustments to be made dynamically while audio is being
played or recorded. This enables audio engineers and users to fine-tune
the sound to their preferences or requirements during playback or live
performances.
7) Graphical User Interface (GUI): Equalization systems are often
accompanied by user-friendly GUIs that visually represent the frequency
response curve and allow users to interactively adjust the equalizer
settings using sliders, knobs, or graphical displays.
Flowchart-
Input- Read audio signal

Run MATLAB GUI to


equalize

Reconstruct signal
components

Output waveform of
Original Audio and Applied
filter Audio
Matlab Code (App Designer Code)-
classdef tes < matlab.apps.AppBase

% Properties that correspond to app components


properties (Access = public)
UIFigure matlab.ui.Figure
AxesPanel matlab.ui.container.Panel
AppliedFilterWaveformLabel matlab.ui.control.Label
OriginalLabel matlab.ui.control.Label
UIAxes_2 matlab.ui.control.UIAxes
UIAxes matlab.ui.control.UIAxes
SettingsPanel matlab.ui.container.Panel
PauseButton matlab.ui.control.Button
StopButton matlab.ui.control.Button
ResumeButton matlab.ui.control.Button
PlayButton matlab.ui.control.Button
PresetsPanel matlab.ui.container.Panel
CLASSICALButton matlab.ui.control.Button
PARTYButton matlab.ui.control.Button
TECHNOButton matlab.ui.control.Button
ROCKButton matlab.ui.control.Button
REGGAEButton matlab.ui.control.Button
POPButton matlab.ui.control.Button
EqualizerPanel matlab.ui.container.Panel
kHzLabel_6 matlab.ui.control.Label
kHzLabel_5 matlab.ui.control.Label
kHzLabel_4 matlab.ui.control.Label
kHzLabel_3 matlab.ui.control.Label
kHzLabel_2 matlab.ui.control.Label
kHzLabel matlab.ui.control.Label
HzLabel_4 matlab.ui.control.Label
HzLabel_3 matlab.ui.control.Label
HzLabel matlab.ui.control.Label
HzLabel_2 matlab.ui.control.Label
HzSlider_10 matlab.ui.control.Slider
HzSlider_9 matlab.ui.control.Slider
HzSlider_8 matlab.ui.control.Slider
HzSlider_7 matlab.ui.control.Slider
HzSlider_6 matlab.ui.control.Slider
HzSlider_5 matlab.ui.control.Slider
HzSlider_4 matlab.ui.control.Slider
HzSlider_3 matlab.ui.control.Slider
HzSlider_2 matlab.ui.control.Slider
HzSlider matlab.ui.control.Slider
Panel matlab.ui.container.Panel
BrowseButton matlab.ui.control.Button
FileAddressEditField matlab.ui.control.EditField
FileAddressEditFieldLabel matlab.ui.control.Label
end

% Callbacks that handle component events


methods (Access = private)

% Button pushed function: BrowseButton


function BrowseButtonPushed(app, event)
[filename, pathname] = uigetfile({'*.wav'}, 'File Selector');
if isequal(filename, 0)
% User clicked Cancel button
return;
else
fullpathname = fullfile(pathname, filename);
app.FileAddressEditField.Value = fullpathname;
end
end

% Button pushed function: PauseButton


function PauseButtonPushed(app, event)
global player;
% Check if the player exists
if isempty(player) || ~isvalid(player)
disp('No audio is currently playing.');
return;
end

% Pause the audio


pause(player);
disp('Audio paused.');
end

% Button pushed function: ResumeButton


function ResumeButtonPushed(app, event)
global player;
% Check if the player exists
if isempty(player) || ~isvalid(player)
disp('No audio to resume.');
return;
end

% Resume the audio


resume(player);
disp('Audio resumed.');
end

% Button pushed function: StopButton


function StopButtonPushed(app, event)
global player;
% Check if the player exists
if isempty(player) || ~isvalid(player)
disp('No audio to stop.');
return;
end

% Stop the audio


stop(player);
disp('Audio stopped.');
end

% Button pushed function: POPButton


function POPButtonPushed(app, event)
% Check if a file is selected
if isempty(app.FileAddressEditField.Value)
disp('Please select a file before popping.');
return;
end

% Adjust the sliders based on the POP genre preset


app.HzSlider.Value = 5; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 3; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 1; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = -1; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = -2; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = -4; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = -5; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = -6; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = -8; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = -10; % Adjust slider for >15kHz

% Read the audio file


filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);

% Apply the pop effect (example: add zeros at midpoint)


midpoint = floor(length(audio) / 2);
audio(midpoint) = 0;

player = audioplayer(audio, Fs);


play(player);

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'Popped Waveform');
end

end

% Button pushed function: REGGAEButton


function REGGAEButtonPushed(app, event)
% Adjust the sliders based on the REGGAE genre preset
app.HzSlider.Value = 2; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 4; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 6; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = 8; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = 7; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = 5; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = 3; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = 2; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = 1; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = 1; % Adjust slider for >15kHz

% Display message indicating that REGGAE preset has been applied


disp('REGGAE preset applied.');
% Read the audio file
filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);

% Apply the REGGAE effect (example: reverse the audio)


audio = flipud(audio);
player = audioplayer(audio, Fs);
play(player);

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'REGGAE Waveform');
end
end

% Button pushed function: ROCKButton


function ROCKButtonPushed(app, event)
% Adjust the sliders based on the ROCK genre preset
app.HzSlider.Value = 3; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 5; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 7; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = 9; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = 8; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = 6; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = 4; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = 3; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = 2; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = 2; % Adjust slider for >15kHz

% Display message indicating that ROCK preset has been applied


disp('ROCK preset applied.');
% Read the audio file
filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);

% Apply the ROCK effect (example: increase amplitude)


audio = audio * 1.2;

player = audioplayer(audio, Fs);


play(player);

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'ROCK Waveform');
end
end

% Button pushed function: TECHNOButton


function TECHNOButtonPushed(app, event)
% Adjust the sliders based on the TECHNO genre preset
app.HzSlider.Value = 4; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 6; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 8; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = 7; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = 5; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = 3; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = 2; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = 1; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = 1; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = 1; % Adjust slider for >15kHz

% Display message indicating that TECHNO preset has been applied


disp('TECHNO preset applied.');
% Read the audio file
filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);

% Apply the TECHNO effect (example: low-pass filter)


fc = 4000; % Cut-off frequency
[b, a] = butter(4, fc/(Fs/2), 'low');
audio = filter(b, a, audio);

player = audioplayer(audio, Fs);


play(player);

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'TECHNO Waveform');
end
end

% Button pushed function: PARTYButton


function PARTYButtonPushed(app, event)
% Adjust the sliders based on the PARTY genre preset
app.HzSlider.Value = 5; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 7; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 9; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = 8; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = 6; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = 4; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = 3; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = 2; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = 1; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = 1; % Adjust slider for >15kHz

% Display message indicating that PARTY preset has been applied


disp('PARTY preset applied.');
% Read the audio file
filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);
% Apply the PARTY effect (example: add reverb)
try
audio = reverberator(audio, 'RoomSize', 0.5);
catch
disp('Error applying PARTY effect. Playback will continue without
effect.');
end

% Play the audio


player = audioplayer(audio, Fs);
try
play(player);
catch
disp('Error playing audio.');
end

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'PARTY Waveform');
end
end

% Button pushed function: CLASSICALButton


function CLASSICALButtonPushed(app, event)
% Adjust the sliders based on the CLASSICAL genre preset
app.HzSlider.Value = 3; % Adjust slider for 0-200Hz
app.HzSlider_2.Value = 5; % Adjust slider for 201-400Hz
app.HzSlider_3.Value = 7; % Adjust slider for 401-800Hz
app.HzSlider_4.Value = 6; % Adjust slider for 801-1500Hz
app.HzSlider_5.Value = 4; % Adjust slider for 1.5-3kHz
app.HzSlider_6.Value = 3; % Adjust slider for 3-5kHz
app.HzSlider_7.Value = 2; % Adjust slider for 5-7kHz
app.HzSlider_8.Value = 1; % Adjust slider for 7-10kHz
app.HzSlider_9.Value = 1; % Adjust slider for 10-15kHz
app.HzSlider_10.Value = 1; % Adjust slider for >15kHz

% Display message indicating that CLASSICAL preset has been applied


disp('CLASSICAL preset applied.');
% Read the audio file
filepath = string(app.FileAddressEditField.Value);
[audio, Fs] = audioread(filepath);

% Apply the CLASSICAL effect (example: add chorus)


chorusDelay = 0.025; % 25 milliseconds
audio = chorus(audio, Fs, 'Depth', 0.5, 'Delay', chorusDelay);

player = audioplayer(audio, Fs);


play(player);

% Plot the modified audio


plotAudio(app, audio, Fs);

% Helper function to plot audio waveform


function plotAudio(app, audio, Fs)
% Plot the audio waveform in UIAxes
t = (0:length(audio)-1) / Fs;
plot(app.UIAxes_2, t, audio);
xlabel(app.UIAxes_2, 'Time (s)');
ylabel(app.UIAxes_2, 'Amplitude');
title(app.UIAxes_2, 'CLASSICAL Waveform');
end
end

% Button pushed function: PlayButton


function PlayButtonPushed(app, event)
filepath = string(app.FileAddressEditField.Value);
if isempty(filepath)
disp('Please select a file before playing.');
return;
end
[audio, Fs] = audioread(filepath);

% Plot original audio waveform


t = (0:length(audio)-1) / Fs;
plot(app.UIAxes, t, audio);
title(app.UIAxes, 'Original Audio Waveform');
xlabel(app.UIAxes, 'Time (s)');
ylabel(app.UIAxes, 'Amplitude');

% Create and play audioplayer object


global player;
player = audioplayer(audio, Fs);
play(player);

end
end

% Component initialization
methods (Access = private)

% Create UIFigure and components


function createComponents(app)

% Create UIFigure and hide until all components are created


app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 1480 718];
app.UIFigure.Name = 'MATLAB App';

% Create Panel
app.Panel = uipanel(app.UIFigure);
app.Panel.Position = [31 632 596 77];

% Create FileAddressEditFieldLabel
app.FileAddressEditFieldLabel = uilabel(app.Panel);
app.FileAddressEditFieldLabel.HorizontalAlignment = 'right';
app.FileAddressEditFieldLabel.Position = [11 26 92 22];
app.FileAddressEditFieldLabel.Text = 'File Address';
% Create FileAddressEditField
app.FileAddressEditField = uieditfield(app.Panel, 'text');
app.FileAddressEditField.Position = [115 23 363 33];

% Create BrowseButton
app.BrowseButton = uibutton(app.Panel, 'push');
app.BrowseButton.ButtonPushedFcn = createCallbackFcn(app,
@BrowseButtonPushed, true);
app.BrowseButton.Position = [501 26 80 30];
app.BrowseButton.Text = 'Browse';

% Create EqualizerPanel
app.EqualizerPanel = uipanel(app.UIFigure);
app.EqualizerPanel.Title = 'Equalizer';
app.EqualizerPanel.Position = [31 309 643 320];

% Create HzSlider
app.HzSlider = uislider(app.EqualizerPanel);
app.HzSlider.Limits = [-15 15];
app.HzSlider.Orientation = 'vertical';
app.HzSlider.Position = [26 109 3 173];

% Create HzSlider_2
app.HzSlider_2 = uislider(app.EqualizerPanel);
app.HzSlider_2.Limits = [-15 15];
app.HzSlider_2.Orientation = 'vertical';
app.HzSlider_2.Position = [86 109 3 173];

% Create HzSlider_3
app.HzSlider_3 = uislider(app.EqualizerPanel);
app.HzSlider_3.Limits = [-15 15];
app.HzSlider_3.Orientation = 'vertical';
app.HzSlider_3.Position = [156 109 3 173];

% Create HzSlider_4
app.HzSlider_4 = uislider(app.EqualizerPanel);
app.HzSlider_4.Limits = [-15 15];
app.HzSlider_4.Orientation = 'vertical';
app.HzSlider_4.Position = [226 109 3 173];

% Create HzSlider_5
app.HzSlider_5 = uislider(app.EqualizerPanel);
app.HzSlider_5.Limits = [-15 15];
app.HzSlider_5.Orientation = 'vertical';
app.HzSlider_5.Position = [286 109 3 173];

% Create HzSlider_6
app.HzSlider_6 = uislider(app.EqualizerPanel);
app.HzSlider_6.Limits = [-15 15];
app.HzSlider_6.Orientation = 'vertical';
app.HzSlider_6.Position = [346 109 3 173];

% Create HzSlider_7
app.HzSlider_7 = uislider(app.EqualizerPanel);
app.HzSlider_7.Limits = [-15 15];
app.HzSlider_7.Orientation = 'vertical';
app.HzSlider_7.Position = [406 109 3 173];
% Create HzSlider_8
app.HzSlider_8 = uislider(app.EqualizerPanel);
app.HzSlider_8.Limits = [-15 15];
app.HzSlider_8.Orientation = 'vertical';
app.HzSlider_8.Position = [466 109 3 173];

% Create HzSlider_9
app.HzSlider_9 = uislider(app.EqualizerPanel);
app.HzSlider_9.Limits = [-15 15];
app.HzSlider_9.Orientation = 'vertical';
app.HzSlider_9.Position = [526 109 3 173];

% Create HzSlider_10
app.HzSlider_10 = uislider(app.EqualizerPanel);
app.HzSlider_10.Limits = [-15 15];
app.HzSlider_10.Orientation = 'vertical';
app.HzSlider_10.Position = [586 109 3 173];

% Create HzLabel_2
app.HzLabel_2 = uilabel(app.EqualizerPanel);
app.HzLabel_2.Position = [81 74 64 25];
app.HzLabel_2.Text = '201-400Hz';

% Create HzLabel
app.HzLabel = uilabel(app.EqualizerPanel);
app.HzLabel.Position = [21 52 57 27];
app.HzLabel.Text = '0-200Hz';

% Create HzLabel_3
app.HzLabel_3 = uilabel(app.EqualizerPanel);
app.HzLabel_3.Position = [151 50 89 29];
app.HzLabel_3.Text = '401-800Hz';

% Create HzLabel_4
app.HzLabel_4 = uilabel(app.EqualizerPanel);
app.HzLabel_4.Position = [221 75 70 24];
app.HzLabel_4.Text = '801-1500Hz';

% Create kHzLabel
app.kHzLabel = uilabel(app.EqualizerPanel);
app.kHzLabel.Position = [281 55 70 24];
app.kHzLabel.Text = '1.5-3kHz';

% Create kHzLabel_2
app.kHzLabel_2 = uilabel(app.EqualizerPanel);
app.kHzLabel_2.Position = [351 75 64 24];
app.kHzLabel_2.Text = '3-5kHz';

% Create kHzLabel_3
app.kHzLabel_3 = uilabel(app.EqualizerPanel);
app.kHzLabel_3.Position = [401 55 64 24];
app.kHzLabel_3.Text = '5-7kHz';

% Create kHzLabel_4
app.kHzLabel_4 = uilabel(app.EqualizerPanel);
app.kHzLabel_4.Position = [461 75 64 24];
app.kHzLabel_4.Text = '7-10kHz';

% Create kHzLabel_5
app.kHzLabel_5 = uilabel(app.EqualizerPanel);
app.kHzLabel_5.Position = [521 55 64 24];
app.kHzLabel_5.Text = '10-15kHz';

% Create kHzLabel_6
app.kHzLabel_6 = uilabel(app.EqualizerPanel);
app.kHzLabel_6.Position = [581 75 64 24];
app.kHzLabel_6.Text = '>15kHz';

% Create PresetsPanel
app.PresetsPanel = uipanel(app.UIFigure);
app.PresetsPanel.Title = 'Presets';
app.PresetsPanel.Position = [21 169 670 130];

% Create POPButton
app.POPButton = uibutton(app.PresetsPanel, 'push');
app.POPButton.ButtonPushedFcn = createCallbackFcn(app,
@POPButtonPushed, true);
app.POPButton.Position = [11 36 93 53];
app.POPButton.Text = 'POP';

% Create REGGAEButton
app.REGGAEButton = uibutton(app.PresetsPanel, 'push');
app.REGGAEButton.ButtonPushedFcn = createCallbackFcn(app,
@REGGAEButtonPushed, true);
app.REGGAEButton.Position = [111 36 103 53];
app.REGGAEButton.Text = 'REGGAE';

% Create ROCKButton
app.ROCKButton = uibutton(app.PresetsPanel, 'push');
app.ROCKButton.ButtonPushedFcn = createCallbackFcn(app,
@ROCKButtonPushed, true);
app.ROCKButton.Position = [221 37 100 52];
app.ROCKButton.Text = 'ROCK';

% Create TECHNOButton
app.TECHNOButton = uibutton(app.PresetsPanel, 'push');
app.TECHNOButton.ButtonPushedFcn = createCallbackFcn(app,
@TECHNOButtonPushed, true);
app.TECHNOButton.Position = [331 37 100 52];
app.TECHNOButton.Text = 'TECHNO';

% Create PARTYButton
app.PARTYButton = uibutton(app.PresetsPanel, 'push');
app.PARTYButton.ButtonPushedFcn = createCallbackFcn(app,
@PARTYButtonPushed, true);
app.PARTYButton.Position = [441 37 100 52];
app.PARTYButton.Text = 'PARTY';

% Create CLASSICALButton
app.CLASSICALButton = uibutton(app.PresetsPanel, 'push');
app.CLASSICALButton.ButtonPushedFcn = createCallbackFcn(app,
@CLASSICALButtonPushed, true);
app.CLASSICALButton.Position = [551 37 100 52];
app.CLASSICALButton.Text = 'CLASSICAL';

% Create SettingsPanel
app.SettingsPanel = uipanel(app.UIFigure);
app.SettingsPanel.Title = 'Settings';
app.SettingsPanel.Position = [20 21 671 137];

% Create PlayButton
app.PlayButton = uibutton(app.SettingsPanel, 'push');
app.PlayButton.ButtonPushedFcn = createCallbackFcn(app,
@PlayButtonPushed, true);
app.PlayButton.Position = [22 38 115 58];
app.PlayButton.Text = 'Play';

% Create ResumeButton
app.ResumeButton = uibutton(app.SettingsPanel, 'push');
app.ResumeButton.ButtonPushedFcn = createCallbackFcn(app,
@ResumeButtonPushed, true);
app.ResumeButton.Position = [374 38 115 58];
app.ResumeButton.Text = 'Resume';

% Create StopButton
app.StopButton = uibutton(app.SettingsPanel, 'push');
app.StopButton.ButtonPushedFcn = createCallbackFcn(app,
@StopButtonPushed, true);
app.StopButton.Position = [532 38 115 58];
app.StopButton.Text = 'Stop';

% Create PauseButton
app.PauseButton = uibutton(app.SettingsPanel, 'push');
app.PauseButton.ButtonPushedFcn = createCallbackFcn(app,
@PauseButtonPushed, true);
app.PauseButton.Position = [209 38 115 58];
app.PauseButton.Text = 'Pause';

% Create AxesPanel
app.AxesPanel = uipanel(app.UIFigure);
app.AxesPanel.Title = 'Axes';
app.AxesPanel.Position = [721 133 720 556];

% Create UIAxes
app.UIAxes = uiaxes(app.AxesPanel);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [91 275 547 200];

% Create UIAxes_2
app.UIAxes_2 = uiaxes(app.AxesPanel);
title(app.UIAxes_2, 'Title')
xlabel(app.UIAxes_2, 'X')
ylabel(app.UIAxes_2, 'Y')
zlabel(app.UIAxes_2, 'Z')
app.UIAxes_2.Position = [91 15 547 200];

% Create OriginalLabel
app.OriginalLabel = uilabel(app.AxesPanel);
app.OriginalLabel.Position = [301 485 136 40];
app.OriginalLabel.Text = 'Original';

% Create AppliedFilterWaveformLabel
app.AppliedFilterWaveformLabel = uilabel(app.AxesPanel);
app.AppliedFilterWaveformLabel.Position = [321 215 136 40];
app.AppliedFilterWaveformLabel.Text = 'Applied Filter Waveform';

% Show the figure after all components are created


app.UIFigure.Visible = 'on';
end
end

% App creation and deletion


methods (Access = public)

% Construct app
function app = tes

% Create UIFigure and components


createComponents(app)

% Register the app with App Designer


registerApp(app, app.UIFigure)

if nargout == 0
clear app
end
end

% Code that executes before app deletion


function delete(app)

% Delete UIFigure when app is deleted


delete(app.UIFigure)
end
end
end

Output Waveform:
Observation-
1. User Interface (UI): The UI consists of several panels, buttons, sliders,
labels, and axes for visualization. There are panels for Equalizer settings,
Presets selection, Settings like play, pause, stop, and axes for displaying
original and modified audio waveforms.
2. Equalizers Sliders: Sliders are provided for adjusting frequency bands
ranging from 0-200Hz up to >15kHz. Each slider corresponds to a
specific frequency range, and its value determines the amount of
equalization applied to that range.
3. Presets: There are preset buttons for different music genres like POP,
REGGAE, ROCK, TECHNO, PARTY, and CLASSICAL. When a preset
button is clicked, the sliders adjust to predefined values suitable for that
genre.
4. Audio Processing: Each preset button has a corresponding function that
applies a specific effect to the audio. Effects include modifying frequency
bands, adding reverb, applying filters, etc. After applying the effect, the
modified audio waveform is plotted in one of the UI axes.
5. Playback Controls: Play, pause, stop, and resume buttons control the
playback of the audio. These buttons interact with an ‘audioplayer’ object
to manage audio playback.
6. File Selection: Users can select an audio file by browsing and selecting
the file address using the browse button.
7. Audio Visualization: Both the original and modified audio waveforms are
displayed in separate UIs axes for comparison.

You might also like