forked from gregjopa/HTML5-Guitar-Tab-Player
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
219 lines (168 loc) · 5.1 KB
/
index.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Guitar Tab Player</title>
<meta name="description" content="HTML5 Guitar Tablature Player w/ Vexflow and Audiolib">
<meta name="author" content="Greg Jopa">
<!-- styles -->
<link href="support/vexflow/tabdiv.css" rel="stylesheet">
<link href="bower_components/jqueryui/themes/base/theme.css" rel="stylesheet" />
<link href="src/tab-player.css" rel="stylesheet">
<style>
body {
font-family: Verdana,Arial,sans-serif;
font-size: 13px;
font-weight: normal;
margin: 0;
background-color: #EEE;
}
div.container {
width: 940px;
margin-left: auto;
margin-right: auto;
}
div.content {
background-color: white;
box-shadow: 0 1px 2px #DDD;
}
div.page-header {
padding: 10px 20px;
border-bottom: 1px solid #DDD;
}
div.page-header h1 {
margin-bottom: 18px;
font-size: 30px;
line-height: 36px;
font-weight: bold;
color: #404040;
}
div.page-header h1 small {
font-size: 18px;
font-weight: normal;
color: #BFBFBF;
}
div.song-menu {
padding: 10px 20px;
margin-bottom: 20px;
border-bottom: 1px solid #DDD;
}
#songList {
width: 600px;
height: 27px;
padding: 4px;
line-height: 27px;
font-size: 13px;
border: 1px solid #CCC;
border-radius: 3px;
background: transparent;
}
#tab {
width: 900px;
padding: 0 20px;
}
footer {
padding: 17px 0 10px 0;
border-top: 1px solid #EEE;
text-align: center;
}
.fork img {
position: absolute;
top: 0;
right: 0;
}
</style>
<!-- scripts -->
<!-- audio -->
<script src="support/audiolib.min.js"></script>
<script src="support/webkitAudioContextMonkeyPatch.js"></script>
<script src="support/music.js"></script>
<!-- support -->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/jqueryui/jquery-ui.min.js"></script>
<script src="bower_components/raphael/raphael-min.js"></script>
<!-- vexflow/vextab/tabdiv -->
<script src="support/vexflow/vexflow.js"></script>
<script src="support/vexflow/vextabdiv.js"></script>
<!-- tab player -->
<script src="src/music-tracker.js"></script>
<script src="src/vexflow-parser.js"></script>
<script src="src/tab-player.js"></script>
<!-- base64 encoded string of drum samples -->
<script src="tests/drum-samples.js"></script>
<!-- guitar tab songs in json -->
<script src="songs.js"></script>
<script>
// disable tabdiv processing on page load
Vex.Flow.TabDiv.SEL = null;
$(document).ready(function() {
var $songList = $('#songList'),
tabDiv,
player,
html = '',
key,
obj;
// add songs to select box
for (key in songs) {
if (songs.hasOwnProperty(key)) {
obj = songs[key];
html += '<option value="' + key + '">' + obj.title + ' by ' + obj.artist + '</option>';
}
}
$songList.append(html);
$songList.change(function() {
prepareTab(this.value);
player.loadTab({
'tabDiv': tabDiv,
'tempo': songs[this.value].tempo,
'notesPerBeat': songs[$songList.val()].timeSignature[0]
});
});
$songList[0].selectedIndex = 0;
prepareTab($songList.val());
// initialize TabPlayer
player = new TabPlayer({
'tabDiv': tabDiv,
'tempo': songs[$songList.val()].tempo,
'notesPerBeat': songs[$songList.val()].timeSignature[0]
});
function prepareTab(songName) {
var $tab = $('#tab'),
tabCode = "",
tabLineCount = songs[songName].vexTabCode.length,
i;
for (i = 0; i < tabLineCount; i++) {
tabCode += songs[songName].vexTabCode[i] + "\n";
}
$tab.empty().append(tabCode);
// tabdiv - parse, create canvas, and draw
tabDiv = new Vex.Flow.TabDiv("#tab");
}
});
</script>
</head>
<body>
<a class="fork" href="https://github.com/GregJ/HTML5-Guitar-Tab-Player">
<img src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
alt="Fork me on GitHub">
</a>
<div class="container">
<div class="content">
<div class="page-header">
<h1>HTML5 Guitar Tab Player <small> A Music Player plug-in for Vexflow</small></h1>
</div>
<div class="song-menu">
<label for="songList">Choose a guitar tab: </label>
<select id="songList">
<!-- <option value="song1" selected >Blues</option>
<option value="song2">Scales</option> -->
</select>
</div>
<div id="tab" class="vex-tabdiv" width=900 scale=1.0 editor="false"></div>
</div>
<footer>
<p>by <a href="http://twitter.com/#!/gregjopa">@gregjopa</a></p>
</footer>
</div>
</body>
</html>