How to build a drum machine?

Started by Kolo93, March 25, 2015, 01:27:45 AM

Previous topic - Next topic

Kolo93

Hello everyone!
I want to build my drum machine with this microcomputer, but I have no idea how to do it.
I want to create the hardware from scratch and I need help with the software.
This is the pattern of the project:
1) piezoelectric sensors connected via analog port
2) software that recognizes the signal from the sensors
3) other software that synthesizes sounds
I have a problem with the point 3, because I have no idea how to do it.
I only managed to find libraries using prefabricated components connected via USB, and are not useful.
Points 1 and 2 should realize them entirely from scratch but it is not a problem because I found some sample code that uses the values of the analog ports.
Trust in your help

Gerrit

some links to get you started or learn from most are open source so you can study or use the code

http://wiki.linuxaudio.org/apps/categories/drumming
http://alsamodular.sourceforge.net/

WimRoose

I don't think you can use analog sensors like piezo's with the GPIO's on an A20. You have to use an arduino or one of the duino's from olimex, and connect that one to an A20 via serial. On the A20 you can use openframeworks for instance to listen to 'knocks' and synthesize sounds.

I did something similar to make a game - see http://bramvanwichelen.tumblr.com/post/57992974669/nerdwhacker-openframeworks-arduino-game-diy


MBR

You can use the analog sensors with GPIO, but you will need additional circuitry (e.g. a double opamp IC as a pre-amp and a comparator, with a monostable multivibrator made from logic gates as a pulse-shaper on the output). The only exeption is the microphone input, where you can connect a piezoelectric or elecrodynamic pickup as long as the pickup will behave like a microphone, the downside is a little bigger lag and more complicated processing (you will have to emulate the beforehand described analog circuitry).

Although there is a way to synthetise the drum sounds (as did the old soundcards with OPL2/3), IMHO the easier way is to use the real sound samples (for example, the free samples from Gravis Ultrasound MS-DOS emulators) and some library with an audio mixer support, so the main program loop will just an event-directed loop, starting sample playbacks as the input events arrive. Because you want to minimize the input-to-ouput lag, I reccomend to use a lower-level library designed for games, for example the SDL.

Kolo93

Thanks to all for your reply.
I'll try with Gerrit's reply and I'll let you know my results.
Although I do not think I can do much  :-\

For WimRoose
Why I need to use an external hardware? I don't think I need to use Arduino , because I can program the same things on my A20! Software is software! Or I'm wrong?

WimRoose

If you build custom circuitry like MBR suggests, then you don't need an arduinolike. MBR's suggestion is cool , but not really dead simple