Designing a step sequencer

by Nick_Zaillian » Mon, 27 Jul 2009 06:45:01 GMT

Sponsored Links
 Hey all.  This is my first post to the Android group.  I grabbed the
Android SDK a few days ago and have been playing around with it in the
time that has elapsed since.  I've built a few simple apps to get a
feel for everything and have been generally pleased.  In any case, I
am posting here because I am interested in building an app with a step
sequencer and am not quite sure how best to go about doing it.  My
idea is that the user would be presented with a row of 16 toggle
switches, a tempo control, and a few buttons to select instruments
(kick drum, snare, etc...this is basically an emulator of old-
fashioned drum machines).  Each instrument would have its own 16-step
pattern and when the user pressed a "play" button, all of the
individual patterns (which might more appropriately be called "parts")
would play back simultaneously.  Accomplishing all of this would be
relatively straightforward if Android/Dalvik had a javax.sound
implementation (it includes midi tools and audio playback tools) but I
know that it doesn't.  I was thinking, then, that the best way to go
about building my program would be to have a bunch of MediaPlayer
instances and some sort of scheme for representing patterns as strings
(maybe something as simple as 0s for "no-hit" and 1s for "hit").  I
was thinking I'd keep these pattern strings in an XML file and update
it every time the user changed the state of a toggle switch.  For
playback, I was thinking I'd parse the XML file such that I'd have a
16-element array of, let's say, 10 (if there are 10 instruments)-
element arrays of 2-element arrays where the 2-element arrays consist
of [(instrument), (hit/no hit)].  I'd then use a timer (set to user-
selected Tempo) to step through the 16 element array and, when an
instrument represented in the contained array had a "hit" state, call
the start method of the corresponding MediaPlayer instance.  So,
that's my fairly convoluted solution to the problem.  I am posting to
the group because I am so new to the SDK and figured that I should
probably ask of those more experienced whether there is some glaring
problem with this solution or, perhaps, if there is a far more simple
way to go about accomplishing what I'm trying to accomplish.


Other Threads

1. Frame by Frame Animation

Hey Gang,

Has anyone noticed a threshold adding images to frame by frame
animation? I have 30 images, but when I add more than 24 is causes the
app to crash. Any ideas?

2. Bitmaps (.bmp) don't show up in 'Pictures' when on SDCard

Thanks clark, I wasn't aware png was lossless, I changed the format and it
all works fine!




3. how to move a button from one position to another?

4. How to make android work fine with QVGA?

5. Go to Settings page from code?

6. How to change the selected color (default green) of a toggle button

7. Vertical SeekBar?