Skip to content

Commit

Permalink
implemented guitar octave positions
Browse files Browse the repository at this point in the history
  • Loading branch information
deleolajide committed Nov 8, 2024
1 parent 2c7cbc6 commit 4f439c0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 39 deletions.
Binary file not shown.
43 changes: 22 additions & 21 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@
<td><h2 id="statusMsg"></h2></td>
<td>
<div><center>
<a class="play">On</a>
<a class="style_type">Normal</a>
<a class="gamepad_mode">Color Tabs</a>
<a class="load_file">Load</a>
<a style="display: none;" class="liber_live">LiberLive C1</a>
<a title='Toggle play/stop' class="play">On</a>
<a title='Style type' class="style_type">Normal</a>
<a title='Guitar playing style' class="gamepad_mode">Color Tabs</a>
<a title='Load external file (drum, chord, bass, midi, sty, etc)' class="load_file">Load</a>
<a title='Pair/Unpair LiberLive Guitar' style="display: none;" class="liber_live">LiberLive C1</a>
<a style="display: none;" class="chorda_bluetooth">BT OFF</a>
<a style="display: none;" class="delete_style">Delete Style</a>
<a class="pedal_board">Pedal Board</a>
<a class="chord_pro">ChordPro</a>
<a class="show_lyrics">Lyrics</a>
<a class="save_reg">Save</a>
<a style="display: none;" class="record_song">Record</a>
<a class="reset_app">Refresh</a>
<a title='Toggle Pedalboard Display' class="pedal_board">Pedal Board</a>
<a title='Edit Extended ChordPro song' class="chord_pro">ChordPro</a>
<a title='Display song lyrics' class="show_lyrics">Lyrics</a>
<a title='Save all settings as a registration (1-7)' class="save_reg">Save</a>
<a title='Record performance as video or audio file' style="display: none;" class="record_song">Record</a>
<a title='Refresh application for new settings to take effect' class="reset_app">Refresh</a>
</center><div>
<div id="sequencer2" style="margin:10px">
<span style="font-size: 14px;margin-left:2px" id="sequencer">Tempo:<span id="showTempo">100</span></span>
<input id="tempo" type="range" min="30.0" max="160.0" step="1" value="100" style="height: 20px; width: 150px">
<input style="margin-left: 10px;margin-right: 10px;" id="microphone" type="checkbox">Mic
<input style="margin-left: 10px;margin-right: 10px;" id="autoFill" type="checkbox" checked>Auto Fill
<input style="margin-left: 10px;margin-right: 10px;" id="introEnd" type="checkbox" checked>Intro/Outro
<input checked style="margin-left: 10px;margin-right: 10px;" id="reverb" type="checkbox">Pedals
<input style="margin-left: 10px;margin-right: 10px;" id="program-change" type="checkbox">No P.Change
<input id="volume" type="range" min="0.0" max="100.0" step="1" value="25" style="height: 20px; width: 150px;margin-left: 20px;margin-right: 10px;">
<input title='Overall Tempo control' id="tempo" type="range" min="30.0" max="160.0" step="1" value="100" style="height: 20px; width: 150px">
<input title='Enable microphone' style="margin-left: 10px;margin-right: 10px;" id="microphone" type="checkbox">Mic
<input title='Play Drum Fills automatically when variation chnages' style="margin-left: 10px;margin-right: 10px;" id="autoFill" type="checkbox" checked>Auto Fill
<input title='Play Intro end Ending' style="margin-left: 10px;margin-right: 10px;" id="introEnd" type="checkbox" checked>Intro/Outro
<input title='Enable Guitar pedal effects' checked style="margin-left: 10px;margin-right: 10px;" id="reverb" type="checkbox">Pedals
<input title='Dont override midi file program change settings' style="margin-left: 10px;margin-right: 10px;" id="program-change" type="checkbox">No P.Change
<input title='Guitar volume control' id="volume" type="range" min="0.0" max="100.0" step="1" value="25" style="height: 20px; width: 150px;margin-left: 20px;margin-right: 10px;">
<span id="showVol">VOL</span>
</div>
</td>
Expand All @@ -54,9 +54,10 @@

