0% found this document useful (0 votes)
15 views23 pages

Frequency of F4 and Its Octave

Uploaded by

xadelit463
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views23 pages

Frequency of F4 and Its Octave

Uploaded by

xadelit463
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic Explanation for

Electronic Musical Instruments

November 2000

Contents

SOUND
Sound Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Three Elements of Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
ANALOG AND DIGITAL
Analog and Digital Devices Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Analog and Digital Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
BINARY NUMBERS
Decimal and Binary Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Parallel and Serial Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 9
DIGITAL RECORDING
Outline of Digital Recording Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Process of Digital Recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
ELECTRONIC KEYBOARDS
Type of Electronic Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Outline of Electronic Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 13
Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . 14
CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 15
System Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .. . 19
DAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . 21
Key Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... . . . . . 21
Page
SOUND

SOUND WAVES
Sound is a wave motion of varying pressure in air. The pressure variations result from the mechanical vibra-
tions of a source producing the sound, for example a vibrating tuning fork.

Compression of air molecules


Rarefaction of air molecules
Tuning fork
Human ear

As shown in Fig. 1, the vibrating fork produces


varying values of pressure in the surrounding
440 Hz air. Since air is compressible, sound waves
334 meters per second
travel in all directions. The velocity of sound
wave is approximately 334 meters per sec-
Wavelength = 0.76 m
ond.
Air pressure

The human ear can detect pressure variations


Distance
in the surrounding air, which change with re-
spect to time. In the example used here, one
T= 2.27 ms cycle of compression and rarefaction takes
2.27 millisecond. The frequency is 1/T, which
Air pressure

440 Hz
equals 440 Hz.

Time

Fig. 1

THREE ELEMENTS OF SOUND


When we hear a sound, it can be defined by considering three different parameters; the pitch, the timbre, and
loudness.

SOUND

Pitch Timbre Loudness


(Harmonics) (Envelope)

Fig. 2

-1-
Pitch
Pitch is used to describe the highness or lowness of a sound. A piccolo produces a high pitch sound, and a
bass tuba produces a low pitch sound. In musical instruments, pitch is the frequency of the sound wave
produced. Pitch determines the position of a sound on musical scale as shown in Fig.3. Every pitch is named
with a capital letter A to G and a number 0 to 8 as shown in Fig. 4. The standard pitch is 440 Hz for the tone
A4.
Middle C
Semitone
C#4 D#4 F#4 G#4 A#4

C4 D4 E4 F4 G4 A4 B4 C5

Octave
Fig. 3

# # #
# #
Pitch name C4 C#4 D4 D#4 E4 F4 F#4 G4 G#4 A4 A#4 B4 C5
Frequency 277.17 311.12 370.00 415.31 466.16
(Hz) 261.63 293.66 329.63 349.23 392.00 440.00 493.88 253.25

Standard pitch
Octave
Semitone

Fig. 4

Octave The octave is a unit representing a span of frequencies having a ratio of 2 to 1. One octave above
A3 (220 Hz) is A4 (440 Hz), and one octave above A4 (440 Hz) is A5 (880 Hz). One octave is equal to 12
semitones because there are 12 musical tones within the octave.

Semitone The interval between two musical tones. The basic frequency ratio of the semitone is equal to the
twelfth root of 2. (The twelfth root of 2 is 1.059463.) The frequency of A#4 can get by multiplying the frequency
of A4 (440 Hz) by 1.059463.
The frequency of A#4 = 440 Hz x 1.059463 = 466.16 Hz

Timbre
Timbre is quality of a sound. We can judge that two sounds produced with a piano and a organ are dissimilar
even if two sounds have the same loudness and pitch. Timbre depends on the waveform of the sound pro-
duced by an instrument as shown in Fig. 5.

Sine wave Saw-tooth wave Square wave

Soft Brilliant Gentle


(Flute, Whistle) (Violin, Trumpet) (Clarinet, Oboe)
Fig. 5

-2-
Frequency range of 88-key piano

Pitch name Frequency (Hz) Equal temperament


The term “temperament” means a definition of the mu-
sical intervals. Today’s modern of piano is generally
C8 4186.01
tuned using the equal temperament. In the equal tem-
B7 3951.07
A#7
A7 3520.00 perament, the octave is equally divided into 12 musi-
G#7 3135.96 cal intervals (semitones) in frequency ratio.
G7
F#7 2793.83
F7
E7 2637.02
D#7 2349.32
D7
C#7 2093.00
C7
Two semitones
B6 1975.53
A#6 1760.00 A#4 466.16 Hz
A6
G#6
F#6
G6 1567.98 ) Frequency ratio is 1.059463
F6 1396.91 A4 440.00 Hz

