Extensionaudio frequency-shift keying (AFSK) as used by old computers to store data on cassette. See https://en.wikipedia.org/wiki/Kansas_City_standard
a new encoder/decoder using square or sine waves.
| sampleRate |
defaults to the server's sample rate. |
| baudRate |
can go lower and higher. lower can be interesting sound-wise. higher for faster transmission. |
| zeroFreq |
in Hz. the standard specifies 1200 which mean that at 300 bauds there will be four pulses/cycles for marking a zero bit. |
| oneFreq |
in Hz. the standard specifies 2400 which mean that at 300 bauds there will be eight pulses/cycles for marking a one bit. |
| addNewlineGap |
optional. add ten extra NULL characters at the end of each line. |
| addCarriageReturn |
optional. add an extra |
| leaderDur |
in seconds. lead-in data (stream of 1). |
| trailerDur |
in seconds. trailing data (stream of 1). |
600 baud is possible without increasing the zeroFreq and oneFreq values. for 1200 baud use frequencies of 2400 and 4800.
convert an 8-bit value into an array of samples.
| byte |
an Integer 0-255. |
an array of samples. for square waves an Int8Array and for sines a FloatArray.
convert a string into an array of samples.
| str |
a String. |
a FloatArray of samples. either square waves or sines.
convert a string into a buffer that can be played.
| server |
defaults to |
| str |
the string to be encoded. |
| action |
a Function for what to do when the buffer is created. |
the Buffer instance (if successful). note that the buffer will not be filled with samples yet - use the action function.
convert a string into a sound file (render to disk).
| str |
the string to be encoded. |
| path |
a string specifying where to save the resulting sound file. |
a Boolean indicating if creating the file was successful.
convert an array of sample values into an array of 8-bit bytes.
| arr |
a FloatArray. |
| rate |
sample rate of the data. if not specified -sampleRate will be used. |
| channels |
might need to adapt this if the samples in the array are interleaved (stereo). |
an Int8Array.
convert a buffer of sample values into a string.
| buf |
the Buffer instance to decode. |
| raw |
a Boolean indicating if output should be the raw bytes (Int8Array) or a String (with any NULL characters removed). |
| action |
a Function that will be called when the decoding is finished. the string or array with raw bytes is passed in as the first argument. |
convert a sound file into a string.
| path |
a String pointing at the sound file to be decoded. mono or multi-channel does not matter - only the first (left) channel will be used. |
| raw |
a Boolean indicating if output should be the raw bytes (Int8Array) or a String (with any NULL characters removed). |
start realtime generation using square or sine waves.
| target | |
| out |
bus to play on. |
| amp |
volume |
| addAction |
a Symbol. |
turn off realtime generation
start realtime analysis.
| target | |
| action |
a Function that will be called when and if the decoding is finished. a string is passed in as the first argument. |
| in |
bus to listen to. use |
| thresh |
internal analyser synth's amplitude threshold (+/-). |
| rq |
internal analyser synth's bandpass filter bandwidth. |
| addAction |
a Symbol. NOTE: defaults to \addToTail because normally the internal analyser synth needs to be below any sound generating synths in the order of execution |
free internal analyser synth and responder. also a CmdPeriod will clear these.