-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.asv
47 lines (40 loc) · 1.2 KB
/
driver.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clear; close all;
%Initialize sound files
gts_init;
%Get the filename from the user
filename = input('Guitar tab image name: ', 's');
%filename = 'Test Images/test_image8.JPG';
%Find the order of the notes on the image
ordered_notes = image_read(filename);
%*****SOUND SYNTHESIS*****
notes_to_play = synthesize(ordered_notes);
%*****PLAY AUDIO*****
Fsloc = Fs(1);
% need to fix - needs to be played much faster.
horizontal_loc = [];
for i = 1:length(ordered_notes)
horizontal_loc = [horizontal_loc; diff(cell2mat(ordered_notes{i}(:, 1)))];
end
max_diff = max(horizontal_loc);
count = 0;
note_num = 1;
for i = 1:length(horizontal_loc)
if(horizontal_loc(i) ~= 0 || i == length(horizontal_loc))
yA = notes_to_play{note_num};
sound(yA(1:40000), Fsloc);
if (i == length(horizontal_loc))
continue;
else
pause_time = 1 * horizontal_loc(i) / max_diff;
pause(pause_time);
end
note_num = note_num + 1;
elseif(horizontal_loc(i) == 0)
continue;
end
end
% for(j=1:1:length(notes_to_play))
% yA = notes_to_play{j};
% sound(yA(1:40000),Fsloc);
% pause(0.75);
% end