D#6
E6
D6
1318.51
1174.66
) Frequency ratio is 1.059463
G#4 415.31 Hz
C#6 1046.50
C6
B5 987.77 ) Frequency ratio is 1.059463
A#5 G4 392.00 Hz
A5 880.00
G#5 783.99 One semitone
G5
F#5 968.46
F5
E5 659.26
D#5 587.33
D5
C#5 523.25 Cent
C5
B4 493.33 The cent is a musical unit representing a frequency
A#4 440.00
A4
G#4 variation in the logarithm. The frequency variation
G4 392.00
F#4
F4 349.23 of 100 cents is equal to a semitone. The cent is
E4 329.63 used for tuning musical instruments.
D#4 293.66
D4 Example: 440 Hz plus 20 cents
C#4 261.63
C4 Antilogarithm of 20 cents is 1.01162 in Table 1.
B3 246.94
A#3
A3 220.00 440 Hz x 1.01162 = 445.11 Hz
G#3 196.00
G3
F#3 174.61
F3 Antilogarithm
E3 164.81 Cent Plus Minus
D#3 146.83
D3 1 1.00058 0.99942
C#3 130.81 2 1.00116 0.99884
C3
B2 123.47 3 1.00173 0.99827
A#2 110.00 4 1.00231 0.99769
A2
G#2 98.00 5 1.00290 0.99711
G2
F#2 87.31 6 1.00347 0.99654
F2
7 1.00405 0.99597
E2 82.41
D#2 8 1.00463 0.99539
D2 73.42
C#2 9 1.00521 0.99482
C2 65.41 10 1.00579 0.99424
B1 61.74 15 1.00870 0.99137
A#1 55.00 20 1.01162 0.98851
A1
G#1 49.00 25 1.01454 0.98567
G1
F#1 43.65 30 1.01748 0.98282
F1
E1 41.20 35 1.02042 0.97998
D#1 36.71 40 1.02337 0.97716
D1
C#1 45 1.02633 0.97434
C1 32.70
50 1.02930 0.97153
B0 30.87
A#0 A0 27.50
Table 1
Fig. 6 -3-
Fundamental and harmonic frequencies
The fundamental frequency is the lowest frequency of a sound. A sound includes higher frequencies than the
fundamental. Those higher frequencies are called harmonics, which frequencies are exact multiples of the
fundamental; twice the fundamental frequency on the second harmonic, three times of the fundamental on
the third harmonic. However, the amplitude of each harmonic decreases in inverse proportion to the har-
monic number. For instance, the fundamental sine wave and all harmonics make up a saw-tooth waveform as
shown in Fig. 7. The other hand, the fundamental sine wave and odd harmonics make up a square waveform.

Fundamental
Complex waveform
3rd harmonic

2nd harmonic

Fig. 7

The higher harmonics must be included in the sound, which otherwise would not have its characteristic
timbre. It is the harmonics that make one source of sound different from another source.

Volume
Volume is the intensity of a sound. Volume depends on the amplitude of sound waves. Greater amplitude
means a louder sound. In the sound wave, more amplitude means greater changes in air pressure. In a
corresponding electrical sound signal, more amplitude means greater changes in voltage.

a louder sound a softer sound


Air pressure
Air pressure

greater amplitude smaller amplitude


/ Voltage
/ Voltage

Fig. 8

Envelope Envelope
Loudness envelope is a curve drawn to pass through the
peaks of a sound waveform as shown in Fig. 9. The overall
loudness of a sound changes during its length. Envelope of
each musical sound has a typical shape as shown in Fig. 10.
However ,the same instrument produces the sound having
different quality by changing its envelope.
Fig. 9

-4-
Typical envelope

Guitar Trumpet Piano Violin

time time time time

Fig. 10

Attack Decay
Four stages of envelope
A basic envelope consists of four stages, attack,
Sustain
decay, sustain and release as shown in Fig. 11.
Release
Changing of attack stage, a fast attack to a slow,
this thing gives an obvious effect on quality of sound.
Fig. 11

ANALOG AND DIGITAL


ANALOG AND DIGITAL DEVICES
An analog multimeter indicates the measured value of voltage by the rotation of the needle. An analog device
represents numerical quantities by means of physical variables, such as rotation, mechanical gears, voltage
and current. The analog meter gives approximate reading, but it is more suitable for measuring continuously
variable quantities.

Physical variables
1.0 2.0 (rotation)
Continuous
Reading

0 3.0

Volts
Voltage
Fig. 12

A digital multimeter provides a direct reading of the measured value of voltage. The digital meter having four-
digit display with a floating decimal is more accurate than the analog meter.

Display Form of numbers


...
2 1-digit display
...
Discrete
1.7 2-digit display 1.726
1.727
1.73 3-digit display 1.728
1.728 4-digit display 1.729
...

Fig. 13

