Construct an Audio Player with a Field-Programmable Gate Array John C. Greavu III
University of Minnesota, School of Physics and Astronomy
I. INTRODUCTION
8-bit and 16-bit audio players were built by employing pulse-width modulation (PWM) techniques with a field-programmable gate array (FPGA). Basic PWM and audio playing methods are explained in detail. A sigma-delta modulation module, specifically, was programmed into a Basys FPGA in Verilog to produce the audio signal. In addition, several other Verilog modules were needed to complete the player: a 25 MHz to 44.1 kHz clock converter, address counter, and byte readers. Documented code for all the modules is provided. The techniques explored here are practical, efficient, and therefore, popular methods for audio sampling and listening as well as other digital to analog applications.
II. THEORY & SETUP
To first get a better understanding of pulse-width modulation, consider the schematic of the LED dimming circuit shown in Figure 1.
Figure 1: A light dimmer. A switch controls if the LED is on or off. The LED is on when it’s connected to the battery (switch upwards).
The LED can only be completely on or completely off; its instantaneous brightness is never actually between the two. However, if the switching rate equals or exceeds the response rate of our human eyes, instead of the binary on-off switching, our eyes act as “averagers” and the LED is perceived to have
“dimmed”. This averaging is analogous to our eyes acting as an RC low-pass filter (see Figure 2). If the switching rate is periodic, then the time it takes for a full switching cycle Tswc is given by
!
T ≡ T +T
! swc on off
(1.1)
where Ton is the time the switch is on and Toff is the time that it is off. The frequency or rate of
!
! switching is f swc =
1
1
=
Tswc Ton +Toff
(1.2)
!
To automate and keep the switching periodic, an algorithm was written and implemented