5 - Fundamentals of Data Representation Flashcards
What does MIDI stand for?
Musical Instrument Digital Interface
Describe the advantages of using MIDI files for representing music.
- A MIDI file is a more compact representation than an equivalent sampled recording.
- The performance data be easily manipulated, for example, it’s easy to change instruments or change the pitch or duration of a note.
- MIDI supports a very wide range of instruments providing more choices for music production.
Explain how MIDI represents music and the advantages of using MIDI for representing music instead of using sampled sound.
Music is represented as a sequence of MIDI event messages. Examples of data that might be contained in a message are channel, volume and note envelope. MIDI messages are usually two or three bytes long and 16 channels are supported.
Advantages:
• More compact representation
• Easy to modify the music, such as change the instrument
• Musical score can be generated directly from a MIDI file
How do you add two unsigned binary integers?
eg. 01001101 + 01101010
Align the binary numbers and perform column addition.
eg.0 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 + ────────── 1 0 1 1 0 1 1 1 ────────── ¹¹
How do you multiply two unsigned binary integers?
eg. 11011 x 11
Align the binary numbers and perform long multiplication.
eg. 110 11 11x ─────── 110 11 110 11 0+ ───────── 1 0 1 0 0 0 1 ───────── ¹¹¹¹¹
What is two’s complement?
A method of working with signed numbers using fixed-width binary where the most significant (left most) bit is the sign bit.
How do you convert from decimal to signed binary (using two’s complement)?
eg. -97₁₀
If the number is negative, place a 1 under the MSB then add a 1 under the column headings which, when added to the value of the MSB, give the number.
eg. -128 + 16 = -112
- 112 + 8 = -104
- 104 + 4 = -100
- 100 + 2 = -98
- 100 + 1 = -97
-128 64 32 16 8 4 2 1
1 0 0 1 1 1 1 1
-97₁₀ → 10011111₂
How do you convert from signed binary to decimal (using two’s complement)?
eg. 10011010₂
Add up the column heading with a 1 under them (where the MSB is negative).
eg. -128 64 32 16 8 4 2 1
1 0 0 1 1 0 1 0
-128 + 16 + 8 + 2 = -102
10011010₂ → -102₁₀
How do you perform binary subtraction using two’s complement?
eg. 0101₂ - 0011₂
Turn the value that is being subtracted into a negative, then add the two values.
eg. 0101₂ - 0011₂
→ 0101₂ + (-0011₂)
→ 0101₂ + 1101₂
→ (1)0010₂
a carry is generated which is ignored
0101₂ - 0011₂ → (1)0010₂
What is the range of values that can be represented using two’s complement with n bits.
the range is -2ⁿ⁻¹ to 2ⁿ⁻¹ - 1
What is fixed point binary?
Fixed point binary is a method of representing numbers with a fractional part, where the binary point is in a fixed position.
How do you convert from fixed point binary to decimal?
eg. 0110.0110₂
Set up the correct column headings according to where the point is positioned. Then add up the values of the column headings with a 1 under them.
eg. 8 4 2 1 . ½ ¼ ⅛ ¹⁄₁₆
0 1 1 0 . 0 1 1 0
4 + 2 + ¼ + ⅛ = 6.375₁₀
0110.0110₂ → 6.375₁₀
How do you convert from decimal to fixed point binary?
eg. 10.6875₁₀ (8 bits where the binary point is between the 4th and 5th bits)
eg. 10.6875 - 8 = 2.6875
2. 6875 - 2 = 0.6875
0. 8675 - ½ = 0.1875 0. 1875 - ⅛ = 0.0625 0. 0625 - ¹⁄₁₆ = 0
8 4 2 1 . ½ ¼ ⅛ ¹⁄₁₆
1 0 1 0 . 1 0 1 1
10.6875₁₀ → 1010.1011₂
How do you convert from floating point binary to decimal?
eg. 0100100100 000100
Convert the exponent and move the binary point accordingly (adding preceding 1s for negative mantissa and 0s for positive mantissa for negative exponents). Then convert to decimal.
eg. exponent → 4
0. 100100100 → 01001.00100 → 9.125
How do you convert from decimal to floating point binary?
eg. 12.125
Convert to fixed point binary move the binary point so that it’s normalised (when the first two bits are different) and convert the exponent to binary.
eg. -16 8 4 2 1 . ½ ¼ ⅛ 0 1 1 0 0 . 0 0 1 01100.001 → 0.1100001 exponent = 4 → 000100 → 01100001 000100