MeggySeq 1.0 is released! You can download it here:
Documentation and more details below the jump...
MeggySeq is a step sequencer for the Meggy Jr. RGB from Evil Mad Science:
MeggySeq does not make any noise itself! It sends values over a serial connection to another device. I have built it to talk to an Arduino with a Wave Shield attached:
MeggySeq has 8 patterns of 16 steps each. You can set each of those steps to play one of 8 WAV files on the waveshield. You can play the pattern back, stop it playing, and change the tempo. You can copy patterns from one slot to another. You can even save all 8 patterns from RAM to EEPROM so they won't be lost when you turn off the Meggy Jr.
You can loop patterns into longer compositions (up to 8 patterns long) and edit the patterns and pattern parameters (like tempo, loop length, and pattern length) without stopping playback.
You can edit one pattern while another is playing, and if you change patterns during playback, the first pattern will finish playing before jumping to the newly-selected pattern (or the next pattern in the loop if you've turned on looping).
- Wait, what's a step sequencer?
Think of it as the brains of a drum machine. Each pattern is one measure long, divided into 16th notes. You can set one drum hit to play per 16th note. (You can use other noises, too. More on that later.) A typical measure of drumming has a kick drum on beats 1 and 3 and a snare drum on 2 and 4. Since one measure is 1 pattern in the sequencer and each pattern has 16 steps, you could then set steps 1 and 9 to play the kick drum sound and 5 and 13 to play the snare drum sound. Hit play (the A button) and you've got a basic drum loop!
- Okay, so if MeggySeq doesn't make any noise, what does?
At its core, MeggySeq is just a program for sending the numbers 1-8 over a serial connection. Something needs to be listening on the other end of that serial connection to actually play the sounds indicated by the numbers being sent. The MeggySeqListener program watches a serial connection for the numbers 1-8 and plays back files named "1.WAV" through "8.WAV" based on those numbers. It is designed to be loaded into an Arduino with a Wave Shield, which is then hooked up to headphones or speakers.
How to use MeggySeq:
Load the MeggySeq.pde source into your arduino development environment. Compile it and, with your Meggy connected and turned on, load it into the Meggy's memory. When it's done, your Meggy will reset and start running the MeggySeq program.
For learning how to use MeggySeq, it may help to turn on the serial monitor in your arduino development environment. Set the baud rate to 38400.
The Edit Screen:
The first thing you will see is the Edit Screen. This is where you edit patterns. It is also where you can start and stop playback and choose patterns to play or edit.
The AuxLEDs across the top of the Meggy screen display the number of the currently-selected pattern (1-8) and, if playback has started, the pattern that is playing.
Each pattern is made up of 16 steps. The top four rows of LEDs display the value of steps 1-8. The bottom four rows display steps 9-16. The blue bar at the top left shows the step that is currently selected for editing.
The Left and Right buttons will move the edit bar left and right through the pattern. Up and Down will change the value of the current step. At first the step is empty, and no dot will be lit up. Press Up once on an empty step and the bottom dot will light up yellow, indicating"1". Press Up again and it will move up, indicating "2," and so on. Values over 4 are indicated by a purple dot. To clear a step, hit Down until the dot disappears.
When you have a pattern made, you can press the A button to start playback. A green bar will start moving across the screen, highlighting the step that is currently playing. If you have the serial monitor turned on and your Meggy is connected to your computer, you should see numbers start to appear in the serial display. They correspond to the value of the step that is currently playing. "0" is a step with no value set, or silence.
When the playback bar reaches the end of the current pattern, it will jump back to the first step and keep playing. (This behavior can be changed later.)
While it's playing, press A to stop playback. Pressing A again will restart playback at the first step of the current pattern. To change patterns, hold down the B button and press Right or Left. The lit yellow AuxLEDs at the top of the screen will indicate which pattern is now selected. In this way you can move back and forth through the 8 patterns.
If you change patterns during playback, the first pattern will finish playing before the newly-selected pattern starts. (This behavior can also be changed later.) The green playback bar will only display when you are viewing the pattern that is currently playing.
Navigating to the Parameter Screen:
From the Edit Screen, hold down the B button and press Up.This will take you to the Tempo display in the Parameter Screen. To move to other parameters, press the Left and Right buttons.
<--BPM-Loop Length-Loop Start-Copy-->
B+Up (just B to get back)
B+Down (just B to get back)
Changing the Tempo:
The tempo starts out at 120 beats per minute. (For various reasons the tempo is not exactly what is displayed, but it's pretty close. See the design notes at the end of this document.)
On the Parameter Screen, during playback, the current step will be displayed as a moving dot at the bottom of the screen.
Press Up and Down to change the tempo. The maximum value is 199 BPM and the minimum is 45. If MeggySeq is currently playing your patterns, you should see and hear it speed up or slow down as you change the tempo.
MeggySeq can loop through patterns, letting you create longer, more complex compositions.
There are two parameters that control looping, Loop Length and Loop Start. Loop Length is the number of patterns to play, and Loop Start is the pattern at which the loop begins.
To change the loop parameters, move to the parameter screen and hit Right or Left until the Loop Length or Loop Start icons are displayed. Use the Up and Down buttons to change the value of the parameters.
By default, looping is disabled. Set the Loop Length to a value larger than 0 to enable looping. Set it back to 0 to disable looping.
When looping is enabled, the top row of LEDs will light up to indicate the patterns that will loop. For example, if Loop Length is set to 4 and Loop Start is set to 3, patterns, 3, 4, 5, and 6 will play continuously, one after the other. After pattern 6, pattern 3 will start again, and so on.
If looping is enabled, and you hit A to start playback while on a pattern not in the loop, that pattern will play first. When it finishes, playback will jump to the first pattern in the loop. For example, if Loop Length is set to 4 and Loop Start is set to 3, and you start playback on pattern 8, pattern 8 will play, and then patterns 3, 4, 5, and 6, and then pattern 3 again and so on.
One warning: Looping can be confusing, since if looping is enabled, the pattern displayed on the Edit Screen may not ever play. If you get lost, you can always disable looping by setting the Loop Length to 0.
To copy patterns from one slot to another, navigate to the Copy Screen. The number on the left is the pattern that will be copied to the pattern number displayed on the right. (The arrow indicates the direction.) If the first number is 0, it will clear the pattern on the right, setting all steps to 0. The number that is selected and you can currently change will be red, while the number you can't currently change will be dim green. You can use the Left and Right buttons to change your selection or to navigate out of the Copy Screen. Up and Down will change the currently-selected value. Pressing A at any time on the Copy Screen will perform the copy as selected immediately.
To leave the Copy Screen, you can either press B to go back to the Edit Screen or Left or Right to move to other parameters.
Saving and Loading:
From the Edit Screen, hold down the B button and press Down to go to the Save/Load Screen.
Warning: This will stop playback.
From here you can press Left and Right to choose saving or loading (indicated by the letters S or L on the left) and up and down to choose bank 1 or 2. Each bank can hold 8 patterns and all other parameters, like tempo, loop setup, and so on.
Pressing A will either save the current memory to the selected bank or will load the selected bank to current memory for editing or playback.
Banks are saved to the Meggy Jr's EEPROM, so they will not be erased even if you turn off your Meggy. If you've come up with some great beats and don't want to lose them, save them!
Pressing B will exit back to the Edit Screen.
(WARNING: If you've been using the EEPROM to store other things, note that this will nuke whatever's already in there!
Also, the EEPROM is only rated for 100,000 writes, so don't pound the save button unless you want to shorten the life of your Meggy's EEPROM.)
Setting Up Samples on a Wave Shield:
You need a set of 8 WAV files (or fewer if you don't want to have as many sounds, I suppose) on an SD card. They can be anything, of pretty much any length that will fit on the card.
Convert them to the right format and copy the files onto an SD card as described here:
For playback using the MeggySeqListener.pde program, they MUST be named "1.WAV" through "8.WAV". The caps are important. "1.wav" won't be found and won't play.
If you need a set of files you know will work, try Lady Ada's
I have also included a couple of sample sets in the zip file from the google code page.
The files should be in the root directory of the SD card, not in another directory on the card. Make sure the filenames are all upper-case.
To test it, you can load the MeggySeqListener into your arduino with the Wave Shield attached and turn on the serial monitor in your arduino environment. (Make sure the baud is set to 38400.) You should be able to type the numbers 1-8 into the input box and hit return and hear the sounds play back from the Wave Shield.
If you don't hear anything make sure that:
1. You have headphones or some kind of amplified speakers plugged into the Wave Shield (powered computer speakers should work for this).
2. The Wave Shield volume is turned up
3. No errors are showing up on the serial monitor
Connecting your Meggy to a Wave Shield:
Meggy Jr can send and receive data over serial. MeggySeq only sends. The default rate is 38,400 baud (which can be changed in the program). The listener must be set to the same baud rate for communication to work.
To build a cable, start building a MeggyLink cable, as pictured here:
One end must be what's described there. The other end should be able to attach to whatever you are using for a listener. For an Arduino and Wave Shield, you can use the handy jumper connections built into the Wave Shield circuit board:
Connect the RX connection on the Meggy to the TX connection on the Wave Shield, and vice-versa. The ground connection should go to the pin labelled "GND" on the Wave Shield.
(If you are building a cable for MIDI output, it's similar. I'm going to try to set this up next. Also, measure your wires better than I did so you don't end up with a random longer jumper like mine.)
Once the cable is built, make sure the listener arduino has power, connect the cable to Meggy and listener, and turn on your Meggy.
Enter some steps and hit play. You should hear your sounds.
- Since MIDI is just serial, it should be easy enough to modify the output to send MIDI notes rather than just numbers. I've marked those spots in the program. Building a MIDI cable is left as an exercise for the reader. Info:
- BPM is not quite accurate. (Although if you were one of the 3 or 4 people who downloaded version 1.0, it's much better now.)
- It might be nice to stop users from hitting the Save button more than once per visit to the Save screen.
Where to get samples?