diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..19f935c Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html index 2023809..1494e01 100644 --- a/index.html +++ b/index.html @@ -8,45 +8,68 @@ + +

Xylophonic +

+
+ +

Instructions

+

+ Make music with clicks or with keys. + + Notes correspond to the following keys on a standard laptop keyboard. +

+

[x][c][v][b][n][m][,]

+ + + +
+ +
+ + + +
-
- + +
+ diff --git a/noise.css b/noise.css index 5c37256..be30521 100644 --- a/noise.css +++ b/noise.css @@ -1,9 +1,11 @@ +@import url('https://fonts.googleapis.com/css?family=Monofett'); + html { font-size: 16px; } body { - background-color: black; + background-color: black; } .instrument { @@ -51,3 +53,30 @@ body { .b { color: #f26fd4; background-color: #43293d; } .b:hover { background-color: #6f3a62; } .b:active, .b.active { background-color: #f26fd4; } + + +#title { + color: red; + font-weight: bold; + font-family: 'Monofett', cursive; + font-weight: bolder; + font-size: 90px; + +} + +.intro { + color: white; + font-family: monospace; +} + +.intro2 { + color: white; + font-family: monospace; + font-size: 20px; +} + +.keys { + color: white; + font-family:monospace; + font-size: 30px; +} diff --git a/noise.js b/noise.js index 1d6dd4b..f66b65a 100644 --- a/noise.js +++ b/noise.js @@ -1,3 +1,118 @@ $(document).ready( function() { // your code here +// potential keys to use. +// x = 120 (note c) // c = 99 (note d)// v = 118 (note e)// b = 98 // n = 78// m = 77 // +// target box button class C & aim +$(".c").click(function(){ + + // alert("this worked!"); // this checks to see if it will alert once clicked. + + // now select your audio you wish to be played. + + $('#cAudio').trigger('play'); }); + +// attach c-note to key x +$('body').keypress(function(event){ + console.log("hello you!" + event.keyCode); +// this is special code that loads it before. thus making it be able to be hit & play each time. + $('#cAudio').load(); + if(event.keyCode == 120){ + $('#cAudio').trigger('play'); + } +}); + + +// ------------------------------// + +//select d button play D note +$(".d").click(function() { + // play dAudio + $("#dAudio").trigger('play'); +}); +// attach d note to key c +$('body').keypress(function(event){ + // special + $('#dAudio').load(); + if(event.keyCode == 99 ){ + $('#dAudio').trigger('play'); + } +}); + +// ------------------------------// + +// play E note +$(".e").click(function(){ + $("#eAudio").trigger('play'); +}); +// attach e note to key v +$('body').keypress(function(event){ + //special + $('#eAudio').load(); + if(event.keyCode == 118 ){ + $('#eAudio').trigger('play'); + } +}); + +// ------------------------------// + +// play f note +$(".f").click(function(){ + $("#fAudio").trigger('play'); +}); +// attach f note to key b +$('body').keypress(function(event){ + //special + $('#fAudio').load(); + if(event.keyCode == 98 ){ + $('#fAudio').trigger('play'); + } +}); + +// ------------------------------// +$(".g").click(function(){ + $("#gAudio").trigger('play'); +}); + +// attach g note to key n +$('body').keypress(function(event){ + // special + $('#gAudio').load(); + if(event.keyCode == 110 ){ + $('#gAudio').trigger('play'); + } +}); + +// ------------------------------// +// play a note +$(".a").click(function(){ + $("#aAudio").trigger('play'); +}); + +// attach g note to key m // 109 +$('body').keypress(function(event){ + $('#aAudio').load(); + if(event.keyCode == 109 ){ + $('#aAudio').trigger('play'); + } +}); + +// ------------------------------// +// 44 +// play b note. +$(".b").click(function(){ + $("#bAudio").trigger('play'); +}); +$('body').keypress(function(event){ + $('#bAudio').load(); + if(event.keyCode == 44 ){ + $('#bAudio').trigger('play'); + } +}); + + + + + + +}); // end of code block diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..c47035f --- /dev/null +++ b/notes.md @@ -0,0 +1,24 @@ +## Notes + +1. http://codesamplez.com/programming/control-html5-audio-with-jquery +- This article goes into great detail about loading & playing audio files. + + +$('body').keypress(function(event){ + if(event.keyCode == 88){ + $('#cAudio').trigger('play'); + +2. console.log("hello you!" + event.keyCode); + + +check out what code was actually pressed. + + +3. +$('body').on('keypress',function(event){ + if(event.keyCode == 120){ + console.log("this is key", event.keypress); + $('#cAudio').trigger('play'); + } +}); +});