Because I am a music nerd, I've made a little script to generate a random rhythmic pattern:
echo "X ";
for ($beats=rand(0,11); $beats>0; $beats--){
$xo=rand(0,2);
if ($xo==0){
echo "x ";
}
else {
echo "- ";
}
}
It gives a random rhythm of up to 12 beats, where 'x' indicates an accented beat, with the first beat always accented. (Example output: X-x-x--)
Now, for looks, I'd like to place this data into an html table. I would like the markup for the example above to be like so:
<table border="1">
<tr>
<th>Beat:</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
<th>7</th>
</tr>
<tr>
<td>Accent:</td>
<td>X</td>
<td>-</td>
<td>x</td>
<td>-</td>
<td>x</td>
<td>-</td>
<td>-</td>
</tr>
</table>
Alas, this is where my programming skill ends. Can anyone offer some code to help with this?