Skip to content

Commit 2c60aed

Browse files
committed
Merge
2 parents 0fc3bb5 + cab4a2e commit 2c60aed

File tree

5 files changed

+101
-151
lines changed

5 files changed

+101
-151
lines changed

chords.html

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
<!doctype html>
22
<html>
3-
<head>
4-
<title>Chords</title>
5-
<script src="/static/fastclick/lib/fastclick.js"></script>
6-
<script src="/static/socket.io/node_modules/socket.io-client/socket.io.js"></script>
7-
<style>
8-
table, td, th {
9-
border: 2px solid black;
10-
}
11-
td {
12-
background-color: green;
13-
}
14-
</style>
15-
</head>
16-
<body>
17-
<table width="100%" height="800px">
18-
<tr>
19-
<td onclick="play('C')"></td>
20-
</tr>
21-
<tr>
22-
<td onclick="play('G')"></td>
23-
</tr>
24-
<tr>
25-
<td onclick="play('Am')"></td>
26-
</tr>
27-
<tr>
28-
<td onclick="play('F')"></td>
29-
</tr>
30-
</table>
31-
<script>
32-
var socket = io(),
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Chords | Torsk</title>
6+
<script src="/static/fastclick/lib/fastclick.js"></script>
7+
<script src="/static/socket.io/node_modules/socket.io-client/socket.io.js"></script>
338

34-
play = function (chord) {
35-
socket.emit('chord', chord);
36-
};
9+
<!-- CSS -->
10+
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
11+
<link href="torsk.css" rel="stylesheet">
12+
</head>
13+
<body>
14+
<div class="container">
3715

38-
if ('addEventListener' in document) {
39-
document.addEventListener('DOMContentLoaded', function() {
40-
FastClick.attach(document.body);
41-
}, false);
42-
}
43-
</script>
44-
</body>
16+
<div class="jumbotron">
17+
<h1>Torsk-Synth! Play for Lofoten :)</h1>
18+
</div>
19+
20+
<div class="row marketing">
21+
<button type="button" class="btn btn-default torsk-btn col-md-12" onclick="play('C')">-</button>
22+
<button type="button" class="btn btn-default torsk-btn col-md-12" onclick="play('G')">-</button>
23+
<button type="button" class="btn btn-default torsk-btn col-md-12" onclick="play('Am')">-</button>
24+
<button type="button" class="btn btn-default torsk-btn col-md-12" onclick="play('F')">-</button>
25+
</div>
26+
27+
</div>
28+
<script>
29+
var socket = io(),
30+
31+
play = function (chord) {
32+
socket.emit('chord', chord);
33+
};
34+
35+
if ('addEventListener' in document) {
36+
document.addEventListener('DOMContentLoaded', function() {
37+
FastClick.attach(document.body);
38+
}, false);
39+
}
40+
</script>
41+
</body>
4542
</html>

