Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [] = firfilters(inputPath, outputPath)
- [Y, FS] = audioread(inputPath); % read file
- % plot input /*
- Y_fft = fft(Y);
- freqInitPlot = ((0:length(Y_fft) - 1) * FS) / length(Y_fft);
- figure;
- plot(freqInitPlot, abs(Y_fft));
- xlabel('Frequency (Hz)');
- ylabel('Magnitude');
- title('Initial FFT magnitude');
- % */
- % here I loaded the variables (@Num and @Den) saved by the filter tool
- % I chose to save them in a *.m file but you can also load them from the workspace
- % I couldn't figure out how so this was easier for me
- load('2ndtry');
- Z = filter(Num, Den, Y);
- % plot output /*
- Z_fft = fft(Z);
- freqInitPlot = ((0:length(Z_fft) - 1) * FS) / length(Z_fft);
- figure;
- plot(freqInitPlot, abs(Z_fft));
- xlabel('Frequency (Hz)');
- ylabel('Magnitude');
- title('Output FFT magnitude');
- % */
- audiowrite(outputPath, Z, FS); % write output file
- zoom xon; % don't remember what this does, something to do with graphs, 99% sure it's unnecessary
- end
Add Comment
Please, Sign In to add comment