kamalmostafa / minimodem

general-purpose software audio FSK modem
http://www.whence.com/minimodem
Other
846 stars 113 forks source link

Telecommunications device for the deaf #6

Closed ghost closed 8 years ago

ghost commented 9 years ago

http://en.wikipedia.org/wiki/Telecommunications_device_for_the_deaf#Sample_conversation

Ive tried various different things I can't get it to work :

╭─erratic@laptop  ~/itrpwork/minimodem/src  ‹master*›
╰─$ minimodem --rx 45.4545 --baudot --startbits 1 --stopbits 1.5 -i -c 4.5                                                                                                                                                                                         1 ↵
### CARRIER 45.45 @ 1420.0 Hz ###
YOPHEQEAVEPVVCQNPMHIV; P. APAME GP
### NOCARRIER ndata=44 confidence=7.302 ampl=0.559 bps=44.78 (1.5% slow) ###
^C%                                                                                                                                                                                                                                                                    ╭─erratic@laptop  ~/itrpwork/minimodem/src  ‹master*›
╰─$ minimodem --rx 45 --baudot --startbits 1 --stopbits 1.5 -i -c 4.5
### CARRIER 45.00 @ 1420.0 Hz ###
YOUUQPACMO AVPJQVG MACUUV PVPLEAVPVMSIKP
### NOCARRIER ndata=47 confidence=7.299 ampl=0.579 bps=44.32 (1.5% slow) ###
^C%                                                                                                                                                                                                                                                                    ╭─erratic@laptop  ~/itrpwork/minimodem/src  ‹master*›
╰─$
2 THE BAUDOT CODE
TTY devices transmit characters using a 45.45 bps or 50 bps Baudot code. Each bit has a nominal duration of 22 ms for 45.45 bps and 20 ms for 50 bps. A character consists of 1 start bit, 5 data bits, and 1-2 stop bits. The code uses a carrierless, binary FSK signaling scheme. A mark, or “1”, is transmitted with a 1400 Hz tone. The space, or “0”, is transmitted with an 1800 Hz tone.
In TTY devices, the first tone of a character may be the space tone of the start bit, or a mark tone preceding the start bit. Furthermore, there is a mark hold tone, which extends the length of time the stop bit is transmitted following the last character from 150 ms to 300 ms. The mark hold tone is not transmitted if the character is immediately followed by another character. The mark hold tone prevents the transmitting TTY device from receiving its echo and mistaking it for an incoming character. This mechanism is effective for wireline calls but may not be sufficient to mitigate echo in wireless scenarios because of the longer delays. Refer to the TTY specification for a solution to mitigating echo in wireless networks.
With 5 data bits, the Baudot code is only capable of 32 different characters, which is not enough to represent the alphabet, numbers, and punctuation. This problem is remedied by introducing “shift” characters that change the way the receiving TTY device interprets the 5 data bits. There exists the letters shift character (31) and the figures shift character (27). Following the letters shift character, the receiving TTY device interprets the 5-bit code using the letters library, which consists of letters of the alphabet. The figures library contains numbers, punctuation, and special characters. The TTY device automatically sends the shift character when the user switches from characters in one library to the other. The consequence of this scheme is that if the shift character is received incorrectly, every character thereafter will be misinterpreted with the wrong library until another shift character is received correctly, causing a string of character errors.

4.4 Bit Duration 1

The test vocoder shall meet the performance requirements for detection and regeneration when the input bit durations are in the range 22 ms ± 0.4 ms for 45.45 bps and 20 ms ± 0.4 ms for 50 bps.
4.5 Stop Bit
The test vocoder shall meet the performance requirements for detection and regeneration with stop bits ranging in duration from 1 to 2 bits, where the bits may be in the range 22 ms ± 0.4 ms for 45.45 bps and 20 ms ± 0.4 ms for 50 bps.
4.6 Phase Changes
The performance of the test vocoder shall be independent of the input’s phase changes between TTY bits. These phase changes include:
• Zero phase
• Random phase
4.7 Frequency Deviations
The test vocoder shall meet the performance requirements for detection and regeneration when the mark tone (1400 Hz) and the space tone (1800 Hz) deviate from their nominal values by ± 4.0%.
4.8 Typing Mode
For most applications, text telephone conversations are conducted live, with manual typists. The TTY call is characterized by bursts of typing followed by pauses. This is referred to as manual mode. Some TTY devices are capable of transmitting stored conversations, or files. In this case, a long, uninterrupted stream of TTY characters characterizes the TTY call. This is referred to as streaming mode. The test vocoder shall be capable of supporting both typing modes.
4.9 Preamble
In TTY devices, the first tone of a character may be the space tone of the start bit, or a mark tone preceding the start bit, which is referred to as the preamble. The test vocoder shall meet the performance requirements for detection and regeneration whether or not the preamble is present.

