This experimental page started off experimenting with the CANVAS for drawing and audio. Ways of generating sinewaves were tried.
use UPPERCASE and l for letters and n for numbers. Start with "lnl "
Slow:BELL103: BAUDOT reference
Plots different ways of genrating sine waves
* 3 Phase Oscillator and x=x+y*n, y=y-x*n
* iir
* IIR using Andrew Bateman's version of Geortzel's Oscillator function analyseSamples3(){
* Rotating Phasor Oscillator A = A*M, Increment A by M, where M is a Phasor.
|
|
300 baud
| V.21(low band) 970Hz: Hz
1170Hz: Hz
found
textareasamples to copy into the other webpages.
/*
* modem
*/
/*
*
* Baudot
*
* I have a string of text,
*
* I need to convert it to a string of baudot.
* It needs a Shift character added as required.
* if there is a need for a shift insert one
* send a shift every 71 characters.
*
* Put all of that together and we get this:
*
* carrier (for 150ms) + 0 + 11000 + 1 (for 40ms)
*
* 0 - 1800Hz
* 1 - 1400Hz
* START 0
* STOP 1
*
* How do you do the shifts?
* Use a bit to say do shift
*
* [ string of ASCII ]--[ convert to BAUDOT ]--[ UART ]--[ numerically controlled Osc ]--[ audio sample ]
*
* for each audio sample use nested count down state machines.
*
*
*/
function asciiToBaudot( letter ){
var code = letter
//return( letter1 )
// https://learn.adafruit.com/clue-teletype-transmitter/tty-fundamentals
// using \B - backspace \n - CR \r - LF \" - "
var baudot = "\bE\nA SIU\rDRJNFCKTZLWHYPQOBGnMXVl" +
"\b3\n- _87\r$4',!:(5\")2=6019?+n./;l"
var code = baudot.search( letter )
console.log( letter, code )
//console.log( letter1, code )
if ( code > 0 ){
return code
} else {
return 0x04
}
}
/*
* Send Text String as BAUDOT
*
* This function generates a sequence of samples.
* It is assumed that the sampling rate is 8000 samples per second.
* It could be modified to other sample rates.
*
* [ String buffer ]---[ ASCII/BAUDOT converter]---[ UART ]---[ modem ]
* The UART is clocked at the BAUD rate for BAUDOT, which can be 50, 45.45, or 47 BAUD , just to complicate things.
* The for next loop increments time in steps of 1/SAMPLE Rate
*
* The modem is implimented using A=A*M
* where A is a complex number and M is a Phasor constant.
*
* There is an M for a "0" bit and an M for a "1" bit.
* A accumulates and the real component is output to the D to A converter.
*
* In this code, the modem pulls, the next bit at 8000/BAUDOT
* The state machine for the UART , pulls a character from the ASCII/BAUDOT converter.
*
* The ASCII / BAUDOT converter pulls a character from the string to send.
* If there is no character to send, it should poll the string buffer periodically
* to see if a character is available for transmission.
* or every sample, it should poll to see if the CountDown UART is running.
*
*
*/
The Geotzel Algorithm is a very simple way to generate a sine wave and can be used as a resonator.
exp( jx ) = cos( x ) + j sin( x ) exp( -jx ) = cos( x ) + -j sin( x ) 2* cos( x ) = exp( jx ) + exp( -jx ) j2* sin( x ) = exp( jx ) - exp( -jx )
A way of thinking is two contra rotating Phasors, p1 and p2.
p1 and p2 could also be poles.
A1 = A1*p1 A2 = A2*p2 A = A1+A2
Consider:-
[ z^-1 ] is a delay of one sample.
sum
ip --(+)--|--[ z^-1 ]-+-[ z^-1 ]-+
| | b1 | b2
+---------------+----------+
simplify it to:-
sum
ip --(+)--|--[ B ]-+
| |
+------------+
sum = ip + B*sum
sum*( 1 - B ) = ip
ip = 1/( 1 - B )
Z transform where Z is normally z^-1 = exp( j 2PI f/Fs ) where T is 1/Fs the samples rate
p1 and p2 are two poles within the unit circle.
p1 = mag*exp( jx )
p2 = mag*exp( -jx )
p1+p2 = mag*2*cos( x )
p1*p2 = mag*mag*exp( jx -jx) = mag*mag* exp( 0 ) = mag*mag
B = ( 1 + p1 Z )(1 + p2 Z )
= ( 1 + p1 Z + p2 Z +p1 Z p2 Z )
= ( 1 + ( p1+p2 ) Z +p1*p2*Z*Z )
= ( 1 + mag*2*cos( x ) * Z + mag*mag * Z * Z)
( 1 - B ) = ( 1- ( 1 + mag*2*cos( x ) * Z + mag*mag * Z*Z ) )
= ( 1- mag*2*cos( x ) * z^-1 - mag*mag * z^-2 )
b1 = - mag*2*cos( x ) where x = 2PI f/Fs
b2 = - mag*mag
NOTE: check for errors!