Skip to content

Instantly share code, notes, and snippets.

@StarJade-Park
Last active July 9, 2017 04:08
Show Gist options
  • Save StarJade-Park/6ee23ccc62c84409f1253e45068d7439 to your computer and use it in GitHub Desktop.
Save StarJade-Park/6ee23ccc62c84409f1253e45068d7439 to your computer and use it in GitHub Desktop.
[Sound Filtering] Sound filtering & show spectrogram #sound_filter #matlab #Multimedia_Systems
clc; % Clear the command window.
clear; % Clear workspace variable
close all; % Clear figure windows
% original file
file_name = 'sound.snd';
file_id = fopen(file_name ,'r');
file_info = dir(file_name);
file_size = file_info.bytes;
input__ = fread(file_id, file_size, 'int16');
% low pass filter file
Lfile_name = 'low_pass_filter.snd';
file_id = fopen(file_name ,'r');
file_info = dir(file_name);
file_size = file_info.bytes;
low_input = fread(file_id, file_size, 'int16');
% high pass filter file
file_name = 'high_pass_filter.snd';
file_id = fopen(file_name ,'r');
file_info = dir(file_name);
file_size = file_info.bytes;
high_input = fread(file_id, file_size, 'int16');
% plot & specgram
% original file
figure; plot(input__);
title('input plot');
figure; specgram(input__);
title('input specgram ');
% low pass filter file
figure; plot(low_input);
title('low plot');
figure; specgram(low_input);
title('low specgram ');
% high pass filter file
figure; plot(high_input);
title('high plot');
figure; specgram(high_input);
title('high specgram ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment