Mercurial > hg > pmhd
annotate 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 |
rev | line source |
---|---|
emmanouil@6 | 1 function [melody] = loadMelodyFile(filename) |
emmanouil@6 | 2 |
emmanouil@6 | 3 % Open raw file |
emmanouil@6 | 4 fid = fopen(filename,'r+'); |
emmanouil@6 | 5 |
emmanouil@6 | 6 % Read 1st line |
emmanouil@6 | 7 tline = fgetl(fid); |
yading@10 | 8 onset_pitch(:,1) = sscanf(tline, '%*s %f %f'); |
emmanouil@6 | 9 |
emmanouil@6 | 10 % Read rest of the lines |
emmanouil@6 | 11 i=1; |
emmanouil@6 | 12 while ischar(tline) |
emmanouil@6 | 13 i = i+1; |
emmanouil@6 | 14 tline = fgetl(fid); |
emmanouil@6 | 15 if (ischar(tline)) |
emmanouil@6 | 16 onset_pitch(:,i) = sscanf(tline, '%f\t%f'); |
emmanouil@6 | 17 end; |
emmanouil@6 | 18 end |
emmanouil@6 | 19 melody = onset_pitch; |
emmanouil@6 | 20 |
emmanouil@6 | 21 % Close file |
emmanouil@6 | 22 fclose(fid); |
emmanouil@6 | 23 |