It is possible to do Audio in a Webpage.
Web pages now support a large range of WebAPI two of which are <CANVAS> for graphics and Audio.
http://www.dougrice.plus.com/dev/UART/xyz.htm tries out some ways to generate sine waves.
It provides a way to experiment with digital filters.
When debugging DSP that has a stereo DtoA it is possible to use one DtoA channel to provide a debug waveform to annotate the other signal.
I can use JavaScript to do the maths and plot a graph.
A couple of lines are used as debug.
The state of the UART and sampler can be shown.
It can show when a waveform is sampled.
http://www.dougrice.plus.com/dev/UART/UART2_V21.htm - Try and decode the capture of a V.21 modem
http://www.dougrice.plus.com/dev/UART/UART2_BAUDOT.htm - This page uses a UART configured for BAUDOT that uses 5 bits and does a crude BAUDOT to ASCII
http://www.dougrice.plus.com/dev/UART/UART2_DTMF.htm can be used to decode DTMF.
This page describes some dabbles with webpages analyzing exported data of recording from a simple modem.
Using a simple wiretap, record the telephone signal. IMPORTANT: The two LED snub any voltage spikes when you go onhook / offhook. A cheap USB soundcard was used incase the LEDs did not snub and to provide a 3.5mm socket. We are interested in timing and frequencies.
Audacity was used to capture audio of a modem training up on a telephone line.
https://www.audacityteam.org/ has been useful to analyse audio on phone lines
It has found problems, that a scope would not find. Screen shots provide a useful way to summarise protocols that may take a few seconds to transact.
The picture below show Audacity displaying the spectrogram of the capture when a V.21 modem answers an incoming call.
The ringing, 2100Hz ANS, V.21(high) 1650Hz Carrier , V.21(low) 970Hz carrier and burst of data are seen.
Audacity cannot decode DTMF or the Modem FSK signals used by V.21, but it is possible to export the data.
Copy and past the samples into one of the web pages below. They use JavaScript to analysis it. The CANVAS can be used to plot waveforms and debug waveforms.
The Analyse spectrum and Spectrograms can establish what frequencies are being used, and sections of interest.
Typically the Modem takes a serial signal, using voltages encoding the "1"'s and "0" using MARK and SPACE and uses FSK frequency Shift keying.
[computer program]--[UART]--[modem]--[telephone system]--[modem]--[UART]--[computer crogram]
Very useful diagrams from https://docs.rs-online.com/a02c/0900766b800af005.pdf - data sheet for V21 modem.
It is quite simple to analyse the samples exported from Audacity using JavaScript, using code run for each sample. The pages can be updated as required for the task in hand.
The samples are passed into IIR filters to detect the V.21 FSK signals.
Some logic is needed to decide if the FSK is encoding a "1" or "0".
Logic is used to find the "1"'s MARK and "0"'s SPACE. These are fed into the UART. It looks for the start bit and then clocks 5 bits for BAUDOT or 8 bits for V.21.
Countdown State machines are used for the FSK logic, UART and DEBUG.
The UART emits characters. Parity may need to be stripped, and the decoded text can be displayed.
http://www.dougrice.plus.com/dev/UART/UART2_V21.htm - Try and decode the capture of a V.21 modem
http://www.dougrice.plus.com/dev/UART/UART2_BAUDOT.htm - This page uses a UART configured for BAUDOT that uses 5 bits and does a crude BAUDOT to ASCII
http://www.dougrice.plus.com/dev/UART/UART2_DTMF.htm can be used to decode DTMF.
ITU V.21 used FSK with 1070 +/- 100Hz and 1750 +/-100Hz, or 970,1170, 1650, 1850 Hz. Some modems use bandbass filters.
It is possible to filter out the V.21(high) 1650Hz or V.21(l) 970Hz using Audacity.
This Filter designer: http://jaggedplanet.com/iir/iir-explorer.asp was used to design a Butterworth notch filter
A modem using the ITU V.8 spec, has other interesting bursts of characters to decode as seen in the picture above. Other pages can decode DTMF and BAUDOT captured using Audacity.
Modems use V.21 as part of the ITU V.8 protocols and it is unlikely that the USB modem can output these.
However by copying the recorded samples into the webpage, it is possible to decode the ITU V.8 CI messages and TXP sent by some modems.
ITU V.8 CI signal captured and decoded. A A A A A 0x41 0xff 0x0 0x41 0xff 0x0 0x41 0xff 0x0 0x41 0xff 0x0 0x41 0xff 0x0
Where the V.21 signal had both carriers, Audacity could be used to filter out one carrier.
My first pages included the samples in a textarea or between DIV tags but the files got very big to compare using notepad++ compare so I wrote a cscript program to split the files.
https://homepages.plus.net/dougrice/dev/UART/jsUARTsplit.js.txt
My pages can generate test signals to decode to make the download smaller
V.18 Annex B DTMF is a way of sending text using DTMF characters.
Early modems for V.21 had a RS232 interface and loads of signals.
More modern modems may have a USB plug and use the AT commands.
WebAPI allows a webpage to be used to interface to the modems
http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?AT_Commands_-_Serial_Using_Web_Browser
Typically the Modem takes a serial signal, using voltages encoding the "1"'s and "0" using MARK and SPACE and uses FSK frequency Shift keying.
[computer program]--[UART]--[modem]--[telephone system]--[modem]--[UART]--[computer c program]
The UART interface to the computer program is summarised as a TX and RX register and two flags TxEmpty and RxFull.
CPU - UART:-
A write to TX resets TxEmpty. A read from RX resets RxFull.
UART - Host:-
A read from TX sets TxEmpty. A write to RX sets RxFull.
If you have a FIFO then there need to be changes.
TxEmpty may need to be TxSpaceAvailable RxFull becomes RxAvailable
I have a JavaScript page that explores this: http://www.dougrice.plus.com/dev/DigiSpark/text0.html
Between the UART and the C program is a lot of API.
https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API
And these dabbles to try driving an old modem over a serial port. The Webpage does not always see the USB modems, so I have to use a serial lead plugged into a Modem.
Not all modems recognise the same AT commands and these do not work.
The web pages automate driving the modem just enough and can always be copied and extended.
https://homepages.plus.net/dougrice./dev/DigiSpark/simpleterm/simpletermModem.html
V.21 modems are FULL DUPLEX and uses these frequencies
ITU-T v.21 Originate 1080 = Carrier 1180 = Space (Carrier + 100Hz) 980 = Mark (Carrier - 100Hz) Answer 1750 = Carrier 1850 = Space (Carrier + 100Hz) 1650 = Mark (Carrier - 100Hz)
By using four frequencies , it is possible to use the 2-wire Telephony. so both diagrams (a) and (c) can be used.
In the diagram (c) ( two wire - FULL DUPLEX ) , It would be more difficult to detect the CARRIER if the TX and RX used the same carrier.
In the diagram (a) ( four wire - FULL DUPLEX ) , consider only transmitting if the carrier from the other end is present.
BAUDOT only sends when a key is pressed and the modem listens and RX is disabled when it is sending.
This is 2 wire - Half Duplex
BAUDOT: - 5 bit * carrier (for 150ms) + 0 + 11000 + 1 (for 40ms) * * 0 - 1800Hz - SPACE * 1 - 1400Hz - MARK * START 0 * STOP 1 *
It has an added complication of needing to shift between letters and numbers which must be tracked for both directions.
https://learn.adafruit.com/clue-teletype-transmitter/tty-fundamentals
There is a EDT mode that is also 2 wire - Half Duplex and uses the V.21 frequencies , but 110 BAUD.
In the diagram (b) ( two wire - HALF DUPLEX ) , consider only transmitting using BAUDOT or EDT based on the method used from the other end.
The CD output should ensure that the carrier has been present for long enough and at a strong enough level.
It is okay to transmit a "ping" test character sequence if the CD has not been detected a carrier from the other end.
See ITU V.8 for examples.
http://www.dougrice.plus.com/dougnapTheory/index.htm has some more theory about the two wire telephony. Rice simplified Webb's equations for a telephone exchange in PO603 , which is available from the BT Heritage site.
Computation of the Characteristics of Telephone Connections
So it is possible to write down a list of 2x2 matrices and for each frequency use a computer to work out the the Microphone to earphone sensitivities. In about 1984, I was using a NASCOM 2 , Z80 based computer using BLS pascal. At some stage I purchased Turbo Pascal 3.0 for CP/M on an Amstrad 664, and also for the IBM PC. In 2009, the code was converted to JavaScript to run on the web browser.
The model for the four wire exchange model becomes:
and matrices for each element:
simplified Hybrid used in Post office 706 and 746 from the 1960's
Consider the coil, assume the windings are the same, so the voltage across each winding are the same.
If ZL == the Balance Z components, and the Earphone is high impedance, then when the voltage V3+V2 == V1+V across Zl, the Voltage across The ear phone will be minimal when the person speaks.
When the person does not speak, the AC Voltage across the MIC will be zero so V Earphone will be -V across ZL.
Circuit for Post Office 706 Telephone
Loop Dis dialling for Post Office 706 Telephone
Telephones use DTMF to speed up the signalling.
http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl?DTMF_Dabbles
Once established , a phone call is between KNOWN and KNOWN end points and allow either end to talk next.
The Client Server model, only allows the Client talk to the Server, which can respond. A PEER to PEER protocol needs to be engineered on top, with keep alives
Client Server is from an UNKNOWN to a KNOWN, but
IP4 addresses makes the endpoints UNKNOWN
VoIP: TCP-IP uses Client Server endpoints ==
There are only four things certain in life
1) Taxes 2) Death 3) Our company's Early release Schemes and 4) Re-Engineering IP protocols to have a keep alive!
The Web Browser is a useful tool!
3minor303newauthor302host2dougrice.plus.com2username22revision2382id21112tscreate216843587142keepts217232745521cache_oldmajor1371cache_oldauthor130