Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-cayman
14 changes: 10 additions & 4 deletions app/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2>What is Note Kitchen?</h2>
Note Kitchen is like a search engine and laboratory for exploring musical chords and scales. Simply type the name of a chord or a scale in the text field and see the notes light up on the keyboard.
</p>
<p>
You can also hear what the notes sound like by adding the keyword 'play' to your search. See below for a full list of commands and options.
You can also hear what the notes sound like by adding the keyword 'play sequence' or 'play chord' to your search. See below for a full list of commands and options.
</p>
</header>
</section>
Expand Down Expand Up @@ -135,9 +135,15 @@ <h2>Keywords</h2>
</header>
<ul>
<li>
<a href="/?q=C play">play</a>
<a href="/?q=C play sequence">play</a>
<p>
When the 'play' keyword is present in the query the notes will begin playing and looping. Be sure to turn your speakers up! To stop playback either remove the 'play' keyword or press 'RETURN'.
When the 'play sequence' phrase is present in the query the notes will begin playing and looping in a sequence. Be sure to turn your speakers up! To stop playback either remove the 'play sequence' phrase or press 'RETURN'.
</p>
</li>
<li>
<a href="/?q=C play chord">play</a>
<p>
When the 'play chord' phrase is present in the query the notes will begin playing and looping as a chord. Be sure to turn your speakers up! To stop playback either remove the 'play chord' keyword or press 'RETURN'.
</p>
</li>
<li>
Expand Down Expand Up @@ -172,7 +178,7 @@ <h2>Keyboard</h2>
<a href="/?q=">RETURN</a>
<p>
If a valid settings command is present in the query (indicated by yellow text), pressing 'RETURN' will confirm and execute that command and clear the text. In all other cases the query will be cleared and all notes will be reset on the keyboard. This
will also cause playback to stop if the arpeggiator is on.
will also cause playback to stop.
</p>
</li>
</ul>
Expand Down
33 changes: 22 additions & 11 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class App {
this.parser = parser;
this.settings = settings;
this.activeNotes = null;
this.mode = null;
this.highlightedNotes = null;
this.rootNotes = null;
}
Expand All @@ -20,8 +21,8 @@ class App {
this.activeNotes = newActiveNotes;
if (!this.activeNotes) {
this.soundEngine.clear();
} else {
this.soundEngine.queueNotes(this.activeNotes, this.rootNotes);
} else if (this.mode) {
this.soundEngine.queueNotes(this.activeNotes, this.rootNotes, this.mode);
}
this.draw();
}
Expand Down Expand Up @@ -78,13 +79,23 @@ class App {
toggleSoundEngine(query) {
if (query.includes('play')) {
this.pianoView.isLEDOn = true;
if (!this.soundEngine.isPlaying) {
this.soundEngine.play();
if (query.includes('sequence')) {
this.mode = 'sequence';
}
} else {
else if (query.includes('chord')) {
this.mode = 'chord';
} else {
this.mode = null;
}
if (!this.soundEngine.isPlaying && this.mode) {
this.soundEngine.play(this.mode);
}
}
else {
this.pianoView.isLEDOn = false;
this.soundEngine.stop();
this.highlightedNotes = null;
this.mode = null;
}
}

Expand All @@ -103,11 +114,11 @@ class App {
this.processInput();
}

window.onresize = function() {
window.onresize = function () {
this.draw();
}.bind(this);

this.$input.onkeyup = function(e) {
this.$input.onkeyup = function (e) {
e.preventDefault();
if (e.keyCode == 13) { // ENTER
this.commandEngine.execute(this.$input.value);
Expand All @@ -123,24 +134,24 @@ class App {
}
}.bind(this);

this.$input.onkeydown = function(e) {
this.$input.onkeydown = function (e) {
if (e.keyCode == 38) { // UP
e.preventDefault();
} else if (e.keyCode == 40) { // DOWN
e.preventDefault();
}
}.bind(this);

this.$input.oninput = function() {
this.$input.oninput = function () {
this.processInput();
}.bind(this);

this.$title.onclick = function(e) {
this.$title.onclick = function (e) {
this.settings.toggleTheme();
this.draw();
}.bind(this);

this.soundEngine.playCallback = function(note) {
this.soundEngine.playCallback = function (note) {
this.highlightedNotes = [note];
this.draw();
}.bind(this);
Expand Down
Loading