forked from rorhug/ng-drum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
210 lines (204 loc) · 10.3 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
<!DOCTYPE html>
<html ng-app="drum">
<head>
<meta charset="utf-8">
<title>ng-drum</title>
<meta name="description" content="An AngularJS drum machine">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/public/css/comp.css">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script src="//cdn.rawgit.com/mgcrea/angular-strap/3d7ff4b417d02fd9c8f307d3d0a2c0f6462bec59/dist/angular-strap.min.js"></script>
<script src="//cdn.rawgit.com/mgcrea/angular-strap/fbe1a3579e46f91b87a93402094411948c05be7d/dist/angular-strap.tpl.min.js"></script>
<script src="//oss.maxcdn.com/howler.js/1.1.20/howler.min.js"></script>
<script type="text/javascript" src="/public/js/comp.js"></script>
</head>
<body ng-controller="MainCtrl" ng-keydown="keyPressed($event)">
<div class="container-fluid">
<h1>
ng-drum
<small>
AngularJS Drum Machine
<a href="https://twitter.com/RoryDHughes" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @RoryDHughes</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> |
<iframe src="http://ghbtns.com/github-btn.html?user=rorydh&repo=ng-drum&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
</small>
</footer>
</h1>
<div id="alerts"></div>
<div class="btn-toolbar" role="toolbar" ng-controller="PlayCtrl">
<div class="btn-group">
<button class="btn play" ng-class="{'active btn-danger': heartbeat, 'btn-success': !heartbeat}" ng-click="toggle()">
<i class="fa fa-play" ng-hide="heartbeat"></i>
<i class="fa fa-pause" ng-show="heartbeat"></i>
</button>
<button class="btn btn-default btn-sm" ng-click="reset()">
<i class="fa fa-stop"></i>
</button>
</div>
<button type="button" class="btn btn-default dropdown-toggle pull-left" data-toggle="dropdown" bs-dropdown data-template="instruments-list.html">
<i class="fa fa-plus"></i> Add <span class="caret"></span>
</button>
<script type="text/ng-template" id="instruments-list.html">
<ul class="dropdown-menu instruments-list" role="menu">
<li ng-repeat="name in instrumentNames" ng-mouseover="testPlay(name)">
<a ng-click="addChannel(name)" ng-bind="name" ng-class="{used: t.channels[name]}"></a>
</li>
</ul>
</script>
<form ng-submit="editingTempo = false || changeTempo()" class="input-group tempo-controls">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="changeTempo(-1)">
<i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-default" ng-hide="editingTempo" ng-click="(editingTempo = true)">
Tempo: <span ng-bind="t.tempo"></span>
</button>
</span>
<input ng-model="t.tempo" type="number" class="form-control input-sm" focus-me="editingTempo" ng-show="editingTempo" ng-blur="">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="changeTempo(1)">
<i class="fa fa-plus"></i>
</button>
</span>
</form>
<form ng-submit="changeBeatCount()" class="input-group beat-controls">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="changeBeatCount(-1)">
<i class="fa fa-minus"></i>
</button>
<button type="button" class="btn btn-default" ng-hide="editingBeatCount" ng-click="(beatCountBox = t.beatCount) && (editingBeatCount = true)">
Beats: <span ng-bind="t.beatCount"></span>
</button>
</span>
<input ng-model="beatCountBox" type="number" class="form-control input-sm" focus-me="beatCountBox" ng-show="editingBeatCount">
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="changeBeatCount(1)">
<i class="fa fa-plus"></i>
</button>
</span>
</form>
<div class="btn-group">
<button type="button" class="btn btn-default play-info" ng-click="retreat()">
<i class="fa fa-step-backward"></i>
</button>
<button type="button" class="btn btn-default play-info" ng-click="advance()">
<span bs-tooltip title="Total ticks/semi-quavers" ng-bind="seq.ticks + 1"></span>
<span bs-tooltip title="Beat" ng-bind="seq.beat + 1"></span>
<span bs-tooltip title="Current tick/semi-quaver" ng-bind="seq.semi + 1"></span>
<i class="fa fa-step-forward"></i>
</button>
</div>
<button type="button" class="btn btn-primary" title="Saves the song as a shareable link."
bs-popover data-template="permalink.html" ng-click="generateRawData()">
<i class="fa fa-link"></i> Save link to share
</button>
<script type="text/ng-template" id="permalink.html">
<div class="popover permalink">
<div class="arrow"></div>
<button class="btn btn-link btn-block btn-xs" ng-click="$hide()">close</button>
<textarea class="form-control" ng-bind="permalink()" select-all-on-click></textarea>
</div>
</script>
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" bs-dropdown data-template="songs-list.html">
<i class="fa fa-music"></i> Examples <span class="caret"></span>
</button>
<script type="text/ng-template" id="songs-list.html">
<ul class="dropdown-menu songs-list" role="menu">
<li ng-repeat="name in songNames | orderBy:'toString()'">
<a ng-click="useSong(name)" ng-bind="name" class="point"></a>
</li>
</ul>
</script>
</div>
<div class="the-grid" ng-controller="GridCtrl">
<div class="row ch" ng-repeat="inst in chList()" ng-class="{cur: inst == curCh.name}">
<div class="col-sm-2 col-lg-1 ch-info point" ng-click="testPlay(inst)">
<span ng-click="deleteChannel(inst)" class="text-danger">
<i class="fa fa-trash-o"></i>
</span>
<span ng-bind="inst" class="ch-title"></span>
</div>
<div class="col-sm-10 col-lg-11 note-list">
<div class="beat" ng-repeat="b in [] | range:(t.beatCount)">
<span class="note"
ng-repeat="sq in [] | range:4"
ng-class="[noteClasses(inst, b, sq)]"
ng-click="toggleNote(inst, (b * 4) + sq)">
</span>
</div>
</div>
</div>
</div>
<h4 ng-show="isEmpty(t.channels)">
<i class="fa fa-hand-o-up"></i> Add a new channel!
</h4>
<button class="btn btn-link btn-sm" ng-click="showDebug = !showDebug">show debug json</button>
<pre ng-if="showDebug" ng-bind="t | trackJson"></pre>
<section>
<h4>What is this?</h4>
<p>
It's a web based <a target="_blank" href="https://en.wikipedia.org/wiki/Drum_machine">Drum Machine</a> built using the <a target="_blank" href="http://angularjs.org/">AngularJS</a> JavaScript framework.
</p>
<h4>I don't understand... how do I use it?</h4>
<p>
Hit the play button on the top left.<br>
See the boxes moving across the grid?<br>
When they cover a dark blue square, it plays that sound for that row (written on the left side).<br>
You can edit the rhythm by clicking the squares and adding more drums by pressing 'Add'<br>
'Tempo' changes the speed. 'Beats' is the length.<br>
If you want to share you creation, hit the blue share button.
That will change the current web address and give you it so you can send it to others.
</p>
<h4>Something isn't working...</h4>
<p>
It's possible your browser is too old. If you know you're using a modern browser, try emailing me: [email protected]
</p>
<div class="row">
<div class="col-sm-6">
<h4>Key Bindings <i class="fa fa-keyboard-o"></i></h4>
<p>
<strong>space:</strong> Play/Pause<br>
<strong>s:</strong> Stop+Rewind<br>
<strong>1:</strong> <i class="fa fa-minus"></i> tempo<br>
<strong>2:</strong> <i class="fa fa-plus"></i> tempo<br>
<strong>3:</strong> <i class="fa fa-minus"></i> beats<br>
<strong>4:</strong> <i class="fa fa-plus"></i> beats<br>
<strong>p:</strong> Play current selection<br>
<strong>i:</strong> Insert/remove current note<br>
<strong><i class="fa fa-arrow-left"></i>/h:</strong> Back one<br>
<strong><i class="fa fa-arrow-right"></i>/l:</strong> Forward one<br>
<strong><i class="fa fa-arrow-up"></i>/k:</strong> Up channel<br>
<strong><i class="fa fa-arrow-down"></i>/j:</strong> Down channel
</p>
</div>
<div class="col-sm-6">
<h4>Upcoming features</h4>
<ul>
<li>Get sound to work on iOS!</li>
<li>Multiple Drum Kits</li>
<li>Adjustable velocity (loudness)</li>
<li>Custom track titles</li>
<li>Data URL shortening</li>
<li>Ability to delete all notes in a channel or the whole grid.</li>
</ul>
</div>
</div>
</section>
<footer class="text-muted">
Created by Rory Hughes
| Inspired by <a target="_blank" href="http://emberbeats.gavinjoyce.com/">Ember Beats</a>
</footer>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-38398315-8', 'rory.ie');
ga('send', 'pageview');
</script>
</body>
</html>