Maker Pro
Maker Pro

Midi File Sounds

MannaMan86

Dec 9, 2013
19
Joined
Dec 9, 2013
Messages
19
Hi, I am making sort of a miniature drum set project - basically I want to use an electrical current to initiate a drum sound from a microcontroller. I have some experience with microcontrollers, so the basic setup is not the problem. The problem I have is this:

Do I store a Midi file library in the microcontroller? Or, do I store aMidi file library of sounds on a Codec (if that's possible), and then just access the codec via microcontroller signal?

-B-town.
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
http://serdaco.com/files/SAM2195.pdf
Take a look at something like this.
MIDI is more of a signalling protocol. It does not actually carry audio, but carries various values such as instrument, and duration.
You can easily program a microcontroller to be a 'MIDI Controller' which you can then easily feed to a computer if you want the MIDI signals to trigger some more advanced samples, sounds or functions. You could also just as easily connect it to something like the Synth I linked above.
The synth will hold the various MIDI 'voices' that will be played based on the signals it receives.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
As Gryd3 says, MIDI is a data protocol that doesn't contain audio. To convert it to audio, you need a MIDI synthesiser of some kind, which either generates sounds using analogue (or simulated analogue) techniques like FM, or triggers playback of stored sound samples. A stored sound sample is like a WAV file, stored in the MIDI synthesiser, which is played back through a DAC or codec when triggered, to produce an audio signal.

A codec or DAC does not store sound samples; it simply converts the individual numbers in the sound sample into analogue voltages as the sound sample is played back. So the output from the codec or DAC is a voltage signal that you can amplify to hear the sounds.

You can store sound samples in your microcontroller, if it has enough memory, or you can store it in off-board memory such as serialflash, as long as the micro can read it quickly enough given the maximum polyphony you need. Parallel Flash ROM is quicker to access randomly and might be a better option. Sound samples are normally recorded at 44,100, 48,000 or sometimes 96,000 samples per second; each sample is normally 16 bits wide (two bytes), and there are two channels if the sound is stereo. Stereo would be desirable, even for a drum kit, because the sounds can be pre-processed to include some ambience (reverb); adding reverb in real time to a clean sound is hard work for a small micro, although you could use an outboard reverb unit.
 
Top