Monday, March 13, 2017

Homemade Drum Machine - Overview, Code and Links


This is a homemade drum machine. The main features are: 
  • Four drum voices
  • One for kick sounds, with sixteen samples
  • One for snare and clap sounds, with sixteen samples
  • One for hihat, generated using a noise source with an adjustable decay time
  • One for toms and other percussive synthesis sounds, with sixteen presets
  • Each drum voice can have an independent pattern length of up to sixteen steps
  • Each drum voice can change pattern independently between four patterns
  • Low pass filter with resonance and adjustable frequency
  • Adjustable tempo
  • Independent sync output for Nanoloop on GBA
  • Independent sync output for Pocket Operators,
  • Independent sync output for Sync 24






This homemade drum machine has four channels - one for kick samples, one for snare samples, a noise-generated hihat and a percussive synth voice.


Each drum voice has an independent length of up to sixteen steps, and can switch between four different patterns.


There are sixteen kick samples and sixteen snare samples, and the length of the hihat can be adjusted.Presets can also be recalled to select different percussive synth sounds,


Additionally, there's a low pass resonant filter with selectable frequency, a tempo control, and sync outputs for various formats.



The sixteen buttons used for pattern sequencing are connected, in order, to Teensy pins 33, 34, 35, 36, 37, 38, 39, 15, 16, 17, 18, 19, 20, 21, 22, 23.

The sixteen LEDs used for representing active or inactive steps  are connected to the Teensy via two 74HC595 shift registers. The latch, clock and data pins are connected to Teensy pins 0, 1 and 2 respectively. The Q7' output of the first 74HC595 is connected to the data pin of the second 74HC595.

The four buttons used to select the different drum voices and patterns are connected to Teensy pins 30, 28, 26, 24. The four LEDs used for indicating drum selection are connect to Teensy are connected to Teensy pins 29, 27, 25, 12.

The button for shifting to pattern length selection is connected to Teensy pin 9. The LED used for indicating drum pattern length mode is connected to Teensy pin 5.

The potentiometer for changing the tempo is connected via ground and 3.3V to A12. The potentiometer for changing the filter frequency is connected via ground and 3.3V to A13.

Every LED has a 68 Ohm resistor in series to ground. Every switch is an SPST type connected to ground. Audio output is on DAC0.



The Arduino code can be downloaded here: http://milkcrate.com.au/_other/downloads/arduino/homemade_drum_machine.zip

Teensy pinouts can be found here: https://www.pjrc.com/teensy/pinout.html

More information about the Teensy audio library can be found here: https://www.pjrc.com/teensy/td_libs_Audio.html

The Audio System Design Tool for the Teensy audio library can be found here: https://www.pjrc.com/teensy/gui/

Sound files were edited in Ableton Live, exported and normalised, and then converted using the wav2sketch utility.

The Windows version of the wav2sketch utility can be found here:
https://github.com/PaulStoffregen/Audio/tree/master/extras/wav2sketch

The MacOS version of the wav2sketch utility can be found here:
https://forum.pjrc.com/threads/42401-Instructions-or-tutorials-for-using-wav2sketch

Drum synth settings were edited and auditioned using the Teensy Drum Synth Editor, which can be found here: http://little-scale.blogspot.com.au/2017/03/teensy-audio-library-drum-synth-editor.html

0 comments: