Mikrofonunuz varsa gitarınızı bu javascript ile akord edebilirsiniz.


<BODY>..</BODY> arasına eklenecek kod :



<H2>JavaScript Gitar Akordu</H2>

<TABLE BORDER=2 WIDTH=160 ALIGN=CENTER>

<TR>

<TD BGCOLOR="blue" CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER >

<FORM NAME="guitar">

<SCRIPT LANGUAGE="JavaScript">

<!--

// initialize timer handle

var Timerid = 0;

// create chords; each chord is a separate element of an associative array, and is referenced by the name

// of the chord. The string assigned to the array element (which is parsed later in the script)

// specifies the strings of the chord. The guitar strings are numbered 0 through 5 for the first band,

// 6 through 11 for the second, and so forth. The set of six 0s and 1s denotes guitar strings that aren't

// played, and are shown flashing in the chart.

var chords = new Object();

chords["A"] = "100000;1;5;14;15;16"

chords["A7"] = "100000;1;3;5;14;16"

chords["Am"]= "100000;1;5;10;14;15"

chords["Am7"]= "010001;30;32;33;34"

chords["A13"]= "100000;1;3;20;22;23"

chords["B7"] = "100000;4;8;13;15;17"

chords["C"] = "100000;3;5;10;14;19"

chords["D"] = "110000;2;15;17;22"

chords["D7"] = "110000;2;10;15;17"

chords["Dm"] = "110000;2;11;15;22"

chords["D9"] = "100000;26;31;33;34;35"

chords["E7"] = "000000;0;2;4;5;9;13"

chords["Em7"] = "000000;0;3;5;13;14;22"

chords["Eb9"] = "100000;20;25;27;28;29"

chords["E13"] = "000000;0;2;5;9;13;16"

chords["F"] = "110000;10;11;15;20"

chords["F5"] = "001111;6;19"

chords["G"] = "000000;2;3;4;13;18;23"

chords["G5"] = "001111;24;37"

chords["G7"] = "000000;2;3;4;11;13;18"

chords["Gmaj7"] = "010001;18;22;26;27"

chords["Gm7"] = "010001;18;20;21;22"

chords["G6"] = "010001;14;18;22;27"

chords["G6/9"] = "110000;14;15;22;23"

// build the chart in the table

for (Countx = 1; Countx < 8; Countx++) {

var Count, Countx;

for (Count = 1; Count <7; Count++) {

document.write ("<input type=radio onClick='toggle(this)'>")

}

document.write ("
")

if (Countx == 1)

document.write ("<img src=black.gif width=150 height=3 align=absmiddle>")

else

document.write ("<img src=black.gif width=150 height=1 align=absmiddle>")

document.write ("
")

}

function toggle(button) {

button.checked = !button.checked;

}

// remove the check from all radio buttons

function resetGuitar() {

var Count;

clearTimeout(Timerid);

for (Count=1; Count < 42; Count++) {

document.guitar[Count-1].checked=false

}

}

// flash a button for any string that shouldn't be played

function flashString () {

var Count;

for (Count = 0; Count < 6; Count++) {

if (Frets[1].substring(Count,Count+1) == "1")

document.guitar[Count].checked = !document.guitar[Count].checked

}

Timerid = setTimeout ("flashString()", 500)

}

// set the chord pattern

function setGuitar() {

resetGuitar();

var Item, Ret, Count, Temp, Skip;

Item = document.guitar.chord.selectedIndex;

if (Item != -1) {

Text = document.guitar.chord.options[Item].text;

Frets = parser (chords[Text])

for (Count = 2; Count <= Frets[0]; Count++) {

Temp = parseInt(Frets[Count]);

document.guitar[Temp].checked=true;

}

if (parseInt(Frets[1]) > 0)

flashString();

}

}

// general function for parsing strings using a specified parse character; result is values in

// separate elements of an array

function parser (InString) {

var Sep = ";", NumSeps=1, Count, Start, ParseMark, parse;

for (Count=1; Count < InString.length; Count++) {

if (InString.charAt(Count)==Sep)

NumSeps++;

}

parse = new Array ();

var Start=0, Count=1, ParseMark=0, LoopCtrl=1;

while (LoopCtrl==1) {

ParseMark = InString.indexOf(Sep, ParseMark);

TestMark=ParseMark+0;

if ((TestMark==0) || (TestMark==-1)){

parse[Count]= InString.substring (Start, InString.length);

LoopCtrl=0;

break;

}

parse[Count] = InString.substring (Start, ParseMark);

Start=ParseMark+1, ParseMark=Start, Count++;

}

parse[0]=Count;

return (parse);

}

// -->

</SCRIPT>





</TD></TR>

<TD ALIGN=CENTER BGCOLOR="gray">

<SELECT NAME="chord" SIZE=6>

<OPTION>A

<OPTION>A7

<OPTION>Am

<OPTION>Am7

<OPTION>A13

<OPTION>B7

<OPTION>C

<OPTION>D

<OPTION>D7

<OPTION>Dm

<OPTION>D9

<OPTION>E7

<OPTION>Em7

<OPTION>Eb9

<OPTION>E13

<OPTION>F

<OPTION>F5

<OPTION>G

<OPTION>G5

<OPTION>G7

<OPTION>Gmaj7

<OPTION>Gm7

<OPTION>G6

<OPTION>G6/9

</SELECT>

<HR>





<INPUT TYPE="button" VALUE="Set" onClick="setGuitar()">

<INPUT TYPE="button" VALUE="Clear" onClick="resetGuitar()">

</FORM>

</TD></TR>

</TABLE>