-5-
ANALOG AND DIGITAL SIGNALS
Sine wave The sine wave is an example of analog signal; its value in-
crease or decrease gradually, and the changes are smooth
and continuous.
Its amplitude represents information content.

Fig. 14

Square wave The square wave is an example of a digital signal. It changes


between two distinct voltage levels, for instance 0 V and +5
V, and it has no in-between values.
The pulse corresponds to status of “on” and “off” within a
Fig. 15 circuit.

The digital signal is a train of pulses as shown in Fig. 16. The +5 V level is called the HIGT voltage, then the 0
V level becomes the LOW voltage. The HIGH and LOW levels represent the binary digits 1 and 0, also the
train of pulses represent binary number 10101 as shown in Table 1.

HIGH HIGH HIGH


+5 V One
On Off On Off On
0V Zero
LOW LOW
1 0 1 0 1 Binary number
Fig. 16

Voltage Switch Level Logic


+5 V On HIGH 1
0V Off LOW 0

Table 1

Digital systems deal only with the binary numbers “zero” and “one” because binary numbers can be repre-
sented easily by “on - off” switch position within a electronic circuit.

BINARY NUMBERS

DECIMAL AND BINARY NUMBERS


The decimal number system is used in our everyday life. In the decimal system a quantity is represented
by value and the position of a digit. The number 1997 means
1000 + 900 + 90 + 7
or 1 x 10 + 9 x 10 + 9 x 10 + 7 x 10 0
3 2 1

10 is the base and each position to the left of the decimal point corresponds to a power of 10.

10 3 10
2 10 1 10 0
Quantity
Thousands Hundreds Tens Digits o to 9
1 9 9 7 1997

Table 2

-6-
Binary Numbers
In the binary number system, there are two digits, 0 and 1. The binary place values are in powers of 2 starting
with 1s, then 2s, 4s, 8s and so on. Only binary numbers are used in digital circuits. The reason for using
binary numbers is that digital circuits operate with squarewave pulse waveform. The pulses have only two
amplitudes. The “on,” or HIGH, state can be represented by binary 1, and the “off,” or LOW, state as binary 0.
The total number of fingers on both hands is written 1010 since
1 0
1 x 23 + 0 x 22 + 1 x 2 + 0 x 2
( 8 + 0 + 2 + 0 = 10 . . . . Decimal number )

3 2 1 0
2 2 2 2 Quantity
Eights Fours Twos Digits o or 1
1 0 1 0 1010

Table 3

Bits, Bytes, and Words


A single binary digit is called a “bit.” All information in a digital system is represented by a sequence of bits. An
8-bit sequence is called a “byte.” The number of bits in the data sequences processed by a given computer is
called its “word size.” An 8-bit microprocessor can receive, process, store, and transmit data or instructions
in the form of bytes.

4 bits 1 0 1 0 Four bits can be arranged in 2 4 = 16 different combinations.

8
bit Eight bits can be arranged in 2 = 256 different combinations.

8 bits 1 1 0 0 0 1 0 1 = byte

bit
Fig. 17

An 8-bit microprocessor is connected to the rest of the system by


a group of 8 lines in parallel. Those lines called the “data bus.” The Memory
data bus is used to transfer binary numbers from point to point in
the digital system.

Data to be sent 1 1 0 0 0 1 0 1

Line D7 +5 V
Line D6 +5 V
Line D5 0V
8-bit Line D4 0V
microprocessor Line D3 0V
Line D2 +5 V
Line D1 0V
Line D0 +5 V

Fig. 18

-7-
Number Conversion
Binary - to - decimal conversion
To convert a binary number to its decimal equivalent, add the decimal equivalents of each position occupied
by a 1.
For example,
7 6 2
11000101 --> 2 + 2 + 0 + 0 + 0 + 2 + 0 + 2 0 = 128 + 64 + 4 + 1 = 197

Decimal - to binary conversion


To convert a decimal number to its binary 2 )1997
equivalent, progressively divide the deci- )998 . . .1 1997 2 = 998 with a remainder of 1
mal number by 2, nothing the remainders: )499 . . .0 998 2 = 499 with a remainder of 0
the remainders taken in reverse order from )248 . . .1 499 2 = 248 with a remainder of 1
the binary equivalent. )124 . . .0 248 2 = 124 with a remainder of 0
For example, )62 . . .0 124 2 = 62 with a remainder of 0
1997 --> 1 1 1 1 1 0 0 0 1 0 1 )31 . . .0 62 2 = 31 with a remainder of 0
)15 . . .1 31 2 = 15 with a remainder of 1
)7 . . .1 15 2 = 7 with a remainder of 1
)3 . . .1 7 2 = 3 with a remainder of 1
)1 . . .1 3 2 = 1 with a remainder of 1
0 . . .1 1 2 = 0 with a remainder of 1

