electronic musical instrument final report
Post on 30-Dec-2015
53 Views
Preview:
DESCRIPTION
TRANSCRIPT
ELECTRONIC MUSICAL INSTRUMENT
Final Report
Mezzo Forte
Background:
• Customer: Dr. Pinkston
• Problem Statement: o Musical instruments take a lot of practice time
to learn and play songs.
o A need exists for a musical instrument that the user can use to play songs without previous knowledge of how to play any instruments, while having similar flexibility of playing an instrument.
Background: Product
• An easy to use instrument
• The note being played is controlled by a song file loaded onto the device
• The timing and volume of each note is controlled by the user
• Has a user interface to allow the user to select from a list of songs in memory
Concept of Operations: Device
1)Plug SD card into the device2)Power the device ON3)After the device finishes initializing, choosea song from the given menu using the up anddown buttons4)Press the PLAY button to start the song5)Play notes from the given song file bypressing the resistive button. Change thevolume of the note by changing the pressureapplied to the resistive button.6)Release the resistive button to stop thecurrent note. 7)Continue Steps 5 and 6 until you wish to change songs 8)Press stop if you are in the middle of a song to quit. 9)Choose another song, or power off the device
Concept of PC Software
1)Plug in SD card to the computer2)Start Mezzo Forte’s Song Generator3)Using the provided GUI, select notes desired for new song4)When finished, choose "Convert to .MFS" under File. 5)From here, the user will be guided in naming and saving a song file that the device can read.6)The user can transfer any other completed songs onto the SD card7)Remove SD card from the computer
Requirements:
• Be capable of playing the range of a piano (27.50Hz-4186.00Hz) without sounding out of tune
• Have an interface for choosing/aborting songs
• Provide software for developing song files and assisting in transferring them to our device
Requirements:
• Have a means for the user to control the timing and volume of notes
• Provide a master volume control for the device
• The cost shall not exceed $150
• Output the notes to an 1/8th inch TRS jack
System Boundary Diagram
System Boundary Diagram
Block Diagram
Design Approaches
• We choose Approach 1 (Micro to DAC)
o Simplest hardware design
o Most software out of any of the designs
o Most familiar with the components involved
o Seemed the most feasible for our application and with the budget and time constraints given.
Design Approaches
Needs:
• Cheap development board
• Enough I/O to complete our project
• Software environment that is easy to debug
• Fast enough to synthesize audio
• Well documented
Component Selection: Microcontroller
Component Selection: Microcontroller
Processor Clock Freq. Memory I/ODev. Board
Cost
C5505 100MHz 320KB
15 GPIO,SPI, I2C, UART,
I2S
$50
ATMega328 20MHz 31KB14 GPIOSPI, I2C
$30
AT91SAM7S256 60MHz 256KB
30 GPIOSPI, I2C $45.95
Component Selection: Microcontroller
• We choose the C5505 (on the ezdsp development board)
o In circuit debugger
o Sample code inline with what we needed for our project
o Development Board included a DAC
o Several supported serial interfaces: SPI, I2C, UART, I2S
o Fairly well documented board and development environment
EZDSP C5505: Diagram
Design: Audio
• AIC3204 contains the DACo already attached to our development boardo sample programs existed showing how
to communicate with it• Audio is synthesized on the DSP, then sent to the AIC3204
for convertion to an analog signal.
Design: Audio
• The different frequency sine waves are generated from a pre-generated table, and stored in a buffer on the device
• We then use the DMA controller on the C5505 to send this buffer to the DACo the buffer is auto-resent once it finishes
• The DMA controller allows the execution of the processor to continue while data is being transfered the DAC
• This allows us to easily use the processor while playing a note (to perform tasks such as filling a buffer for the next note, changing the volume, etc.)
• Design Specifications:o Memory Size: 45kB (4 notes per second for 10 minutes)o Device/Song Memory interactiono Connection to PC
• Three choices for song storage: o On-chip Flash memoryo SD Cardo USB Stick
Design: Memory
• On-board M95512 Flash memory o Already on-board for program memoryo 64KB Flash memory (for Program and Songs)o Loading data to this memory would require development
drivers and software from TIo Small for our needs
• External SD card o 1GB+ Memoryo Interfaced to the C5505 with SPIo Can use multiple types of formatting to interface with PCo This provides a simple interface for the user to add songs
on the PC: just by using the file manager
Design: Memory
Design: Memory
• External USB Flash Driveo 1GB+ Memoryo Additional components needed to interface with
development board.o Multiple types of formatting can be used to interface with
PC
• Our Choice: SD Card for Songs
o No extra components neededo PC interaction is simply drag and drop, no special
driverso Inexpensive, can be replaced.
SD Card Design: SD Layout
SD Card Design: Commands, Timing, and Responses
1) Send Command to SD Card in 6 byte frames.
2) Card Responds with R1 Response
3) If Successful R1 Response, returns start token, followed by data and CRC for data.
4) If unsuccessful, Error Token is sent
SD Card Design: Initialization / Setup
Master Boot Record: - Block 0 - Holds Boot Code, as well as partition data - Use Partition Data to find VolumeIDVolumeID: - First Official Sector - Explains Format and physical layout of FAT's and data - Also Points you to Root Directory SectorFrom here, the FAT's need to be located from the information provided in the VolumeID.
VolumeID Format
File Allocation Table 32 (FAT32): Preparing to read FAT32 Filesystem
File Allocation Table 32 (FAT32): The File Allocation Tables
File Allocation Tables = Pointers• FAT sectors grouped into 4 byte frames• Frames in FAT's correspond to clusters• Follow the chain to follow data
Analog Button
• Based off of a force sensitive button SEN-09375o Basically a resistor whose resistance decreases as the
force applied to the surface increases
• We use the 10 bit ADC built in to the C5505
• The force sensitive button is attached as show on the right
• This causes the input voltage to the ADC to be proportional to the force applied to the button.
Device Software - ADC
• Dynamic Volume Control Procedureo Poll the ADC for the current resistive button readingo Scale and invert the measured value to our value range
of volumeo Compare the scaled value to our threshold value for
playing a note.o If our scaled value is greater than the threshold, play the
next note (if not playing) or continue playing the current note (if already playing)
o Write the scaled value to the DAC to modify the audio volume level
o Poll the ADC again and repeat
Brief Description of I2C
• 2 wire bus
• Each device on the bus has a unique address
• When the bus is inactive all devices monitor for their address• Once the master device writes a devices address it
acknowledges and prepares for future transfers
• Part is NHD‐0420D3Z‐FL‐GBW
• 4 lines, 20 Characters long
• Connected to the microcontroller via I2C
• Powered off of 5V
• Main method of output to the user
• Displays the menu, current song, state information
Design: LCD Screen
• Our limited GPIO pins would be enough for up to 5 buttons
• In the interested of increased flexibility we choose to attach the menu buttons to an serial expander
• The part we choose was MCP23017o 16 GPIO pinso Configurable input, output, and pull-up resistorso I2C interface to the microcontrollero DIP makes it easy to work with
• The buttons ground a individual pin on press
Design: Menu Buttons
Device Software - Menus
• A DIY classic pocket amplifier design by Chu Moy was used for the Master Volume Control due to: o Familiarity with the design. o Compact designo Virtual ground circuit
Design: Master Volume Control
Design: PCBs
• Early in development we realized we were going to need PCBs to fanout certain componentso SD Card Sloto Edge Connector
• Boards were also required foro Menu Buttonso Master Volume Control
Design: PCBs
Design: Power
• Main device can be powered off a single 6V - 35V sourceo Powered via a wall plug o A linear regulator controls the power to the deviceo We currently do not have this connected, as it would
disallow programming of the device (it has been tested and does work)
• Master Volume requires 9V sourceo Currently a 9V batteryo Could be tapped off the main power line (wall cube)
Design: Packaging
• We choose DC-47Po 7.620 x 4.620 x2.555 inches
• Using a Dremel Tool we cut the necessary openings
• Packaged project shown below:
Software: Block Diagram
Software Development Environment
• Main Software development tool was TI's Code Composer Studio v4o Eclipse based environment o Run-time debuggingo Developer ported functionality (printf)
• Software Version Control - Tortoise SVN
o Allowed us to collaborate on different parts and merge changes easily
o Simple to backup and revert code to working versions
PC Software - Music Creator
• Assists the user in creating songs for our device to play.o Presents to the user a piano
keyboard, which they can click on to enter notes.
o The octave of the note can be adjusted by the numeric box below the piano keys.
o The reference note, octave, and frequency effect how the notes are converted.
o Non-converted song files can be saved and reopened later
• An install file was included with the PC Program (the .NET installer and the ALUT installer)
PC Software - MIDI Converter
• Each MIDI file contains any number of Tracks, or sections of datao Any Track can have up to 16 channels playing
simultaneously (16 different instruments)o There is other data present in a Track, such as Tempo,
Key Signature, Note effects, etc. • Our device can only play one channel of one track at a time.
o The MIDI converter breaks the file down into multiple Tracks, then prints out every channel of every track to a separate file
o While this works in getting the channels to play, the main melody of a song tends to change channels, and as such does not allow for a desired conversion
Budget
Component Price Count Total Cost
C5505 ezDSP Development Board
$ 49.00 1 $ 49.00
20 x 4 LCD Screen $ 24.90 1 $ 24.90
Resistive Button $ 6.95 1 $ 6.95
Tactile Buttons $ 0.17 5 $ 0.85
Development Board Edge Connector
$ 7.00 1 $ 7.00
I2C Expander $ 3.00 1 $ 3.00
Packaging $ 8.00 1 $ 8.00
Misc.(SD Card, Master Volume parts, etc.)
$ 10.00 1 $ 10.00
Total 109.70
Testing
Test Name Description Desired Outcome Observed Outcome
Sound GenerationValidate that the generated notes are the correct waveform and frequency.
Output is a sinusoid in tune Success
Volume Control
Validates that volume can be changed as more pressure is applied to resistive button or potentiometer is turned.
The volume changes smoothly Success
MemoryValidates that songs can be selected and played from SD card.
All songs files are visible to device and are correctly read
Success
Device UIValidates that there is a menu on the LCD and it is usable.
Usable UI Success
PC SoftwareValidates that software creates songs usable by our device.
Creates usable songs for our device
Success
• Poor sample code
• Unstable development environment
• Errors in development board design
• Connectivity issues in hardware affecting software development
• Stress while packaging caused the development board to be damaged
Issues Encountered
Lessons Learned
• SVN is very helpful
• Built-in functionality doesn't always work right • Just because it works the first time, doesn't mean it will work
the next time.
• The importance of reliable electrical connections • Dividing work up allows you to do two things at once, but its
also important to note it doesn't allow doing one thing twice at the same time.
Next Steps
• More built-in utilities (scales, demo songs)
• Fabricate a custom PCB as opposed to using a development board
• Integrate master volume control into main packaging
• More featured MIDI converter
• Note visualization: show where the user is in the song better
• More natural analog control for volume and notes • Allow for the user to choose different instruments
Acknowledgments:
• Dr. Pinkston • Mr. Powers
• Chris Lacey
• Everyone in the capstone lab who had to put up with our
instrument all year
Demonstration
• Demonstrate the Deviceo Power the deviceo Insert the SD Cardo Choose a songo Play chosen songo In Settings, modify device settingso Choose the same previous songo Play the song, and demonstrate the modified properties
• Demonstrate the PC Softwareo Create a song with the PC Softwareo Load it onto the SD Cardo Start the device and plug in the SD Cardo Choose the created songo Demonstrate that the created song plays as desired
QUESTIONS?
top related