First off: I'm really new in the signal processing department and MatLab as well, so please bear with me here.
What I want to achieve is to split my audio signal into smaller 25ms frames, where the frames overlap with 50%, apply a window function, thus the overlapping (probably Hamming
or Hann
), and then add it together again (write out a new sound file), so that I basically get the original signal back. Someone mentioned overlap-add
, but I'm not quite sure if convolution is correct here, as mentioned, I'm new to all this.
So I have a sound file that I read like this:
function output = readSoundFile(filename, channels)
if isscalar(channels)
chN=channels;
channels=ones(1,chN);
else
chN=length(channels);
end
fid=fopen(filename,'r','n');
[output, elementCount] = fread(fid,[chN,inf], '*int16');
fclose(fid);
for i=chN:-1:1
if channels(i) == 0
output(i,:)=[];
end
end
end
In another MatLab
file, I use the readSoundFile
function:
fileUrl = 'whatever/file.format';
sound = readSoundFile(file);
soundsc(double(sound), 16000); % sound is sampled with 16kHz. Don't know, if this information is needed
How do I split the resulting data into 25ms frames with an overlap of 50%, apply a window function, and write out a new file?
Should it help, I can convert the file into a wav
file, if wavread
/audioread
would be any easier.