Hexadecimal Notations
The number of years of in a century can be written Decimal Binary Hex
100D. In binary notation, this would be written 0 0000 0
01100100B. The suffix B is used whenever neces- 1 0001 1
sary to avoid confusion. 2 0010 2
Decimal Binary 3 0011 3
100D <--> 01100100B 4 0100 4
5 0101 5
8-bit numbers are difficult for humans to deal with. 6 0110 6
Hexadecimal numbers are most commonly used in 7 0111 7
microprocessor work. In the hexadecimal notation, 8 1000 8
each group of four bits is represented by a single 9 1001 9
hexadecimal number. Since four bits can take on six- 10 1010 A
teen different numbers, we supplement the ten deci- 11 1011 B
mal digits 0 to 9 with the letters A, B, C, D, E, and F. 12 1100 C
For example, 13 1101 D
Binary Hexadecimal Decimal 14 1110 E
10100100B <--> A4H <--> 164D 15 1111 F
16 10000 10
1010 0100 32 100000 20
10D --> AH 4D --> 4H 64 1000000 40
128 10000000 80
256 100000000 100
512 1000000000 200
1024 10000000000 400
2048 100000000000 800

Table 4
-8-
PARALLEL AND SERIAL DATA TRANSFER
Binary numbers can be transferred in one of two forms, parallel form and serial. In digital devices, data is
transferred in parallel form to obtain higher performance. In the transmission of data by telephone lines or
radio, it is better to have the data in serial form, so only one line or channel is needed.

9 3
1 0 0 1 0 0 1 1
1 0 0 1 0 0 1 1
Serial data transfer takes time but it
Serial data transfer needs only one line.

9 3
1 1
D0 1 1 Parallel data transfer
D1 0 1 needs four lines but it is 0 1

0 0 faster.
D2 0 0
D4 1 0
1 0
Parallel data transfer
Fig. 19

DIGITAL RECORDING

OUTLINE OF DIGITAL RECORDING


Using digital recording techniques the waveform is cut into brief time intervals (more than twice the highest
audio frequency). The voltage level is frozn at that point, and it is measured in time. The voltage level is
assigned a numerical value from zero to maximum level. The numbers are recorded in binary form onto a
memory. The illustration in Fig. 20 shows a very small parts of an audio waveform. In this example the
closest value is chosen from 256 possible values, since 8 bit would give 256 different numbers.

Numbers recorded onto a memory

134 10000110
256 175 10101111
207 11001111
231 11101010
200 Audio waveform 246 11110110
253 11111101
243 11110011
211 11010011
205 11001101
100 215 11010111
220 11011100
198 11000110
159 10011111
115 01110011
0 ... ........
... ........
134
175
207
231
246
253
243
211
205
215
220
198
159
115
77
55
62
76
71
39
16
23
41
67
104

... ........
Memory
Numbers corresponding to voltage
Decimal numbers Binary numbers
Fig. 20

-9-
To replay the recorded sound, the numbers are turned back into voltage levels, and the original waveform
reconstructed from the numbers. A digital recording can be re-recorded over and over again, copied, and
re-copied, the sound will be as perfect as the first recording, with no degradation.

PROCESS OF DIGITAL RECORDING


The illustration in Fig. 21 shows block diagram of digital recording system.

Audio signal Voltage level Pulse code Data encoded


Encoding
Sampling Quantization Coding (Modulation)

>
>

>
>

Low pass filter Memory


Sample & hold circuit Analog to digial converter Processor
Fig. 21

The low pass filter transmits only an audio signal, since high frequencies over 20 kHz become a noise.
The sample & hold circuit cuts an audio waveform into brief time intervals, and freezes the voltage level.
The ADC (Analog to Digital Converter) converts the voltage level into a digital signal. The ADC chooses the
binary number that most closely represents the voltage level from possible values, then provides pulse code
to the processor.

Sampling Quantization
256 (8-bit ADC)
232
200 231 231: Closest number
230
229

(231D ---> 111010101B)


100

Coding 1 1 1 0 1 0 1 0 1

0
(8 bits give 256 different numbers.) (Pulse Code)
Fig. 22

The processor encodes an off-set binary number into an appropriate code, then stores the code onto the
memory. If necessary, the code is modulated into a certain symbol by the processor before storing.
The memory stores information of the recorded sound data.

ADC Processor Memory


>
>

Pulse code Encoded code


(off-set binary number) (2’s complement of binary number)
Modulation Eight to Fourteen Modulation: CD
8 - 10 Modulation: DAT
Fig. 23

- 10 -
Sampling frequency: Frequency of time intervals is called “Sampling frequency” or “Sampling rate.” The
sampling frequency determines the highest frequency that an audio waveform can be recorded without
distortion. The sampling frequency should be at least twice the highest frequency found in the waveform.

