Beruflich Dokumente
Kultur Dokumente
Abstract: This paper describes how to generate electronic tone using FPGA.
There are three steps to achieve our goal: generating fundamental and
harmonic sinusoidal waves, adjusting proportion of each harmonic wave
and making summation, adding envelope to summation of waves. We also
design a keyboard sensor to measure the key pressure and control the
volume. The design shows high speed and easy programmability of FPGA.
1. Introduction
The DE-2 provides a system clock with 50MHz. First, the system clock
should be subdivided into a slower frequency. Then the slower frequency is
used to drive an address generator to produce 7-digital-bit address signal.
Finally, the address signal will be connected into a RAM which has a
discrete sinusoidal wave table. The RAM should be initialized by a Memory
Initialization File (MIF). The depth of the discrete sinusoidal wave is
7-digital-bit, correspondingly same with that of address signal, which means
the sinusoidal wave has 128 discrete points at time-axis. The width of the
discrete sinusoidal wave is 8-digital-bit, indicating the amplitude of the wave.
[3]
address RAM
system
f clk [6:0] depth*width: D/A
clk Frequency Address Amplitude
128*256 Converte
Divider Generator [7:0]
Sine Wave r
Table
V ( wt ) Ak sin( kwt k )
2 Fsys Fsys
kw 2f 2 2 (Fsys=50MHz)
T AddrLength DivFactor 128 DivFactor
AddrInit
k 2
AddrLength
addr
n
V j
'
i m
K ji Sin( w jit ji )
Amplitude
On the time basis, make summation of fundamental wave and harmonic waves
Amplitude 1
Amplitude 2
Amplitude n
Make superposition at
each time points
Vo
n
Vo Vi
i 1
2.3 Envelope
Vj` means the Superposition of sinusoidal waves, but there is a final step
before the electronic sound could simulate the sound of real piano. When
users keep pressing the key of instrument like piano, the sound will become
weaken and finally disappear. However, as for violin or some other
orchestras, when users vibrate the strings of violin, the sound will continue.
So we need envelop to describe this feature among different instruments. [4]
n
V j K b (t ) V
i m
iom Sin( w ji t ji )
Figure6. Kb(t) is the envelope function. It is 10-digital-bit signal.
address
[6:0] V_data
RAM Voltage_data
[7:0]
system clk f clk depth*width: [15:0]
Frequency Address D/A
Divider Generator
128*8 Converter
Sine Wave
Table A_data
[7:0]
Envelope
address
[6:0] V_data
RAM [7:0] Voltage_data
system clk f clk depth*width: [15:0]
Frequency Address
128*8
Divider Generator Sine Wave A_data
Table [7:0]
Envelope
Finally, we use the audio chip Wm8731, which is provided on DE-2 board,
to make the electronic tone can be heard through headphones or speaker. The
audio chip Wm8731 is programmable through IIC Bus. It has a High
definition D/A converter inside and supports 32-bit digital audio signal. So
that the high quality of electronic piano can be guaranteed.
To change parameters of Wm8731, we write a VHDL interface to connect
Avalon Bus of Nios CPU and IIC Bus. Therefore, the data can be written
into Nios CPU from PC through UART and then transferred to the Wm8731
through IIC Bus. [5]
4. Keyboard Sensor
The keyboard sensor is designed to measure the force of pressing keys. Each
key sensor is mainly based on a capacitance oscillator. When we press a key,
the area of plate is changed. Therefore the value of capacitance changes and
period of oscillator varies as well. We use the counters, which are designed
onto FPGA, to measure the oscillation period. The numbers attained from
the counter is a real-time signal and indicates the key pressure. After linear
transformation, we can get parameter K L (t ) to change the loudness of
electronic musical scale according to the volume when pressing keys.
n
V j K L (t ) K b (t ) ViomSin( w ji t ji )
i m
(Multiplying 10-digital-bit parameter key pressure K L (t ) to the former
n
equation in part 2 V j K b (t ) V
i m
iom Sin( w ji t ji ) )
C A
kd The value of capacitance will change if the area varies.[6]
before pressing the key, after pressing the key, the frequency of
the frequency of oscillator is 43Khz oscillator is 33Khz,become longer
Figure18.Connecting the keyboard sensor to DE-2
5. Summary
[2] Qiwu Liu and Qiwen Liu, Maintain of electronic piano, Beijing
Publishing House of Electronics Industry, 1991.1 ISBN: 7505312103
[3] Wei Jin, Shiqing Qi and Jianguo Wang, Modern detection technology,
Beijing University of Posts and Telecommunications Press, 2007.6 ISBN:
7563511180
[5] Song Pan and Jiye Huang, Electronic Design Automation Technique,
Science Press, 2009.1 ISBN: 9787111275817
[6] Chengying Hua and Shibai Tong, Analog Electronics (forth edition),
Higher Education Press 2006.1 ISBN: 704018922