<table id="settings" width="90%">
<tr><td><b>Guitar Strum</b></td><td><select id="guitarType" type="text" class="form-control input"></select></td>
<td><select id="guitarStrum1" type="text" class="form-control input"></select></td>
<td><select id="guitarStrum2" type="text" class="form-control input"></select></td>
<td><select id="guitarStrum3" type="text" class="form-control input"></select></td>
<td><select title='Strum type for Pad 3'id="guitarStrum1" type="text" class="form-control input"></select></td>
<td><select title='Strum type for Pad 4'id="guitarStrum2" type="text" class="form-control input"></select></td>
<td><select title='Strum type for Pad 5' id="guitarStrum3" type="text" class="form-control input"></select></td>
<td><select title='Neck Position' id="guitarPosition" type="text" class="form-control input"><option value=1>I</option><option selected value=2>II</option><option value=3>III</option></select></td>
</tr>
<tr><td><b>Arranger Type</b></td><td><select id="arrangerType" type="text" class="form-control input"></select></td><td valign="top" rowspan="13" colspan="4"><div id="synth"></div></td></tr>
<tr><td><b>Arranger Group</b></td><td><select id="arrangerGroup" type="text" class="form-control input"></select></td><td></td></tr>
Expand Down
52 changes: 35 additions & 17 deletions docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ var lock = {counter: 0, up: 0, down: 0, button: -1};

var O = 12;
var C = 0, Cs = 1, Db = 1, D = 2, Ds = 3, Eb = 3, E = 4, F = 5, Fs = 6, Gb = 6, G = 7, Gs = 8, Ab = 8, A = 9, As = 10, Bb = 10, B = 11;
var __6th = E +O*3, __5th = A +O*3, __4th = D +O*4, __3rd = G +O*4, __2nd = B +O*4, __1st = E +O*5;

var chordChart = [
[{base: C +O*2, strings: [ 3, 3, 2, 0, 1, 0]}, {base: C +O*2, strings: [-1, 3, 5, 5, 4, 3]}, {base: C +O*2, strings: [-1, -1, 3, 0, 1, 3]}],
[{base: Cs +O*2, strings: [-1, -1, 3, 1, 2, 1]}, {base: Cs +O*2, strings: [-1, -1, 2, 1, 2, 0]}, {base: Cs +O*2, strings: [-1, -1, 3, 3, 4, 1]}],
Expand Down Expand Up @@ -2117,7 +2115,8 @@ function updateStatus() {
pad.buttons[i] = touched;
updated = true;
}
}
}

