view loadMelodyFile.m @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
line wrap: on
line source
function [melody] = loadMelodyFile(filename)

% Open raw file
fid = fopen(filename,'r+');

% Read 1st line
tline = fgetl(fid);
onset_pitch(:,1) = sscanf(tline, '%*s %f %f');

% Read rest of the lines
i=1;
while ischar(tline)
    i = i+1;
    tline = fgetl(fid);
    if (ischar(tline))
        onset_pitch(:,i) = sscanf(tline, '%f\t%f');
    end;
end
melody = onset_pitch;

% Close file
fclose(fid);