blob: 47ccac33e71e42d015ccc16576c229b9ba5e124c [file] [log] [blame]
pbos@webrtc.org788acd12014-12-15 09:41:24 +00001function [x, t] = readPCM(file, fs)
2%[x, t] = readPCM(file, fs)
3%
4%Reads a signal from a PCM file.
5%
6%x: The read signal after normalization.
7%t: The respective time vector.
8%
9%file: The PCM file where the signal is stored in int16 format.
10%fs: The signal sample rate in Hertz.
11fid = fopen(file);
12x = fread(fid, inf, 'int16');
13fclose(fid);
14x = x - mean(x);
15x = x / max(abs(x));
16t = 0:(1 / fs):((length(x) - 1) / fs);