Mercurial > hg > pmhd
changeset 6:8428a0ebd45f
Function for loading MELODIA output
author | emmanouilb <emmanouil.benetos.1@city.ac.uk> |
---|---|
date | Sat, 20 Apr 2013 14:30:27 +0100 |
parents | 840a4c453edc |
children | e939a5aac00b |
files | loadMelodyFile.m wave2fft2wave.m |
diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loadMelodyFile.m Sat Apr 20 14:30:27 2013 +0100 @@ -0,0 +1,23 @@ +function [melody] = loadMelodyFile(filename) + +% Open raw file +fid = fopen(filename,'r+'); + +% Read 1st line +tline = fgetl(fid); +onset_pitch(:,1) = sscanf(tline, '%f\t%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); +