Sampling frequency
Distortion
4:1

Fig. 24

Resolution: Resolution is used to refer the number of possible values that can be represented by a ADC.
Resolution is expressed as the number of bits, which equals to the bits of the output binary number from the
ADC. Resolution determines signal-to-noise ratio of a digital recording system.

Maximum
voltage level 8-bit resolution 16-bit resolution

1.0 V
256 Noise 65536 Noise
231 59046

231 59046

3.9062 mV 0.0156 mV

230 59045

S/N ratio : 45 dB S/N ratio : 90 dB

Fig. 25

Memory Size
Memory size depends on sampling frequency, resolution and sampling length. Higher sampling frequency
and resolution make better quality of the recorded sound. However they requires the larger memory size.
For example: Record 5-octave notes (61 keys) with sampling frequency 44.1 kHz, 16-bit resolution,
sampling length 5 seconds, stereo
Memory size= 61 x 16 x 44.1 x 1000 x 5 x2 = 51 M bytes

Sampling Technique for Electronic Keyboards


To minimize memory size at recording a musical sound for electronic keyboards, there are some techniques
such as looping, compressing, etc. Using those techniques the memory size of sound data for Casio stan-
dard keyboards is form 2 M to 16 M bits, but the keyboards have around 100 preset tones.
In most musical sounds, the waveform is very complex at the beginning of the sound produced, since higher
harmonics are included that time. Higher harmonics generally tend to fade away more quickly as the energy
available is used up more quickly. The compressing technique avails this characteristic of musical sounds to
reduce the size of the memory to be required.

- 11 -
ELECTRONIC KEYBOARDS

TYPE OF ELECTRONIC KEYBOARD


Electronic keyboards are mainly classified into two types, synthesizers and PCM sound source
keyboards. Loosely speaking, a synthesizer can create the sound what a player wants. A PCM
sound source keyboard reproduces the sound recorded by a manufacturer.

Synthesizer
Containing oscillators, an analog synthesizer first generates the basic oscillations all different in
shapes of waveform. The machine creates a complex waveform by combining the oscillations, it
then changes the harmonic content of the complex waveform by removing undesired harmonics
with filters. Finally the machine controls the amplitude using envelope generators. Those
processes are controlled by the internal controllers.
The synthesizer allows the player access to the controllers so that he can design the processes.
That is why, analog synthesizers are capable of creating any sound players want. In digital
synthesizers, the internal controllers are replaced with processors. But method of synthesis in
digital system is different among manufacturers.

PCM Sound Source Keyboard


PCM is abbreviation for Pulse Code Modulation. It is process of converting an analog waveform
into pulse coded data in a digital recording system. A PCM sound source keyboard contains the
memory stored sound data, which data is recorded by the manufacturer using the digital
recording technique. The keyboard reproduces a sound by reversing process of the digital
recording.

- 12 -
OUTLINE OF PCM KEYBOARD
PCM sound source keyboards reproduce a sound by reversing process of the digital recording. The principal
components in the instruments are shown in Fig. 27.

Development stage

Filter ADC Processor Memory

Microphone

Components in products
Console
& Display

>
ROM
Amp. Filter DAC CPU
(memory)

Key controller
& Keyboard

Fig. 27

The ROM stores information of the recorded musical notes, rhythm patterns and demo tunes in binary form.
The CPU controls the console, and communicates with the key controller. When a key is pressed, the CPU
reads data of the selected tone and key from the ROM. The CPU expands compressed data, and operates
looping function so that the data is reconstructed as like as the original. The CPU decodes the data into pulse
code, then provides to the DAC at specific intervals, which intervals depend on sampling frequency at record-
ing. If more than one key are pressed, the CPU performs that process by data of each key at the same time,
and adds all data in the intervals. The DAC converts the pulse code into a voltage level in time, finally it
reproduces a waveform. The filter transmits only an audio waveform since the stepped waveform output from
the DAC includes higher frequencies than audible.

CPU(16-bit) Data (C4) ROM


DAC < <
Accessing/reading
Poly data Expanding < Sound data (C4)
Looping Data (E4)
<

(16-bit pulse code) Calculating


Sound data (E4)
Data’ (C4)
Data’ (E4) Add Data (G4) Sound data (G4)
Data’ (G4)
Poly data
Interval Tn Interval Tn+1

Fig. 28

