got sound working using <audio /> and ogg

This commit is contained in:
tmont 2022-04-19 21:46:07 -07:00
parent 5276b298b4
commit 736f79fe14
157 changed files with 67 additions and 56 deletions

View File

@ -11,7 +11,9 @@ function playNote(id) //id format: distortion_atari note index
else if (dist == "saw") dist = 2; else if (dist == "saw") dist = 2;
else if (dist == "bass") dist = 3; else if (dist == "bass") dist = 3;
document.getElementById('sound').src = "midi/"+noteArray[dist][atariIndex][0]; const audio = document.getElementById('sound');
audio.src = "midi/"+noteArray[dist][atariIndex][0];
audio.play();
writeNoteData(dist,atariIndex); writeNoteData(dist,atariIndex);
} }
} }

View File

@ -71,11 +71,11 @@
while (($file = readdir($dir)) != null) while (($file = readdir($dir)) != null)
{ {
//format: distortion_atari note index_note name_octave_freq_error_MIDI note index_pitch bend left bits_pitch bend right bits //format: distortion_atari note index_note name_octave_freq_error_MIDI note index_pitch bend left bits_pitch bend right bits
if (strpos($file,".mid")) if (strpos($file,".ogg"))
{ {
$info = explode("_",$file); $info = explode("_",$file);
$info[2] = str_replace("+","#",$info[2]); $info[2] = str_replace("+","#",$info[2]);
$info[count($info)-1] = substr($info[count($info)-1],0,strpos($info[count($info)-1],".mid")); $info[count($info)-1] = substr($info[count($info)-1],0,strpos($info[count($info)-1],".ogg"));
if (!isset($note_array[$info[0]][$info[1]])) if (!isset($note_array[$info[0]][$info[1]]))
$note_array[$info[0]][$info[1]] = array(); $note_array[$info[0]][$info[1]] = array();
@ -89,17 +89,18 @@
$green = str_pad(dechex(150),2,"0",STR_PAD_LEFT); $green = str_pad(dechex(150),2,"0",STR_PAD_LEFT);
$blue = str_pad(dechex(100-2*$note_array[$info[0]][$info[1]][4]),2,"0",STR_PAD_LEFT); $blue = str_pad(dechex(100-2*$note_array[$info[0]][$info[1]][4]),2,"0",STR_PAD_LEFT);
$color = $red.$green.$blue; $color = $red.$green.$blue;
$note_array[$info[0]][$info[1]][8] = $color; $note_array[$info[0]][$info[1]][8] = '#' . $color;
} }
} }
require ("createmidi.php"); require ("createmidi.php");
?> ?>
<!doctype html>
<html> <html>
<head> <head>
<title>Atari 2600 Music Utility</title> <title>Atari 2600 Music Utility</title>
<meta name='description' content='Enables easier composing of Atari 2600 music.' /> <meta name='description' content='Enables easier composing of Atari 2600 music.' />
<meta name='keywords' content='atari, 2600, music, composing, tmont, tommy, montgomery, midi' /> <meta name='keywords' content='atari, 2600, music, composing, midi' />
<link rel='stylesheet' type='text/css' href='style.css' /> <link rel='stylesheet' type='text/css' href='style.css' />
<script type='text/javascript'> <script type='text/javascript'>
var noteValue = 4; var noteValue = 4;
@ -240,13 +241,11 @@
echo "\n\t<div align='center' width='".($xstart+$wwidth*$numoctaves*7)."px'>\n"; echo "\n\t<div align='center' width='".($xstart+$wwidth*$numoctaves*7)."px'>\n";
echo "\n\t<span style='text-align: left; position: absolute; left: $xstart"."px; top:".(4*($wheight+$ystart))."px'>"; echo "\n\t<span style='text-align: left; position: absolute; left: $xstart"."px; top:".(4*($wheight+$ystart))."px'>";
echo "\n\t\t<label title='[c]'><input type='checkbox' accesskey='c' onclick='toggleColor()' />Color Me Blind</label>"; echo "\n\t\t<label title='[c]'><input type='checkbox' accesskey='c' onclick='toggleColor()' autocomplete='off' />Color Me Blind</label>";
echo "\n\t</span>"; echo "\n\t</span>";
echo "\n\t<span style='text-align: left; position: absolute; left: ".(-35+$xstart+$numoctaves*7*$wwidth)."px; top:".(4*($wheight+$ystart))."px'>"; echo "\n\t<span style='text-align: left; position: absolute; left: ".(-35+$xstart+$numoctaves*7*$wwidth)."px; top:".(4*($wheight+$ystart))."px'>";
echo "\n\t\t<a title='[q]' accesskey='q' onfocus='showFAQ()' href='javascript:void(0)'>FAQ</a>"; echo "\n\t\t<a title='[q]' accesskey='q' onfocus='showFAQ()' href='javascript:void(0)'>FAQ</a>";
echo "\n\t</span>"; echo "\n\t</span>";
//echo "\n\t<span style='position: absolute; top: ".(22+4*($wheight+$ystart))."px; left: 660px;' title='dot [w]' ><input type='checkbox' accesskey='w' onclick='setDotted()'>Dotted</input></span>";
?> ?>
<br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br />
@ -257,23 +256,23 @@
<tr><td colspan='2'> <tr><td colspan='2'>
<table align='center'> <table align='center'>
<tr> <tr>
<td><button accesskey='1' name='note-select' title='whole note [1]' class='note-select' onclick='selectNote(1)'><img src='img/1.gif'></img></button></td> <td><button accesskey='1' name='note-select' title='whole note [1]' class='note-select' onclick='selectNote(1)'><img src='img/1.gif' /></button></td>
<td><button accesskey='2' name='note-select' title='half note [2]' class='note-select' onclick='selectNote(2)'><img src='img/2.gif'></img></button></td> <td><button accesskey='2' name='note-select' title='half note [2]' class='note-select' onclick='selectNote(2)'><img src='img/2.gif' /></button></td>
<td><button accesskey='3' name='note-select' title='quarter note [3]' class='note-select' onclick='selectNote(4)' disabled='disabled' style='cursor: default;'><img src='img/4.gif'></img></button></td> <td><button accesskey='3' name='note-select' title='quarter note [3]' class='note-select' onclick='selectNote(4)' disabled='disabled' style='cursor: default;'><img src='img/4.gif' /></button></td>
<td><button accesskey='4' name='note-select' title='8th note [4]' class='note-select' onclick='selectNote(8)'><img src='img/8.gif'></img></button></td> <td><button accesskey='4' name='note-select' title='8th note [4]' class='note-select' onclick='selectNote(8)'><img src='img/8.gif' /></button></td>
<td><button accesskey='5' name='note-select' title='16th note [5]' class='note-select' onclick='selectNote(16)'><img src='img/16.gif'></img></button></td> <td><button accesskey='5' name='note-select' title='16th note [5]' class='note-select' onclick='selectNote(16)'><img src='img/16.gif' /></button></td>
<td><button accesskey='6' name='note-select' title='32nd note [6]' class='note-select' onclick='selectNote(32)'><img src='img/32.gif'></img></button></td> <td><button accesskey='6' name='note-select' title='32nd note [6]' class='note-select' onclick='selectNote(32)'><img src='img/32.gif' /></button></td>
<td><button accesskey='7' name='note-select' title='64th note [7]' class='note-select' onclick='selectNote(64)'><img src='img/64.gif'></img></button></td> <td><button accesskey='7' name='note-select' title='64th note [7]' class='note-select' onclick='selectNote(64)'><img src='img/64.gif' /></button></td>
<td><span title='dot [w]'><input type='checkbox' accesskey='w' onclick='setDotted()'>Dotted</input></span></td> <td><label title='dot [w]'><input type='checkbox' accesskey='w' onclick='setDotted()' />Dotted</label></td>
</tr> </tr>
<tr> <tr>
<td align='center'><button name='note-select' title='whole rest' class='rest-select' onclick='writeRestData(1)'><img src='img/r1.gif'></img></button></td> <td align='center'><button name='note-select' title='whole rest' class='rest-select' onclick='writeRestData(1)'><img src='img/r1.gif' /></button></td>
<td align='center'><button name='note-select' title='half rest' class='rest-select' onclick='writeRestData(2)'><img src='img/r2.gif'></img></button></td> <td align='center'><button name='note-select' title='half rest' class='rest-select' onclick='writeRestData(2)'><img src='img/r2.gif' /></button></td>
<td align='center'><button name='note-select' title='quarter rest' class='rest-select' onclick='writeRestData(4)'><img src='img/r4.gif'></img></button></td> <td align='center'><button name='note-select' title='quarter rest' class='rest-select' onclick='writeRestData(4)'><img src='img/r4.gif' /></button></td>
<td align='center'><button name='note-select' title='8th rest' class='rest-select' onclick='writeRestData(8)'><img src='img/r8.gif'></img></button></td> <td align='center'><button name='note-select' title='8th rest' class='rest-select' onclick='writeRestData(8)'><img src='img/r8.gif' /></button></td>
<td align='center'><button name='note-select' title='16th rest' class='rest-select' onclick='writeRestData(16)'><img src='img/r16.gif'></img></button></td> <td align='center'><button name='note-select' title='16th rest' class='rest-select' onclick='writeRestData(16)'><img src='img/r16.gif' /></button></td>
<td align='center'><button name='note-select' title='32nd rest' class='rest-select' onclick='writeRestData(32)'><img src='img/r32.gif'></img></button></td> <td align='center'><button name='note-select' title='32nd rest' class='rest-select' onclick='writeRestData(32)'><img src='img/r32.gif' /></button></td>
<td align='center'><button name='note-select' title='64th rest' class='rest-select' onclick='writeRestData(64)'><img src='img/r64.gif'></img></button></td> <td align='center'><button name='note-select' title='64th rest' class='rest-select' onclick='writeRestData(64)'><img src='img/r64.gif' /></button></td>
</tr> </tr>
</table> </table>
</td></tr> </td></tr>
@ -299,8 +298,18 @@
</tr> </tr>
<tr> <tr>
<td align='center'><input type='radio' name='channel_select' checked='checked' onclick='toggleChannel(1)'>Channel 1</input> <td align='center'>
<td align='center'><input type='radio' name='channel_select' onclick='toggleChannel(2)'>Channel 2</input></td> <label>
<input type='radio' name='channel_select' checked='checked' onclick='toggleChannel(1)' />
Channel 1
</label>
</td>
<td align='center'>
<label>
<input type='radio' name='channel_select' onclick='toggleChannel(2)' />
Channel 2
</label>
</td>
</tr> </tr>
<tr> <tr>
<td> <td>
@ -442,7 +451,7 @@
<!-- END FAQ --> <!-- END FAQ -->
<script type='text/javascript'>disableNils();</script> <script type='text/javascript'>disableNils();</script>
<bgsound id='sound'> <!-- IE only --> <audio id='sound'></audio>
</body> </body>
</html> </html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More