patternMajor
Is Morse Code binary, ternary or quinary?
Viewed 0 times
ternarybinarycodemorsequinary
Problem
I am reading the book: "Code: The Hidden Language of Computer Hardware and Software" and in Chapter 2 author says:
Morse code is said to be a binary (literally meaning two by two) code
because the components of the code consists of only two things - a dot
and a dash.
Wikipedia on the other hand says:
Strictly speaking it is not binary, as there are five fundamental
elements (see quinary). However, this does not mean Morse code cannot
be represented as a binary code. In an abstract sense, this is the
function that telegraph operators perform when transmitting messages (see quinary).
But then again, another Wikipedia page includes Morse Code in 'List of binary codes.'
I am very confused because I would think Morse Code actually is ternary. You have 3 different types of 'possibilities': a silence, a short beep or a long beep.
It is impossible to represent Morse Code in 'stirct binary' isn't it?
By 'strict binary' I mean, think of stream of binary: 1010111101010.. How am I supposed to represent a silence, a short beep and / or a long beep?
Only way I can think of is 'word size' a computer implements. If I (and the CPU / the interpreter of the code) know that it will be reading 8 bits every time, then I can represent Morse Code. I can simply represent a short beep with a 1 or a long beep with a 0 and the silences will be implicitly represented by the word length.(Let's say 8 bits..) So again, I have this 3rd variable/the 3rd asset in my hand: the word size.
My thinking is like this: I can reserve the first 3 bits for how many bits to be read, and last 5 bits for the Morse code in a 8bit word. Like 00110000 will mean 'A'. And I am still in 'binary' BUT I need the word size which makes it ternary isn't it? The first 3 bits say: Read only 1 bit from the following 5 bits.
Instead of binary, if we use trinary, we can show morse code like: 101021110102110222 etc.. where 1 is: dit 0 is: dah and 2 is silence. By using 222 we can code the long silence, so if you have
Morse code is said to be a binary (literally meaning two by two) code
because the components of the code consists of only two things - a dot
and a dash.
Wikipedia on the other hand says:
Strictly speaking it is not binary, as there are five fundamental
elements (see quinary). However, this does not mean Morse code cannot
be represented as a binary code. In an abstract sense, this is the
function that telegraph operators perform when transmitting messages (see quinary).
But then again, another Wikipedia page includes Morse Code in 'List of binary codes.'
I am very confused because I would think Morse Code actually is ternary. You have 3 different types of 'possibilities': a silence, a short beep or a long beep.
It is impossible to represent Morse Code in 'stirct binary' isn't it?
By 'strict binary' I mean, think of stream of binary: 1010111101010.. How am I supposed to represent a silence, a short beep and / or a long beep?
Only way I can think of is 'word size' a computer implements. If I (and the CPU / the interpreter of the code) know that it will be reading 8 bits every time, then I can represent Morse Code. I can simply represent a short beep with a 1 or a long beep with a 0 and the silences will be implicitly represented by the word length.(Let's say 8 bits..) So again, I have this 3rd variable/the 3rd asset in my hand: the word size.
My thinking is like this: I can reserve the first 3 bits for how many bits to be read, and last 5 bits for the Morse code in a 8bit word. Like 00110000 will mean 'A'. And I am still in 'binary' BUT I need the word size which makes it ternary isn't it? The first 3 bits say: Read only 1 bit from the following 5 bits.
Instead of binary, if we use trinary, we can show morse code like: 101021110102110222 etc.. where 1 is: dit 0 is: dah and 2 is silence. By using 222 we can code the long silence, so if you have
Solution
This answer isn't as long as it looks; this site just puts a lot of spacing between list items! Update: Actually it's getting pretty long...
Morse Code isn't "officially" binary, ternary, quaternary, quinary, or even 57-ary (if I count correctly). Arguing about which one it is without context is not productive. It is up to you to define which of those five it is based on your application and the encoding requirements for your specific situation. To that end, there are pros and cons to each symbol set size, which you should consider for your situation before making a decision.
For the basis, M.1677, the international Morse Code standard, section 2, defines timings as:
2 Spacing and length of the signals
2.1 A dash is equal to three dots.
2.2 The space between the signals forming the same letter is equal to one dot.
2.3 The space between two letters is equal to three dots.
2.4 The space between two words is equal to seven dots.
Note that that defines timings only, e.g. a dash does not mean the same thing as three dots, it is simply the same length. The base unit of time is a dot.
Binary
We can choose binary if we'd like. It is possible to represent Morse Code with "strict binary", as you call it -- that author's approach was to assign the digits to "dot" and "dash". That approach does not work and I do not think the author has a firm grasp of Morse code. But there is a different approach that works. If we choose binary, we essentially represent whether the signal is high or low with each symbol occupying a single dot-lengthed time slice. Note that this is also the approach described on the List of Binary Codes page you cited.
Other binary codings can be chosen as well (e.g. Bob Jarvis' answer) at the expense of increases in difficulty decoding back to audible Morse Code (Bob's encoding cannot be decoded statelessly, for example, the tradeoff is it provides shorter encoded sequences).
Symbols:
Encoding Examples:
Pros:
Cons:
Ternary
With this choice, we define letter and word spacings as rests, and signal spacings are implicit (although you could choose to require dot length rest symbols between signals, if it suits you better).
Symbols:
Encoding Examples:
Pros:
Cons:
Quaternary
Symbols:
Encoding Examples:
Pros:
Cons:
Quinary
A direct interpretation of Wikipedia's list. Note this is very similar to the binary choice except the various valid combination of binary 0's or 1's are given their own symbols.
Symbols:
Encoding examples:
Pros (compared to quaternary):
Cons (compared to quaternary):
Morse Code isn't "officially" binary, ternary, quaternary, quinary, or even 57-ary (if I count correctly). Arguing about which one it is without context is not productive. It is up to you to define which of those five it is based on your application and the encoding requirements for your specific situation. To that end, there are pros and cons to each symbol set size, which you should consider for your situation before making a decision.
For the basis, M.1677, the international Morse Code standard, section 2, defines timings as:
2 Spacing and length of the signals
2.1 A dash is equal to three dots.
2.2 The space between the signals forming the same letter is equal to one dot.
2.3 The space between two letters is equal to three dots.
2.4 The space between two words is equal to seven dots.
Note that that defines timings only, e.g. a dash does not mean the same thing as three dots, it is simply the same length. The base unit of time is a dot.
Binary
We can choose binary if we'd like. It is possible to represent Morse Code with "strict binary", as you call it -- that author's approach was to assign the digits to "dot" and "dash". That approach does not work and I do not think the author has a firm grasp of Morse code. But there is a different approach that works. If we choose binary, we essentially represent whether the signal is high or low with each symbol occupying a single dot-lengthed time slice. Note that this is also the approach described on the List of Binary Codes page you cited.
Other binary codings can be chosen as well (e.g. Bob Jarvis' answer) at the expense of increases in difficulty decoding back to audible Morse Code (Bob's encoding cannot be decoded statelessly, for example, the tradeoff is it provides shorter encoded sequences).
Symbols:
- Low, off, etc. (0)
- High, on, etc. (1)
Encoding Examples:
- Signal separator: 0
- Letter separator: 000
- Word separator: 0000000
- Three dots: 10101
- Three dashes: 11101110111
- The word "son": 101010001110111011100011101
- The phrase "is a": 10100010101000000010111
Pros:
- Minimal symbol set size
- Easily managed with typical digital logic
- Easy to decode into audible Morse Code (presuming no validation is done); stateless decoding and does not require storing information about the timing of symbols (every symbol is the same length).
Cons:
- Long encodings.
- Many opportunities for invalid encodings.
- Individual symbol meanings (0, 1) depend on context.
Ternary
With this choice, we define letter and word spacings as rests, and signal spacings are implicit (although you could choose to require dot length rest symbols between signals, if it suits you better).
Symbols:
- Dot-length rest (0)
- Dot (1)
- Dash (2)
Encoding Examples:
- Letter separator: 000
- Word separator: 0000000
- Three dots: 111
- Three dashes: 222
- The word "son": 11100022200021
- The phrase "is a": 11000111000000012
Pros:
- Small symbol set size.
- Signal separator no longer needed.
- Shorter encoding lengths than binary.
- Removes some invalid encodings (e.g. 0110 with the binary choice no longer possible).
Cons:
- Still lengthy encodings.
- Still many possibilities for invalid encodings, in particular, the rests.
- Cannot be decoded statelessly† unless you choose to place explicit dot length rests between signals.
- Signal separators are implicit‡ unless you choose to place explicit dot length rests between signals.
- Some individual symbol meanings (0) depend on context.
Quaternary
Symbols:
- Letter separator (0)
- Word separator (1)
- Dot (2)
- Dash (3)
Encoding Examples:
- Three dots: 222
- Three dashes: 333
- The word "son": 2220333032
- The phrase "is a": 220222123
Pros:
- Very short encoded length.
- Possibility of invalid encodings is reduced.
- Symbols are semantically accurate.
- Arguably, more human-readable.
Cons:
- Large symbol set size.
- Cannot be decoded statelessly.†
- Signal separators are implicit.‡
Quinary
A direct interpretation of Wikipedia's list. Note this is very similar to the binary choice except the various valid combination of binary 0's or 1's are given their own symbols.
Symbols:
- Signal separator (0)
- Letter separator (1)
- Word separator (2)
- Dot (3)
- Dash (4)
Encoding examples:
- Three dots: 30303
- Three dashes: 40404
- The word "son": 303031404041403
- The phrase "is a": 3031303032304
Pros (compared to quaternary):
- Can be decoded statelessly.
- The only symbol set size that unambiguously, directly and concisely represents the five objects mentioned in section 2 of the standard: "dot" (to which all timings are relative to), "dash", "space between the signals", "space between two letters", "space between two words".
Cons (compared to quaternary):
- Higher possibility for invalid encodings.
- Increase
Context
StackExchange Computer Science Q#39920, answer score: 30
Revisions (0)
No revisions yet.