mirror of
https://github.com/danog/system-bus-radio.git
synced 2024-12-02 14:57:49 +01:00
Made song editable
Based on pull request #1... The list of frequencies to be played has been moved from the JS to a textbox in the HTML. Editing the content of the box will change what gets played. The format also is more human human readable and consistent with the songfile from #1. If you copy and paste the smb.song file, it should work.
This commit is contained in:
parent
b21a02337a
commit
e11eb7bf96
@ -16,8 +16,35 @@
|
||||
<div class="content">
|
||||
</br>
|
||||
<input type="button" value="Play Song" onclick="start()"></br></br>
|
||||
<textarea id="logs" style="width:70%;min-height:300px">Tested with Chrome at 1560Khz
|
||||
</textarea>
|
||||
<textarea id="logs" style="width:70%;min-height:100px">Tested with Chrome at 1560Khz</textarea>
|
||||
<textarea id="tones" style="width:70%;min-height:200px">
|
||||
Feel free to edit the code below. Just make sure you keep to the format that it's in and have all of the punctuation.
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2093 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2673 length=790;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2349 length=790;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=3136 length=400;
|
||||
:beep frequency=3136 length=790;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2093 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2673 length=400;
|
||||
:beep frequency=2349 length=400;
|
||||
:beep frequency=2093 length=790;</textarea>
|
||||
<div style="font-size:14px">Ported by Yeo Quan Yang. Credits to the original author William Entriken @https://github.com/fulldecent</div><br/>
|
||||
<div style="font-size:14px">Project site at <a href="https://github.com/fulldecent/system-bus-radio">https://github.com/fulldecent/system-bus-radio</a></div><br/>
|
||||
<div style="font-size:14px">List of computers that work and what frequency to try at <a href="https://github.com/fulldecent/system-bus-radio/blob/master/TEST-DATA.tsv">https://github.com/fulldecent/system-bus-radio/blob/master/TEST-DATA.tsv</a></div>
|
||||
|
@ -29,30 +29,22 @@ function square_am_signal(time,freq) {
|
||||
}
|
||||
|
||||
function start() {
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2093);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.790, 2673);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.790, 2349);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 3136);
|
||||
square_am_signal(0.790, 3136);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2093);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.400, 2673);
|
||||
square_am_signal(0.400, 2349);
|
||||
square_am_signal(0.790, 2093);
|
||||
var song = document.getElementById("tones").value.split(":");
|
||||
var length = song.length;
|
||||
var i = 1, line, time, freq;
|
||||
while (1 <= length) {
|
||||
line = song[i].split(" ");
|
||||
if (line[0] == "beep") {
|
||||
freq = +line[0].split("=")[1];
|
||||
time = +line[2].split("=")[1].slice(0,-1);
|
||||
square_am_signal(time, freq);
|
||||
}
|
||||
if (line[0] == "delay") {
|
||||
// delay
|
||||
}
|
||||
if (song[i] == "end") {
|
||||
i = 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user