if (guitar.axes.length > STRUM)
{
if (pad.axis[STRUM] != guitar.axes[STRUM].toFixed(4)) {
Expand Down Expand Up @@ -2214,7 +2213,11 @@ function updateStatus() {
}

if (updated) {
doChord();
if (styleStarted && songSequence) {
handleSongMode();
} else {
doChord();
}
updateCanvas();

if (riffMasterXbox) {
Expand All @@ -2232,6 +2235,18 @@ function updateStatus() {
window.setTimeout(updateStatus);
}

function handleSongMode() {
let processed = false;

if ((pad.buttons[YELLOW] || pad.buttons[BLUE] || pad.buttons[ORANGE] || pad.buttons[RED] || pad.buttons[GREEN]) && !pad.buttons[START] && !pad.buttons[STARPOWER]) {
processed = true;
}

if (!processed) {
doChord();
}
}

function letsGo() {
let data = localStorage.getItem("orin.ayo.config");
if (!data) data = '{"arranger": "webaudio"}';
Expand Down Expand Up @@ -2601,6 +2616,7 @@ async function setupUI(config,err) {
strum1 = config.strum1 || strum1;
strum2 = config.strum2 || strum2;
strum3 = config.strum3 || strum3;
document.getElementById("guitarPosition").selectedIndex = config.strumPos

guitarStrum[1].addEventListener("change", function()
{
Expand Down Expand Up @@ -3477,6 +3493,7 @@ function saveConfig() {
config.reverb = guitarReverb.checked;
config.microphone = microphone.checked;
config.programChange = document.querySelector("#program-change").checked;
config.strumPos = document.getElementById("guitarPosition").selectedIndex;
config.liberLiveChrd1 = liberLive.chord1;
config.liberLiveChrd2 = liberLive.chord2;
config.liberLiveDrms1 = liberLive.drums1;
Expand Down Expand Up @@ -3994,6 +4011,8 @@ function getVelocity() {
}

function getPitches(seq) {
const pos = parseInt(document.getElementById("guitarPosition").value);
__6th = E +O*(pos+2), __5th = A +O*(pos+2), __4th = D +O*(pos+2), __3rd = G +O*(pos+2), __2nd = B +O*(pos+2), __1st = E +O*(pos+3);
const p = [];
const arrChord = (firstChord.length == 4 ? firstChord[1] : firstChord[0]) % 12;
const chordType = (arrChordType == "sus" ? 2 : (arrChordType == "min" ? 1 : 0));
Expand Down Expand Up @@ -4794,27 +4813,26 @@ function doChord() {
{
if (pad.buttons[START]) { // start + button activates pad mode

if (pad.buttons[YELLOW] && pad.buttons[BLUE]) { // mute internal guitar
padsMode = 0;
seqIndex = 0;
orinayo_pad.innerHTML = "None";

if (pad.buttons[YELLOW] && pad.buttons[BLUE]) { // Guitar position C3
document.getElementById("guitarPosition").selectedIndex = 2;
}
else

if (pad.buttons[GREEN] && pad.buttons[RED]) { // TODO

if (pad.buttons[GREEN] && pad.buttons[RED]) { // Guitar position C4
document.getElementById("guitarPosition").selectedIndex = 0;
}

else

if (pad.buttons[RED] && pad.buttons[YELLOW]) { // TODO

if (pad.buttons[RED] && pad.buttons[YELLOW]) { // Guitar postion C5
document.getElementById("guitarPosition").selectedIndex = 1;
}
else

if (pad.buttons[BLUE] && pad.buttons[ORANGE]) { // TODO

if (pad.buttons[BLUE] && pad.buttons[ORANGE]) { // mute internal guitar
padsMode = 0;
seqIndex = 0;
orinayo_pad.innerHTML = "None";
}
else {
if (pad.buttons[GREEN]) padsMode = 1; // full chord up/down
Expand Down Expand Up @@ -6069,7 +6087,7 @@ function scheduleSongNote() {
resetGuitarHero();
}
playChord(chord, event.chordRoot, event.chordType, event.chordBass);
updateCanvas();
//updateCanvas();
}
}
else
Expand Down Expand Up @@ -6580,4 +6598,4 @@ function saveRegistration(slot) {

function midiProgramChangeEvent(target) {
console.debug("midiProgramChangeEvent", target.selectedIndex, target.id);
}
}
3 changes: 2 additions & 1 deletion docs/js/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,6 @@ var drum_loops = [
"assets/drums/surf_170_2824_11294_1412_1412_8471.drum",
"assets/drums/triple-hop_85_2824_11294_2824_2824_5647.drum",
"assets/drums/u2-guitar_105_27429_18286_2286_2286_11429.drum",
"assets/drums/village-pop_107_2243_8972_2243_2243_4486.drum"
"assets/drums/village-pop_107_2243_8972_2243_2243_4486.drum",
"assets/drums/wonderfull_94_2553_10213_2553_2553_5106.drum"
]

0 comments on commit 4f439c0

Please sign in to comment.