[Home]WebAudio

HomePage | RecentChanges | Preferences

WebAudio

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.

IIR poles and zeros

Using Audacity to Capture a V.21 and BAUDOT modem

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.

Filters and a UART

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]

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.

it is possible to decode the ITU V.8 CI messages and TXP sent by some modems.

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

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

A UART interfacing to a computer

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]

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

Sending AT Commands To A Modem

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

Conclusion

The Web Browser is a useful tool!


HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited September 12, 2023 7:50 am by dougrice.plus.com
Search:
home page