- 13 -
MEMORY
In a digital system, instructions and binary data are stored in the memory, an organized arrangement of
memory cells. Each cell is capable of storing one bit of information. In Random-Access-Memory (RAM, now
it is interpreted as read-and-write memory), the computer can store (“write”) data at any selected location
(“address”) and, at any subsequent time, retrieve (“read”) the data. In Read-Only-Memory (ROM), data are
initially and permanently stored by the manufacturer; the computer can read the data at any address, but
cannot alter the stored bits.
In Fig. 29, a 1024 x 1 bit RAM chip could consist of 1024 memory cells arranged in a 32 x 32 matrix. The
address is coded as a 10-bit binary number. A 10-bit binary number is sufficient to define any one of the 1024
bits.

Diagram for a 1024 x 1 bit RAM


0
A0 1
Address decoder

Data
2
A1 Bit at address 2,3
3
(row)

A2 00010 00011
Write
A3 Chip enable
A4 31 Read

0 1 2 3 31
Read / Write
Address decoder
10-bit coded address (column)

A5 A6 A7 A8 A9

Fig. 29
Two decoders translate the coded address and activate one of row-select lines and one of column-select
lines. The cell at the address is selected. There are two control signals “chip enable” and “read/writ”. The chip
enable signal activates the read/write circuits. The read/write signal controls the selection of “set/unset the
cell” (write) or “read the state of the cell” (read). In the write operation, one bit data is transferred from the data
line to the selected cell. In the read operation, the data of the selected cell is transferred to the data line.

Memory Capacity
The 1024 x 1 bit RAM is rather small these day. RAM chips containing 8192 x 8 bits (65536 memory cells) or
more are used in modern designs. A 8192 x 8 bits RAM can be read or written one 8-bit data at a time, using
13-bit address code. The RAM is also called a 64K-bit or a 4K-byte RAM. The capital K is a prefix representing
“computer kilo” of 1024 (210 ), used especially when indicating the size of memory.
Example: What is the memory capacity of a RAM having A0 to A14 address lines and D0 to D7 data lines?
10
A0 to A9 --> 10 lines (2 ) --> 1K
5
A10 to A14 --> 5 lines (2 ) --> 32 1K x 32 x 8 bits = 256K bits = 32K bytes
D0 to D7 --> 8 bits

Type of RAM
There are two type of RAM, the static RAM and dynamic RAM. The static RAM is widely used in electronic
keyboards in having very low power consumption
Memory cells in the dynamic RAM must be refreshed by inputting data again, every millisecond or so. But the
advantage of static RAM is that it has a short access time.

- 14 -
Diagram for a 2048 x 8 bits (2K bytes) static RAM

A0 D0
A0

Address decoder
A1 128 rows Data
x Address bus
A2

(row)
128
A3 16 columns bus D7
R/W Read / Write
A4 Memory size A10 CE1
A5 2048 x 8 bits CE2 Chip enable
A6

Output data
16 x 8 bits

buffer
D0
D1
Input data
controller

Sense amp.
D2 Write amp.
D3
D4 Address decoder
D5 CE1
(column)
D6 Read / Write

CE2

A7 A8 A9 A10
Fig. 30
ROM
RAM will lose the contents of the memory when the power is interrupted. ROM permanently holds the data
stored by manufacturers. The same technologies are used in ROM as in RAM. In general, ROM is simpler
than RAM since fewer control elements are necessary.

CPU
The main component in a digital system is the CPU (Central Processing Unit). Let us start with a basic
computer organization before learning the CPU in electronic keyboards.
A computer is a vast assemblage of simple logic gates and memory devices organized to perform complex
calculations at high speed by automatically processing information in the form of electrical pulses. The infor-
mation consists of data and instructions; a complete set of instructions is called a program. The functional
organization of a basic computer is illustrated in Fig. 31.

Functional components of a computer


PROCESSING CPU

Data
Instructions INPUT CONTROL OUTPUT Results

MEMORY

Fig. 31

All communication from the operator to the machine is through the input devices. Each instruction or data is
stored into the computer memory. The CPU fetches the instructions from the memory, decodes them to
arrange the processing circuitry, executes the instructions, and then makes the results available at output
ports. A single chip CPU contains the instruction decoder, controller, accumulator, auxiliary registers, timing
circuits , and I/O buffers as shown in Fig. 32.

- 15 -
Internal diagram of a basic CPU

Registers RESET
Instruction decoder Accumulator
INT
Instruction registers ALU Program counter NMI
WAIT
IORQ
RD
Clock WR
etc.
Control & Timing

VDD Internal bus


Control
bus
GND

Addressing control/buffer I/O buffer

Address bus Data bus

Fig. 32

The CPU is connected to the rest of the system by three groups of lines: the data bus, the address bus and
the control bus. Also connected to the buses are the memory and input and output ports. The data bus is used
by the system to transmit binary numbers (data) from point to point. The address bus is used by the CPU to
access to any location of memory or registers of the I/O ports. The control bus is used by the CPU (or other
devices) to indicate status of the system, and to control the system.