index.html

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
11
<!doctype html>
22
<html>
3-
<head>
4-
<title>Synth</title>
5-
<script src="/static/fastclick/lib/fastclick.js"></script>
6-
<script src="/static/socket.io/node_modules/socket.io-client/socket.io.js"></script>
7-
<style>
8-
table, td, th {
9-
border: 2px solid black;
10-
}
11-
td {
12-
background-color: green;
13-
}
14-
</style>
15-
</head>
16-
<body>
17-
<table width="100%" height="300px">
18-
<tr>
19-
<td onclick="play('A')"></td>
20-
<td onclick="play('B')"></td>
21-
<td onclick="play('C')"></td>
22-
</tr>
23-
<tr>
24-
<td onclick="play('D')"></td>
25-
<td onclick="play('E')"></td>
26-
<td onclick="play('F')"></td>
27-
</tr>
28-
<tr>
29-
<td onclick="play('G')"></td>
30-
<td onclick="play('C')"></td>
31-
<td onclick="play('C')"></td>
32-
</tr>
33-
<tr>
34-
<td onclick="play('C')"></td>
35-
<td onclick="play('C')"></td>
36-
<td onclick="play('C')"></td>
37-
</tr>
38-
</table>
39-
<script>
40-
var socket = io(),
41-
42-
play = function (note) {
43-
socket.emit('play', note);
44-
};
45-
46-
if ('addEventListener' in document) {
47-
document.addEventListener('DOMContentLoaded', function() {
48-
FastClick.attach(document.body);
49-
}, false);
50-
}
51-
</script>
52-
</body>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Synth | Torsk</title>
6+
<script src="/static/fastclick/lib/fastclick.js"></script>
7+
<script src="/static/socket.io/node_modules/socket.io-client/socket.io.js"></script>
8+
9+
<!-- CSS -->
10+
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
11+
<link href="torsk.css" rel="stylesheet">
12+
</head>
13+
<body>
14+
15+
<div class="container">
16+
17+
<div class="jumbotron">
18+
<h1>Torsk-Synth! Play for Lofoten :)</h1>
19+
</div>
20+
21+
<div class="row marketing">
22+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('C')">C</button>
23+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('B')">H</button>
24+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('A')">A</button>
25+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('G')">G</button>
26+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('F')">F</button>
27+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('E')">E</button>
28+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('D')">D</button>
29+
<button type="button" class="btn btn-default torsk-btn col-md-3" onclick="play('C5')">C5</button>
30+
</div>
31+
32+
</div>
33+
<script>
34+
if ('addEventListener' in document) {
35+
document.addEventListener('DOMContentLoaded', function() {
36+
FastClick.attach(document.body);
37+
}, false);
38+
}
39+
40+
var socket = io(),
41+
42+
play = function (note) {
43+
socket.emit('play', note);
44+
};
45+
</script>
46+
</body>
47+
5348
</html>

react.html

Lines changed: 0 additions & 47 deletions
This file was deleted.

server.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@ var express = require('express'),
2727
};
2828

2929
app.use('/static', express.static(__dirname + '/node_modules'));
30+
app.use('/torsk.css', express.static(__dirname + '/torsk.css'));
3031

3132
app.get('/', function (req, res) {
3233
res.sendFile(__dirname + '/index.html');
3334
});
3435

35-
app.get('/react/', function (req, res) {
36-
res.sendFile(__dirname + '/react.html');
37-
});
38-
3936
app.get('/chords', function (req, res) {
40-
res.sendFile(__dirname + '/chords.html');
37+
res.sendFile(__dirname + '/chords.html');
4138
});
4239

4340
app.get('/drums', function (req, res) {
@@ -47,18 +44,18 @@ app.get('/drums', function (req, res) {
4744
io.on('connection', function (socket){
4845
console.log('a user connected');
4946

50-
socket.on('play', function (msg) {
51-
var command = 'play -qn synth 2 pluck ' + msg;
47+
socket.on('play', function (msg) {
48+
var command = 'play -qn synth 2 pluck ' + msg;
5249

53-
shell.exec(command, {async: true});
54-
});
50+
shell.exec(command, {async: true});
51+
});
5552

56-
socket.on('chord', function (msg) {
57-
var chord = chords[msg],
58-
command = 'play -qn synth sin ' + chord[0] + ' sin ' + chord[1] + ' sin ' + chord[2] + ' delay 0 .01 .02 remix - fade 0 2 .1 norm -1';
53+
socket.on('chord', function (msg) {
54+
var chord = chords[msg],
55+
command = 'play -qn synth sin ' + chord[0] + ' sin ' + chord[1] + ' sin ' + chord[2] + ' delay 0 .01 .02 remix - fade 0 2 .1 norm -1';
5956

60-
shell.exec(command, {async: true});
61-
});
57+
shell.exec(command, {async: true});
58+
});
6259

6360
socket.on('beat', function (msg) {
6461
var drum = drums[msg],

torsk.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.torsk-btn {
2+
padding: 20px 30px;
3+
font-size: 100px;
4+
line-height: normal;
5+
-webkit-border-radius: 8px;
6+
-moz-border-radius: 8px;
7+
border-radius: 8px;
8+
}

0 commit comments

Comments
 (0)