R=aluebs@webrtc.org, bjornv@webrtc.org BUG= Review URL: https://webrtc-codereview.appspot.com/32769004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7893 4adac7df-926f-26a2-2b94-8c16560cd09d
17 lines
417 B
Matlab
17 lines
417 B
Matlab
function [x, t] = readPCM(file, fs)
|
|
%[x, t] = readPCM(file, fs)
|
|
%
|
|
%Reads a signal from a PCM file.
|
|
%
|
|
%x: The read signal after normalization.
|
|
%t: The respective time vector.
|
|
%
|
|
%file: The PCM file where the signal is stored in int16 format.
|
|
%fs: The signal sample rate in Hertz.
|
|
fid = fopen(file);
|
|
x = fread(fid, inf, 'int16');
|
|
fclose(fid);
|
|
x = x - mean(x);
|
|
x = x / max(abs(x));
|
|
t = 0:(1 / fs):((length(x) - 1) / fs);
|