System diagram for a basic computer


Input Output

Data bus

Memory
CPU (program/data/ Input ports Output ports
PG working storage)

Control bus

Address bus

Fig. 33

- 16 -
System diagram for a high-end keyboard

Keyboard Console

Display/button
Key controller controller I/O ports

Buses ROM
(data storage :
PCM sound data)

ROM
DAC CPU (program storage)

RAM
(working storage)
PG
Analog circuit Digital circuit Memory

Fig. 34

The combination of the CPU, IC memory devices, a DAC, and I/O ports constitutes a high-end keyboard as
shown in Fig. 34. In a low-end keyboard, the CPU is actually made up of those components on a single chip
as shown in Fig 35. In a standard keyboard, the CPU generally contains built-in I/O ports in it. In a high-end
keyboard, the CPU is similar to a microprocessor for a basic computer.

Low-end keyboard Standard keyboard

CPU CPU ROM


(program storage)
ROM(program storage) (data storage)
ROM(data storage) Key controller
DAC DAC
Display/button
Key controller controller
Display/button controller RAM

Fig. 35

Signals to CPU
Fundamental signals to the CPU in a basic keyboard is listed below. The power source, clock and reset
signal are essential for the CPU to bring it to life.
POWER: +5 V power source and ground.
CLOCK: A source of accurately timed pulses, used for synchronization in a digital system. A clock governs
timing to execute an instruction in the CPU.
RESET: Reset forces the digital system to zero and gets the CPU ready to start at location zero.
Power, Clock and Reset signals are essential for the CPU to perform any function.

- 17 -
Control signals
INT: Interrupt request accepts the signal generated by an I/O device requiring service.
NMI: Non-maskable interrupt is a high priority interrupt to save program status in case of a power failure; it
forces the CPU to restart in a designated location.
MREQ: Memory request indicates that the address bus holds a valid address for a memory read or write
operation.
RD: Read indicates that the CPU wishes to read data. The device addressed uses this signal to put data
on the data bus.
WR: Write indicates to memory or an I/O device that the data bus holds valid data to be stored.
IORQ: I/O request indicates that the address bus holds a valid address for an I/O read or write.
WAIT: Wait tells the CPU that the device addressed is not ready for a data transfer.
APO: Auto power off signal controls the power supply circuit.
Address and data buses
Address bus: A group of lines used for accessing a memory or an I/O port by the CPU.
Data bus: A group of lines used for transmitting data from one or more source to one or more distinations.

State of CPU
The CPU of a standard keyboard gets into one of three states, dead, suspended and active as shown in Fig.
36, since the keyboards equip with the auto power off function. The CPU is dead at no power source, then
gets into the suspended state when supplying the power source. The CPU becomes active when switching
the power on, and it is changed into active and suspended at every power on or off operation.

State: DEAD SUSPENDED ACTIVE


NMI terminal is open
others are closed.
+VDD is supplied. All voltages are supplied.
No power source
(POWER OFF) (POWER ON)

Operation: Batteries are set or removed. The power switch is selected on or off.
An adapter is plugged in or out.

Trigger pulse: RESET signal NMI signal

Fig. 36

Diagram of system operation

1 when power source is applied. ROM


High address
2 when power switch is pressed.
3 when power switch is pressed again. Sound data etc. Data

2 3
MNI 3 Power-off subroutine
CPU 2 Power-on subroutine Program
1
RESET
1 Initialize subroutine
Low address
Fig. 37

- 18 -
SYSTEM OPERATION
The illustration in Fig. 37 shows process in system operation of a standard keyboard. Reset signal is provided
to the CPU immediately the power source is applied. The lower address of the memory are generally ROM,
so that the CPU starts executing a program at location zero by receiving the reset signal. The CPU executes
the program, which includes information about the system and instructions to be done first, this operation is
called “initialize.” After that the CPU turns suspended state.
Non-maskable interrupt (NMI) is provided to the CPU when the power switch is pressed. Upon receipt of the
interrupt, the CPU restarts in “power-on subroutine” of the program and sets up the system at the ready to
play. During this operation, the CPU provides the APO signal to the power supply circuit.
The CPU will restart in “power-off subroutine” of the program, and will shut down the power when receiving
NMI signal again.
The illustration in Fig. 37 shows that the entire program is stored into an external ROM. However, in some
keyboards, part of the program or the entire program is stored into the CPU, since the CPU chip contains an
internal ROM to store a program as shown in Fig. 38.

Location of program and data in keyboards


Standard keyboard High-end keyboard
Standard keyboard
ROM ROM2
ROM CPU
CPU Data Data
+ Data + +
Program Program1
Program2
ROM1
Program2
Fig. 38

Flow chart
A flow chart is a block diagram representing the structure of the program. The diagram in Fig. 39 shows a
system flow chart example at the initialize and power on.

