Added ability to be a Sync24 or Sync48 slave.

Ignore the comment about it not working.  It just turns out that
ncurses (at least the way I'm using it) doesn't implement the concept
of holding down a key, needed to emulate sustaining a gate signal.

Squashed commit of the following:

commit 8fe9815478dda68f30dad7cc376edc83cf44f0f0
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 12:06:11 2012 +0100

    Refactoring (not yet working) code.

    Technically more repitition, but in the low level implementation,
    it'll probably save valuable CPU cycles to only update the variable
    to something if it's actually changed.

commit 24ffa3434981cda6183afdc63c6277ce8cfaab38
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 12:02:18 2012 +0100

    Starting to attempt Sync 24 gate input.

commit 2e9c74d9a525a6f25ebe31bb5bf3fdeb98e2b8e0
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 11:54:35 2012 +0100

    Fixed Sync 24 trigger input.

commit 54355bdf6b33a0b517648a3fcbe5ba9fc716b1ef
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 11:47:17 2012 +0100

    Starting to attempt sync 24 trigger input.

    Kind of like tap tempo, only 24 times the speed.

commit 97571ac9461c444fa0baecdd8370e0863f93fbb2
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Tue May 22 22:53:06 2012 +0100

    Renamed all current sync variables as explicitly output related.

    The sync input variables will be entirely discrete.

commit 26264e07aa00db0afb5cef574a3243405017c586
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Tue May 22 22:48:28 2012 +0100

    Advertised the fact.

commit d7181c2d40fa2e4bd9e2dee12fb2a03a87b73876
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Tue May 22 22:45:52 2012 +0100

    Added Sync24 input buttons.

commit baaac734e65c68e703cf132f9e60a16988f5a37e
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Tue May 22 22:40:49 2012 +0100

    Tweaked "last play mode" variable.

    If we get a Sync24 gate input, we know what we're looping, but we
    have to loop.

commit 8cf654049ea0f8161769ffaa04fca496ae60c91c
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Tue May 22 22:38:42 2012 +0100

    Added "last play mode" variable.

    So if we get a Sync24 gate input, we know whether we're looping a
    pattern, looping the song or playing the song.
Implemented tape sync output.

The only issue with this is that time is now measured in the dizzyingly
fast realm of microseconds instead of the comfortable world of
milliseconds.  This is probably overkill, and will lead to the
sequencer having a possible issue every 70 minutes (see
http://arduino.cc/en/Reference/Micros for details) instead of every
50 days (see http://arduino.cc/en/Reference/Millis for details).

Squashed commit of the following:

commit fb833068b0ead6a05f217c10dac9d9893437be73
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 22:49:50 2012 +0100

    Bugfix in testing code.

commit 128dd657eb9312090c5dd3486e655abbbc4abaf9
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 22:38:56 2012 +0100

    Stepper now uses microseconds, not milliseconds.

    The Stepper 1 prototype interface still seems OK, but the tape sync
    still isn't working...

commit 27359db89cf7b5cbea059d3368773c6438861aba
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 22:19:20 2012 +0100

    Looks like no tape sync today.  Shame.

commit 43b9671a892e76e6e6aa62a3a3b12661e18b8b41
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 22:11:34 2012 +0100

    More thorough / realistic test.

    Added delayed start and stop, so there's a buffer of paused sequencer
    either end of the .wav file.

commit 1563334705b70a5d9c237ea171056fdc5cfeb5ba
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 22:05:48 2012 +0100

    Doctor, we have a pulse!

    ...only compared to the MC-4 reference pulse I'm working to at http://stevewoodward.posterous.com/roland-mc-4-sync-tones , the pitches sound too low frequency, and the clock sounds too high frequency.

    Amendment: listening to the references again, the clock sounds OK
    to me, leaving just the carriers to fix.

commit 4b61ea71aa677f0209497fae6393d2fa5575919b
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:49:44 2012 +0100

    Getting there...

    It's not working yet, but now it's at least making a noise, albeit
    a constant one.

commit caa7a4292055d639cb10fe06fba3cf676d456445
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:47:40 2012 +0100

    Tape sync combines trigger and gate into one single signal.

commit d8336304fe669c0567a5d45b6e9d3eb281b6358b
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:46:58 2012 +0100

    Timing fix.

    It would also help if we actually told it to play.

commit c0e9c3dcbaac97a3e36fac4c3e4aae6e775775c5
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:37:54 2012 +0100

    That's one bug fixed in the test code...

commit e41c7bf51d601140731e74d385ba2e601b996fd6
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:33:53 2012 +0100

    Incrementing time would help...

commit 35e7af591c78ed9a26cb283cfe35a505bde656bb
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 21:31:16 2012 +0100

    Set up means of testing tape sync output.

    It doesn't work after all.

    I'm using the output code from commit
    315b2708a6961039e20b6f937ce53454308d2ac0, modified everso slightly.

commit acdd72946c2b8c03f479aeb44cf8a5146e52dcc2
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 14:14:52 2012 +0100

    Added tape sync trigger output.

    Completely untested, aside from making sure the syntax is valid.
    (I'm not sure how to test it without doing some soldering and buying
    an oscilloscope, or making a wave file writer, etc.)

commit 9536f8f3f17abe548f1544d0922221f6ce95724c
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Thu May 24 13:57:42 2012 +0100

    Renamed Sync to DIN Sync.

    This is to avoid confusion with tape sync.
Removed tape sync output.

I'll sleep better at night if Stepper is more stable and simple,
rather than boasting features it might struggle to properly provide.

Revert "Implemented tape sync output."

This reverts commit 225b6c12d0ae168229b4ad35574ad1a78dd5cc22.
Segregated clock and sequencer; added drum machine.

This is a pretty big change, probably the biggest since shedding
Surf.  The clock and sequencer are now discrete things which talk
to each other via the main code.  This means the sequencer is less
smart and has a much lower resolution, not being aware of time at
all anymore, which allows it to now (theoretically, by overriding
it listening to the internal clock, letting it listen to an external
clock) become a slave to another clock via DIN sync.  Sliding is no
longer tempo aware, now using a simple (software) slew limiter instead
of tempo based calculations.

Tracker 1 is completely gone.  Multiple channels are completely gone.
The different play modes are gone.

This is no longer a fully self-contained song writing tool.  It's
now one small cog in a larger overall machine.  This is major feature
retreat.

I also made a drum machine.

The code and comments are in bad need of refactoring, which should
be my next task.

Squashed commit of the following:

commit 162842ff5152522a55b94f6fda59cbce76db237a
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 19:30:11 2012 +0100

    Made slew limiter time aware.

    I had to completely guess what might be a good time for the portamento
    to take.  Currently, the exact value of the slide is ignored (it's
    treated as a boolean, which is all the interface will allow anyway),
    and if it's activated, then the pitch creeps one 12-bit integer
    closer to the correct pitch value per millisecond.

commit ef50d6ce144e5fb435ea22296258b5e55462e949
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 19:22:32 2012 +0100

    Renamed song/memory files.

    This is to reflect the fact that they've now diverged, and are no
    longer compatible with one another.

commit 77e5d29156fac6ae24fd12b4637dfe0fe04624b3
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 19:15:26 2012 +0100

    Fixed pattern changing in both machines.

commit d9546ceea43fc291ad8f0d27870a7933f3e429fc
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 18:52:55 2012 +0100

    Fixed drum machine pattern loading/saving issues.

commit 5824b512282b99f5af1e6dd2152fecf7095c0b21
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 17:09:28 2012 +0100

    Started debugging drum machine pattern writing.

commit 94e9e1b128487a6aeff96bb6f8d104e257659d1e
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:47:59 2012 +0100

    Triggers now act like triggers.

    Or at least, gates that aren't under the effect of a slide.

commit 6bda625e6247cc3cc80474552cb98e653bdc5a77
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:38:57 2012 +0100

    Updated readme file.

commit 3db588381004a58517fd8f995c4c805175772c18
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:34:47 2012 +0100

    Trigger work.

    They're currently acting more like gates, so I'll need to fix that,
    for triggers that are on consecutive rows.  But they are starting
    to work already.

commit ca75f63c5d310358d1a894b7aa4d446c2eab7403
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:31:25 2012 +0100

    Started to bugfix drum machine.

commit cf50183354fb1218e45fbdaf574e1a8dea645582
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:24:25 2012 +0100

    Various minor touches.

    * Added slew notes to slew limiter
    * Removed main notes
    * Updated note length to better match original acid machine

commit a2ae53e9d76f3f096646e53b5f7832dea2abbec0
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:18:35 2012 +0100

    Fixed slide.

    The actual sliding of the pitch itself should occur on the note
    *after* the one which has slide set.

commit d891babf95b111b2b2ea1ee46fc92ccc04cfc643
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 16:13:20 2012 +0100

    We now have very basic sliding.

commit a8e2c33dcedf79dc6751e4df7c3f984ec49d1169
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 15:51:25 2012 +0100

    Stopped filenames of different machines clashing.

commit 2b8d3f93aa9497ed4607bca21b11b7b843a9f192
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 15:36:44 2012 +0100

    Started work on drum machine.

commit 687e8687727960ecf57539181d984d229e2685ff
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 15:22:08 2012 +0100

    Fixed gate!

commit 93ac54fce7bb71f8dd412515612b4a219c702bfb
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 15:19:16 2012 +0100

    Replacing magic numbers with constants.

    Still not quite there with the gate yet.

commit 16f5363f564ef5a28241911d4d2cd4336352c689
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 15:07:44 2012 +0100

    Getting there with implementing gate output...

commit 1d835117c80655462eb5e4e83ed2c124edc70337
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 14:58:22 2012 +0100

    Accent and slide tweaking.

    Stepper Acid will not slide accents, only pitches.

    The Stepper Acid sequencer won't slide anything at all.  I'll make
    a new time-aware function to act as a slew limiter.

commit bed19f5b5dec7c386e5b381d8b8c645f8a2ce7a0
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 14:43:53 2012 +0100

    More major overhauling.

    * Removed swing from both sequencers (the clock will do that now).
    * Removed everything but triggers from drum sequencer.

commit 212f0508f3ac030cfa1fcb12bc0772dd881576fe
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 14:31:36 2012 +0100

    Removed multiple channels, CV2, triggers and old sliding method from acid sequencer.

commit 49319ea6af3147aff04c7022d56f77e04025624d
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 14:09:38 2012 +0100

    Fixed acidline machine prototype.

commit 59c1d202042e4a039b1ac556e4a0a684f2d3533c
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 14:06:12 2012 +0100

    Segregating the acid and drum sequencers too.

commit dc4d0809fe564d34b37bcd1b1f8e2ef1cc3dfb52
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 13:55:52 2012 +0100

    Removed tracker interface and clock test.

    This is another fundamental philosophical change.

    Someone requested DIN sync input in this thread:
    http://www.muffwiggler.com/forum/viewtopic.php?t=59325 This led to
    me reading up on DIN sync and tape sync, and realising that even
    internally, clocks and sequencers segregate work, forcing the sequencer
    to be very simple as it can no longer have any higher resolution
    than a few clicks per sixteenth note (24, 12 or 6, depending on the
    clock's resolution...  *possibly* 48 with a 96 PPQN clock with an
    exact 50% duty cycle, but I digress...).

    This fundamentally changes the nature of the game, making the sequencer
    less smart by design.  So I'm getting back to basics for now, making
    a stripped-down set of machines closer to my original designs: a
    single channel acid machine, and an eight channel drum machine, which
    require you to manually change pattern, and can't press run/stop on
    your behalf.

commit 96a5015bab5ca85010b25bbd8a11dc8fbb681e8c
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 13:54:31 2012 +0100

    Implemented 96 PPQN in clock and 48 PPQN in sequencer.

commit 487e9163c95a9a1a6340dbf4eb970c51d32d3742
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 13:43:34 2012 +0100

    Updating notes.

commit 64d6c1b3f54603dd73d523ff24f8aa8180cefa98
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 12:29:00 2012 +0100

    Note update.

    Noting the pulse when low as well as high lets us double our resolution.

commit b2456a2dc1d2dc06eda05aede13c5e7d5f248043
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 12:25:50 2012 +0100

    Added notes, as I'm starting to lose track of what I'm doing.

commit a3af29000ca440bc01fa1fb2e75e8ef67f1d473d
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:32:08 2012 +0100

    Fixed pattern changing.

    Both while paused and while playing.

commit 6c470ae6470d1f125cce1a661052f9e1d2185240
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:22:39 2012 +0100

    I knew I shouldn't have used "==".  Fixed.

    You can now storm right through the end of the pattern as you're
    decreasing its length, and you'll always get pulled right back to
    the beginning.

commit 8fd0c0dcd6c8b8810128de4e19e7ba3fb01c0f8f
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:20:37 2012 +0100

    Variable length patterns are now OK to play again.

    ...just as long as you don't decrement the number of rows while playing
    the last one...

commit d1d4567d1560f33815f61d31c92ea6240acab3df
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:16:30 2012 +0100

    Removed alternate play modes.  Now there's only one.

commit 631a87cd9580d47e78f2cc9cd2f14c54cb80b3ec
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:10:14 2012 +0100

    You can now toggle run/stop.

    We're heading deep into a rabbit hole of the sequencer becoming very
    stupid.  As people seem to prefer anyway, it won't have automatic
    song playing anymore, only manual pattern changing.

commit efcd6c431568b4eb51c3e1dd16be96d8928c211e
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:04:12 2012 +0100

    Alternate lastPulse routine.

    Easier to keep track of.

commit e6bd1c55ef069679ad7cdeca30b841930e2650de
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 11:02:38 2012 +0100

    Got the sequencer cycling row numbers, at least.

commit 37e7c62bd76c621b93f53cb982aea5bb93a37591
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 10:48:31 2012 +0100

    Songs do *not* store the tempo, again.

    We're basically making the step sequencer more stupid, delegating
    all tempo related tasks (even swing, eventually) to the
    newly-externalised clock instead.

commit 1fc2adfd9eb6a7e77f89c93f26b4ae5f1e009fca
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 10:39:18 2012 +0100

    Starting work on making the sequencer simpler.

commit ee219001c4acc043cd169ad75f1ce2b963ea198b
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 10:10:15 2012 +0100

    Counting beats.  Looking good.

commit 673711ab682b629a1b9f129b37b058af4e993574
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:49:45 2012 +0100

    Trying out a completely different clock method.

    No modulo arithmetic this way.  Let's see if this makes changing the
    tempo smoother.

commit 347c965089a1f9a81e46b89a4c648dcf7a7df645
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:34:01 2012 +0100

    Minor refactoring.

commit 74209a352a0f5c68b5f3c86054c895e253e078e1
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:32:29 2012 +0100

    Commented things a bit better.

commit d965e97accc784287d5cc3c02802389b562bb118
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:28:47 2012 +0100

    Simplified terminology.

    I know I want it to be simple to understand, but sometimes that means
    being just a *little* terse.

commit 23bfccbc913f7c881cd1392d03889cf5068c7fa8
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:19:46 2012 +0100

    Added key and tempo up/down to clock test app.

    I believe we still have the problem of minor glitches when changing
    the tempo, as it pretends it's always been that tempo.

commit a52c2e99da0f8a620a6c949511bc445d25d9a144
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:06:26 2012 +0100

    Fixed clock testing code.  All working.

commit a2fd222cbb2721a497d6fb61ff6ac26c6018102d
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Sat May 26 09:01:56 2012 +0100

    Tempo setting bugfix.

    Removed redundant line.

commit 8ed1f2768e78f70e133bfeca89c76b1cf9a367e8
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 23:51:40 2012 +0100

    Implemented rudimentary clock based shenanigans.

commit 933db4bfe5bfa2cb2692041df475ad4919c32f55
Author: Zoë Blade <zoe@bytenoise.co.uk>
Date:   Fri May 25 23:20:14 2012 +0100

    Testing the waters with segregating the clock from the sequencer.
Merge branch 'master' into c-port