Reorganized Into Folders
This commit is contained in:
BIN
src/Helper/.DS_Store
vendored
Normal file
BIN
src/Helper/.DS_Store
vendored
Normal file
Binary file not shown.
20
src/Helper/Equalizer_Darell.m
Normal file
20
src/Helper/Equalizer_Darell.m
Normal file
@@ -0,0 +1,20 @@
|
||||
%Written by Darell
|
||||
|
||||
% CONTRIBUTORS:
|
||||
% Person1: Darell
|
||||
|
||||
% DOCUMENTATION:
|
||||
% fs is the sampling frequency
|
||||
% input is the signal input
|
||||
% EQplot is the curve generated by the EQ in the app. it should look like /----\ when everthing is set to 1
|
||||
|
||||
|
||||
function output = Equalizer_Darell(input,EQplot,Fs)
|
||||
%It's an EQ written by Darell
|
||||
% Split into frequencies and multiply by EQ
|
||||
Mod_Freq = fftshift(fft(input));
|
||||
filtered_Mod_Freq = fftshift(Mod_Freq .* EQplot);
|
||||
output = real(ifft(filtered_Mod_Freq));
|
||||
%plot(output);
|
||||
end
|
||||
|
92
src/Helper/MIDIDarell.m
Normal file
92
src/Helper/MIDIDarell.m
Normal file
@@ -0,0 +1,92 @@
|
||||
function output = MIDIDarell(dur,Fs)
|
||||
%Darell Chua Yun Da
|
||||
% Detailed explanation goes here
|
||||
|
||||
freq = [330 350 370 392 415 440 466 494 523 554];
|
||||
charls = ["q" "w" "e" "r" "t" "y" "u" "i" "o" "p"];
|
||||
bytedur = 0.5;
|
||||
x = 0:1/Fs:bytedur;
|
||||
yz0 = zeros([1,(length(x)-1)]);
|
||||
y = [yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0
|
||||
yz0];
|
||||
|
||||
for c = 1:length(freq)
|
||||
for i=1:length(x)
|
||||
y(c,i) = 0.5*sin(2*pi*freq(c)*x(i));
|
||||
end
|
||||
end
|
||||
Len = dur*Fs;
|
||||
output = zeros([1,Len]);
|
||||
|
||||
|
||||
|
||||
set(gcf,'CurrentCharacter', '@');
|
||||
figure(1)
|
||||
|
||||
tStart = tic;
|
||||
tEnd = toc(tStart);
|
||||
figure(1)
|
||||
|
||||
while(tEnd <= dur)
|
||||
title("Midi Popup")
|
||||
drawnow
|
||||
char = get(gcf,'CurrentCharacter');
|
||||
while (char == '@' && tEnd <= dur)
|
||||
figure(1)
|
||||
char = get(gcf,'CurrentCharacter');
|
||||
tEnd = toc(tStart);
|
||||
drawnow
|
||||
end
|
||||
|
||||
n = round((tEnd/dur)*Len);
|
||||
|
||||
endt = tEnd + bytedur;
|
||||
overt = tEnd + bytedur/3;
|
||||
if overt> dur
|
||||
endt = dur;
|
||||
end
|
||||
if endt > dur
|
||||
endt = dur;
|
||||
end
|
||||
endn = round(endt*Fs);
|
||||
|
||||
charno = 0;
|
||||
for i=1:length(freq)
|
||||
if char == charls(i)
|
||||
charno = i;
|
||||
end
|
||||
end
|
||||
if charno > 0
|
||||
sound(y(charno,:),Fs);
|
||||
oldout = output(n:endn);
|
||||
output(n:endn) = oldout + y(charno,1:(endn-n+1));
|
||||
while(tEnd < overt)
|
||||
tEnd = toc(tStart);
|
||||
drawnow
|
||||
end
|
||||
figure(1)
|
||||
plot(output);
|
||||
title("Midi Popup")
|
||||
drawnow
|
||||
set(gcf,'CurrentCharacter', '@')
|
||||
else
|
||||
figure(1)
|
||||
drawnow
|
||||
set(gcf,'CurrentCharacter', '@')
|
||||
end
|
||||
tEnd = toc(tStart);
|
||||
end
|
||||
figure(1)
|
||||
plot(output);
|
||||
sound(output,Fs);
|
||||
drawnow();
|
||||
end
|
||||
|
8
src/Helper/amplify.m
Normal file
8
src/Helper/amplify.m
Normal file
@@ -0,0 +1,8 @@
|
||||
function output = amplify(input, multiplier)
|
||||
%input: a 1D array representing the sound signal in the time domain
|
||||
%multiplier: a scalar that multiplier all values in the input array to
|
||||
% amplify or decrease the volume.
|
||||
%Returns: input signal scaled by the multiplier in the time domain.
|
||||
%Author: Conner Hsu
|
||||
output = input*multiplier;
|
||||
end
|
9
src/Helper/play_continuous.m
Normal file
9
src/Helper/play_continuous.m
Normal file
@@ -0,0 +1,9 @@
|
||||
function play_continuous(wave, fs, time)
|
||||
%play_continuous: Darell Continuously Playing
|
||||
soundfile = audioplayer(wave,fs);
|
||||
countmax = time / (length(wave) / fs);
|
||||
for count = 0:1:countmax %change to counts/while play button active
|
||||
playblocking(soundfile);
|
||||
end
|
||||
end
|
||||
|
5
src/Helper/play_wave.m
Normal file
5
src/Helper/play_wave.m
Normal file
@@ -0,0 +1,5 @@
|
||||
function play_wave(wave, fs)
|
||||
%PLAY_WAVE:Arthur Lu plays a wave as sound
|
||||
sound(wave, fs)
|
||||
end
|
||||
|
8
src/Helper/plot_wave.m
Normal file
8
src/Helper/plot_wave.m
Normal file
@@ -0,0 +1,8 @@
|
||||
function plot_wave(waveform, fs, duration)
|
||||
%PLOT_WAVE:Arthur Lu plots a waveform
|
||||
x = linspace(0, duration, fs * duration);
|
||||
plot(x, waveform);
|
||||
xlabel("time");
|
||||
ylabel("amplitude");
|
||||
end
|
||||
|
6
src/Helper/reverse.m
Normal file
6
src/Helper/reverse.m
Normal file
@@ -0,0 +1,6 @@
|
||||
function output = reverse(input)
|
||||
%input: a 1D array representing the sound signal in the time domain
|
||||
%returns: the input signal with its elements in reverse order.
|
||||
%By Conner Hsu
|
||||
output = flip(input);
|
||||
end
|
Reference in New Issue
Block a user