START When batteries are set or an adapter is plugged in, the CPU
receives power source +5 V then the reset signal.

set stack pointer


Stack is an area of memory reserved for the storage of sub-
routine and interrupt managements.
initialize system registers Stack pointer is a register which holds the address of the top
of a stack.
Initialize is to set various counters, switches, and addresses
initialize internal ports in a computer to zero, or to other starting values at the beginnig
of a routine.

suspended mode

Fig. 39a

- 19 -
Example: Flow chart of a system containing;
START
CPU (HD6433298) (suspended mode)
DSP (HG51B115FD)
Key controller (HG52E35P) set stack pointer

When pressing the power switch, the CPU initialize system registers
receives the interrupt signal NMI.

initialize internal ports

initialize internal timers

initialize MIDI serial ports

initialize internal ADC

raise APO to +5V then wait for 400 ms

check power supply voltage

check external RAM

error routine clear external RAM

(system halt)
clear internal RAM of CPU

initialize DSP

initialize keycontroller

initialize working storage

main routine

Fig. 39b

- 20 -
DAC
The resistor network in Fig. 40 is used for a DAC. The output voltage from the network is proportionate to the
place value of the bit (binary count), each successive higher bit applying twice the voltage of the previous bit
as shown in Table 5.

Output voltage R R R Binary input Output


3 2 1 0
V DD /2 2 2 2 2 voltage
0 0 0 1 VDD /16
2R 2R 2R 2R 2R
0 0 1 0 V DD /8
0 1 0 0 V DD /4
VDD 0V 0V 0V
1 0 0 0 V DD /2
Binary input 1 0 0 0
8 4 2 1 Weight 8 4 2 1

Fig.40 Table 5

The circuits of a DAC consist mainly of two parts: a resistor network for binary input and an op amp as
summing amplifier for the analog output. The diagram in Fig. 41 shows a basic 8-bit DAC. For precise analog
conversion, the bits must be represented by precise voltage, which voltage is called the reference voltage.

R R R R R R R

2R 2R 2R 2R 2R 2R 2R 2R Analog output
2R
Op amp (voltage)

Shift register / Latch


Binary input Reference voltage
(8-bit pulse code)
Clock Reset
Fig. 41
KEY CONTROLLER
Contacts of a keyboard is generally arranged in a matrix, for example contacts of 61 keys in a 8 x 8 matrix
as shown in Fig. 41. Each contact with a diode is connected to a row line and a column line. In Fig. 42 the
row lines are called “key input lines,” and the column lines “key common lines.” A key controller stores the
table of the key matrix connected into the internal memory.

Key common lines


KCO KC1 - - - - - - KC6 KC7 Key common line KC7
KI0
KI1 Key contact
G2
KI2
Key input lines KI3 Diode
KI4
KI5
KI6
KI7 Key input line KI0

Fig. 42

- 21 -
Key matrix table for a 61-key keyboard

KCO KC1 KC2 KC3 KC4 KC5 KC6 KC7


KI0 C2 C#2 D2 D#2 E2 F2 F#2 G2
KI1 G#2 A2 A#2 B2 C3 C#3 D3 D#3
KI2 E3 F3 F#3 G3 G#3 A3 A#3 B3
KI3 C4 C#4 D4 D#4 E4 F4 F#4 G4
KI4 G#4 A4 A#4 B4 C5 C#5 D5 D#5
KI5 E5 F5 F#5 G5 G#5 A5 A#5 B5
KI6 C6 C#6 D6 D#6 E6 F6 F#6 G6
KI7 G#6 A6 A#6 B6 C7

Table 6

A key controller provides a pulse line by line starting from KC0 to KC7, and repeats the sequence at regular
intervals as shown Fig. 43. The pulses are called the “key common signal” or “key scan signal.” Using the key
common signals, the key controller is checking the keyboard at regular intervals to see if a key has been
pressed. When a key is pressed, the key controller checks which key has been pressed according to the key
matrix table. For example, when keys C4, F4 and A4 are pressed, KC0 and KC5 signals flow into KI3 line,
also KC1 signals into KI4. Upon receiving those key input signals, the key controller looks up the key matrix
table, then finds out that keys C4, F4 and A4 has been pressed.
Key common signals

KC0
Key controller KC1
(Internal memory) KC2
Key matrix table KC3
KC4
KC5
KCO ~ KC6
KIO ~
KC7 KC7
KI7
Key input signals
KI0
KI1
Keyboard KI2
(Key matrix) KI3
KI4
KI5
Keys C4, F4 and A4 are pressed. KI6
KI7

Pulse from C4 contact Pulse from A4 contact


Pulse from F4 contact
Fig. 43

- 22 -

You might also like