3.5 data representation Flashcards
natural numbers set
- symbol N
- integer
- positive
integers set
- symbol Z
- positive and negative
- cannot be fractional
real numbers set
- symbol R
- positive and negative
- irrational, fractional
rational numbers set
- symbol Q
- can be represented as fractions
- positive and negative
irrational numbers set
- no specific symbol
- cannot be represented as fractions
ordinal numbers
- natural number that describes the numerical position of a value
- used for ordering
why hexadecimal used
- more compact when displayed
- easier for people to remember
- lower likelihood of error when typing in data
- saves programmer time writing in data
kibi, Ki
2^10 (1024) bits, kilobytes (10^3) but accurate
mebi, Mi
2^20, megabytes (10^6) but accurate
gibi, Gi
2^30, gigabytes (10^9) but accurate
tebi, Ti
2^40, terabytes (10^12) but accurate
unsigned binary
- positive integers
- min and max values for n bits are 0 and (2^n) - 1 respectively
signed binary
- negative (and positive) integers
- range of integers that can be represented by two’s complement -2^(n-1) to + (2^(n-1)-1)
practice two’s complement representation of signed integers
- most significant bit (leftmost) has a place value of -2^(n-1), where n is the number of bits
- for pos numbers, left bit has to be 0
- for neg numbers, left bit has to be 1
find negative equivalent of a positive number in two’s complement
- flip the bits and add 1 (literally 1. rightmost bit)
why was unicode introduced
- support a larger range of chars
- to facilitate communication / text in different languages
analogue data
- continuous
- no limits to values data can take
can change as freq. as required
analogue signal
consists of a continuously variable voltage
digital data
- discrete
- can only take specified range of values
- can only change value at specified intervals
digital signal
representation of discrete values over time
digital to analogue converter
- reads bit pattern representing an analogue signal
- outputs an alternating, analogue, electrical current
analogue to digital converter
- analogue signal sampled at regular time intervals
- amplitude of wave at each interval measured
- measurement coded into fixed num of bits
sampling
- taking measurements of the level of the analogue signal (amplitude) at regular time intervals
- measurements assigned a binary pattern, stored in memory
sampling rate
- number of samples taken per second, measured in Hz (1Hz equal to 1 sample p/s)
- higher sampling rate = better quality of audio recording, as well as bigger file size
sample resolution
- number of bits (audio bit depth) used to represent each sample
- determines number of digital values that can be used during sampling
nyquist theorem equation
sampling rate ≥ 2fmax
ideal nyquist theorem answer
- to faithfully recreate analogue signal, sample rate at least 2x highest frequency of og sound
- i.e., a sound with freq. of 10kHz must be sampled at min of 20kHz in order to reproduce original
- reason for doubling to ensure sample covers complete range of peaks + troughs in analogue
MIDI file
consists of a list of event messages that explains
- what notes must be played
- when they should be played
- how long or loud each note should be
files do not store a digital representation of analogue sound, instead hold signals used to produce sound
MIDI (musical instrument digital interface) standard
creates sounds as requested either from instrument or piece of software, not live but synthesized sound