4.10 Mark Hold Tone
The mark hold time defines an additional period of time during which the TTY transmits a mark hold tone (1400 Hz) following the last character transmitted. The mark hold tone is not transmitted between each character if the character is followed immediately by another character. The test vocoder shall regenerate a mark hold tone for 300 ms or until the next character is regenerated, whichever is less. The test vocoder shall meet the performance requirements for detection and regeneration:
• When characters are followed by the mark hold tone.
• When characters are followed by silence.

Usage: ttygen [options]
-a <TTY audio output file>
-b <Baudot code output file>
-c <random character output file>
-l <level in dBm,-45 - -5, (default = -10.0 dBm)>
-s <stopbits,1.0, 1.5 or 2.0 (default = 2.0)>
-f <frequency tolerance as a %,-4 to +4>
(or "+-" for random within range)>
-t <timing tolerance in ms, -0.4 to +0.4>
(or "+-" for random within range)
-p <phase mode>
0: continuous (default),
1: zero phase,
2: random phase,
3: max. discontinuous>
-g <1 for random silent gaps between chars, default = 0 for none>
-h <mark hold duration (default = 300 ms)>
-N <number of characters to generate (default = 4164)>
-r <seed for random number generator>
-x <baud rate, 45 or 50>

You can find this pdf here: https://github.com/paigeadele/nBaudot/blob/master/C.S0028-A_v1.0_121503.pdf

--paigeadele (sorry I'm on the wrong account.)

ghost commented 9 years ago

Sorry I switched to my account, disregard the user that was posted as.

ghost commented 9 years ago

before you say screw that, you should watch this https://www.youtube.com/watch?v=Sowoq7oL_WM

ghost commented 9 years ago

@kamalmostafa I actually just figured out how to tune it into TTY/TDD devices, check this out, this is over Google Voice, too:

erratic@laptop:pts/11->/home/erratic/minimodem/src (0)
·> ./minimodem --rx 45.45 --baudot --startbits 1 --stopbits 1.5 -c 4.5
### CARRIER 45.45 @ 1400.0 Hz ###
YOU HAVE REACHED AN ANSWERING MACHINE, PLEASE LEAVE A MESAGE GA
### NOCARRIER ndata=67 confidence=13.138 ampl=0.032 bps=43.78 (3.7% slow) ###

I figured I'd just hack on it a little and see how close it was and surprisingly it was really easy:

diff --git a/src/minimodem.c b/src/minimodem.c
index fa91f40..1cb3ab5 100644
--- a/src/minimodem.c
+++ b/src/minimodem.c
@@ -497,7 +497,7 @@ main( int argc, char*argv[] )

     int c;
     int option_index;
-
+
     enum {
        MINIMODEM_OPT_UNUSED=256,       // placeholder
        MINIMODEM_OPT_MSBFIRST,
@@ -719,7 +719,9 @@ main( int argc, char*argv[] )
        bfsk_databits_decode = databits_decode_baudot;
        bfsk_databits_encode = databits_encode_baudot;
        bfsk_data_rate = 45.45;
-       if ( bfsk_n_data_bits == 0 )
+    bfsk_mark_f = 1400; //2083.0 + 1/3.0
+    bfsk_space_f = 1800;
+    if ( bfsk_n_data_bits == 0 )
            bfsk_n_data_bits = 5;
        if ( bfsk_nstopbits < 0 )
            bfsk_nstopbits = 1.5;
@@ -804,9 +806,9 @@ main( int argc, char*argv[] )
         */
        autodetect_shift = 170;
        if ( bfsk_mark_f == 0 )
-           bfsk_mark_f  = 1585;
+           bfsk_mark_f  = 1400; //1585;
        if ( bfsk_space_f == 0 )
-           bfsk_space_f = bfsk_mark_f - autodetect_shift;
+           bfsk_space_f = 1800; //bfsk_mark_f - autodetect_shift;
        if ( band_width == 0 ) {
            band_width = 10;    // FIXME chosen arbitrarily
        }
kamalmostafa commented 8 years ago

Basic TTY/TDD support is now supplied by commit f48257ac595afbc8f576d5ac4fcc180a608c6a25.