15.6 Questions for the reader#
Exercise 99
Information rates. Consider a \(3\)-minute song.
How many bytes does it take as uncompressed CD-quality audio (\(44.1\) kHz, \(16\) bits, stereo)?
How many bytes does it take as an MP3 at \(128\) kbps?
What is the compression factor of the MP3, relative to CD quality?
Reveal solution
\(31{,}752{,}000\) bytes (about \(31.8\) MB)
\(2{,}880{,}000\) bytes (about \(2.9\) MB)
About \(11\times\)
Exercise 100
Equal loudness. Use the equal-loudness contours from Equal-loudness contours, or the ISO 226 standard, for this question.
A \(1000\) Hz tone plays at \(60\) dB SPL. What is its loudness in phons?
A \(100\) Hz tone also plays at \(60\) dB SPL. Does it sound louder or quieter than the \(1000\) Hz tone?
At about what level must the \(100\) Hz tone play to sound as loud as the \(1000\) Hz tone?
Reveal solution
\(60\) phons
Quieter
About \(79\) dB SPL
Exercise 101
Just intervals. Two sine tones play at \(300\) Hz and \(450\) Hz.
What is their interval, as a ratio in lowest terms?
How often (in Hz) does the sum of the two tones repeat?
How many steps of 12-EDO are closest to this interval? What is the relative difference between the 12-EDO interval and the just interval?
Reveal solution
\(3{:}2\)
\(150\) Hz
\(7\) steps, \(2^{7/12} \approx 1.498\), a relative difference of about \(-0.11\%\)
Exercise 102
Beyond 12 steps. In 19-EDO tuning, each step multiplies frequency by \(2^{\frac{1}{19}}\).
By what factor does one step of 19-EDO multiply frequency?
How many steps of 19-EDO are closest to the just major third (\(5{:}4\))? What is the relative difference?
Is this closer or farther than the nearest step of 12-EDO?
Reveal solution
About \(1.037\)
\(6\) steps, \(2^{6/19} \approx 1.245\), a relative difference of about \(-0.42\%\)
Closer (12-EDO is about \(+0.79\%\) away)
Exercise 103
Entropy and Huffman coding. A random variable has four outcomes, A, B, C, and D, with probabilities \(\frac{1}{2}\), \(\frac{1}{4}\), \(\frac{1}{8}\), and \(\frac{1}{8}\).
What is its entropy, in bits?
Construct a Huffman code for it.
What is the expected length of your code, in bits per outcome?
Reveal solution
\(1.75\) bits
For example, A → \(\texttt{0}\), B → \(\texttt{10}\), C → \(\texttt{110}\), D → \(\texttt{111}\) (any code with lengths \(1\), \(2\), \(3\), \(3\))
\(1.75\) bits, exactly the entropy
Exercise 104
Decoding Huffman codes. Using the code from this chapter’s example, TT → \(\texttt{0}\), TH → \(\texttt{11}\), HT → \(\texttt{100}\), and HH → \(\texttt{101}\), decode the bit string \(\texttt{1010110}\).
Reveal solution
HH TT TH TT
Exercise 105
Rice coding. Using the zigzag encoding and Rice coding with \(k = 2\), encode the residual values \(-3\) and \(20\). How many bits does each take?
Reveal solution
\(-3 \to \texttt{1001}\) (\(4\) bits), and \(20 \to \texttt{1111111111000}\) (\(13\) bits)
Exercise 106
MIDI messages.
Write the three bytes (as bit strings) of a Note On message on channel \(1\) for E4 (MIDI pitch \(64\)) with velocity \(80\).
Write the status byte (as a bit string) of a Note Off message on channel \(10\).
How many bytes of Note On and Note Off messages does a melody of \(100\) notes take?
Reveal solution
\(\texttt{10010000}\) \(\texttt{01000000}\) \(\texttt{01010000}\)
\(\texttt{10001001}\)
\(600\) bytes