[ip,fs]=audioread('so1.wav');
%plot(ip);
% step 1 - break the signal into frames of 0.1 seconds
fs = 11000; % sampling frequency
frame_duration = 0.04;
frame_len = frame_duration*fs;
N = length(ip);
num_frames= floor(N/frame_len);
new_sig = zeros(N,1);
count=0;
for k = 1 : num_frames
% extracting a frame of speech
frame = ip( (k-1)*frame_len + 1 : frame_len*k );
% step 2 - identify non silence frames by finding frames with max amplitute more than
% 0.03
max_val = max(frame);
if(max_val > 0.03)
count=count+1;
new_sig((count-1)*frame_len + 1 : frame_len*count) = frame;
end
end
new_sig(frame_len*count:end)=[];
plot(new_sig);
Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts
Wednesday, August 12, 2015
Friday, August 7, 2015
dir() function
dir(name)
attribute_name= dir(name)
- dir(name) lists files and folders that match the string name. When name is a folder, dir lists contents of the folder.
attribute_name= dir(name) returns attributes about name.
attribute_name= dir(name) returns attributes about name.
input() function
result = input(prompt)
str = input(prompt, 's')
- result = input(prompt) displays the prompt string on the screen, waits for input from the keyboard, evaluates any expression in the input, and returns the result.
- str = input(prompt, 's') returned the entered text as Matlab string, without evaluating expression.
length() function
num = length(array)
length(array) returns length along the largest dimension of the array or matrix.
% Example
10, 24;
11, 7];
%Function
ANSWER = length(A);
%Display result
disp('Result: ');disp(ANSWER);
Result :
zeros() function
X = zeros(n)
X = zeros(m, n)
- zeros(n) returns n by n matrix of zeros
- zeros(m, n) returns a m by n matrix of zeros
ones() function
X = ones(n)
X = ones(m, n)
· ones(n) returns n by n matrix of ones
· ones(m, n) returns a m by n matrix of ones
Subscribe to:
Posts (Atom)