Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Zeus Commander SPS-16, MIDI step & pattern sequencer

  1. #1
    Senior Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    138

    Zeus Commander SPS-16, MIDI step & pattern sequencer

    Click image for larger version. 

Name:	Zeus-Commander-SPS-16_F#2.jpg 
Views:	6 
Size:	107.8 KB 
ID:	15735

    The currently available MIDI step sequencers provide little or limited control and feedback of the step parameters (pitch, velocity, note length and timing) and to keep the cost down all kind of compromises are made with respect to component choice and device layout and size. This is where DIY comes in, with the currently available tools (like the Teensy) and services (frontpanel and pcb manufacture) is possible to design and build devices that are not only tailor made for the purpose at hand but can also compete with commercially available products with regards to build quality and finish.
    The goal was to create a traditional step & pattern sequencer that uses motorfaders to set and recall the step parameters for patterns. The venerable ARP sequencer already used sliders/faders for setting a single parameter, nowadays there are several devices available using traditional faders but as far as I know there’s no device available that uses motorfaders. In think motorfaders are perfect for use with a sequencer as they allow for quick and precise positioning and provide feedback at the same time. Contrary to knobs it’s easy to move multiple faders using both hands, this is great for, among other things, playing with the accents (velocity) while the sequencer is running. Faders are also a natural fit for displaying step parameters like pitch, velocity, length and timing.



    Design rationale
    Control over step timing was especially important to me. Timing should not be limited to a fixed grid, it should be possible to freely shift note events around on the grid using the faders and also to set a tempo divisor per pattern. The central timer uses MIDI clock ticks (for easy external synchronisation) and events are timed in clock ticks expressed as a floating point value allowing for events between clock ticks. Event times are calculated in milliseconds if they fall between clock ticks. Note off events are always handled using simple millis() timing allowing for flexible adjustment of note length (5% - 100% of step length).
    As I’m still learning when it comes to C++ I wanted to avoid interrupt based timing as I’m not sure I can make this work with all the other stuff that needs to be handled (like reading faders and switches) so I figured that as long as all the functions take significantly less then a millisecond it’ll be OK and the timing may be off by a millisecond or two now and then but I can live with that.
    Micros and millis timers are used to time the actions, there are separate timers for reading faders, switches and updating displays and LEDs, only the main sequencer code is in the loop. I tried to set the timing so that actions don’t happens at once and there’s always room for main sequencer routine.

    The sequencer model is contained in a structure of structs, there are no pointers used in this structure so copying patterns and saving programs is easy. All the main properties (number of channels, patterns per channel, steps per pattern etc.) are defined in constants and can be adjusted to fit a particular design. My current implementation has:
    - 6 parameters per step (pitch, velocity, length, timing and two assignable MIDI controllers)
    - 16 monophonic steps per pattern
    - 16 patterns per channel
    - 8 channels per program in two groups of four
    - 64 programs stored on the onboard micro SDcard
    Each pattern has the properties:
    - Length, number of steps in the pattern
    - Repeat, the number of times a pattern is repeated 1-16
    - Next, pattern to follow after last repeat 1-16
    - Tempo, tempo divisor, 16 options in list.
    - MIDI note channel, channel for note events.
    - Two assignable MIDI controllers, selectable by name (e.g. "P6 LP Cutoff “) from a list, can have separate MIDI channel.
    The button matrix can display and edit:
    - Steps for four channels, the display next to the row will show the current pattern number
    - Patterns for four channels, the display will show the number of repeats to go.
    - Patterns & Steps for channels A & B
    - Patterns & Steps for channels C & D
    The button matrix is also used for data entry. For example, when the MIDI button on the control panel is pressed the matrix will display the current MIDI channel for four sequencer channels and MIDI channels can be selected by pressing on of the buttons in the matrix.
    The 16 character display next to the tempo knob shows the MIDI channel alias name (instrument) for the selected channel and the tempo to one decimal place. A high resolution optical rotary encoder is used for setting the tempo. When the ‘CTRL A’ or ‘CTRL B’ parameter select button are pushed and held the display will show the selected controller and allow selection from a list using the rotary encoder. The selected controller definition contains the type (standard MIDI, NRPN, sysex), number, min/max values and MIDI channel.
    All parameters can be adjusted while the sequencer is running, a special ‘prepare mode’ makes it possible to select patterns for editing without interrupting the pattern play order. Patterns can be chained by using the ‘repeat’ and ‘next’ properties, it’s possible to quickly create a chain by simply pressing the pattern buttons on the matrix. When the sequencer is running the ‘next’ can be overridden using the button matrix allowing switching between (chains of) patterns on the fly. Patterns, columns and rows (=channel) can also be copied and pasted while the sequencer is running.

    This sequencer is not intended as a DAW replacement but as an instrument unto itself for creating musical patterns from scratch and manipulating patterns in real time. It doesn’t try to do ‘everything’, it just does a couple of things really well.


    Components
    High quality components were used for the interface because I think that the quality of a device rubs off on the things you do with it, if a device feels crappy then everything you do with it will get a flavour of crappyness added to it. I especially don’t like these wobbly silicone buttons that are all over the place nowadays, they don’t have a well defined pressure point and you can’t run your fingers over them without worrying to accidentally push one because they wobble all over the place. Sure they have RGB LED below giving a lot of flexibility for feedback (and function overloading) but you end up having to look at hem to check if you actually pushed the button.
    The C&K Digitast series switches have a very precise pressure point and tight feel to them, there no question wether or not you pushed them and they also don’t need a relay to make a nice clicking sound like with the Mackie control units. The bounce time of the switches is specified as less then 2.5ms. See this thread for the shift register story: 74HC165 shift register revisited.
    The idea was to create an old school step sequencer so I wanted to avoid using LCD displays, before you know it you’ve created a computer with a tiny screen in stead of an instrument. The refresh of the displays needed to be very fast, under a millisecond, to be useful for the approach I had chosen. The Avago / Broadcom LED displays fit the bill, the four digit displays can show the note with a decent letter and # like “A#3”. The readability is excellent as there’s not really a viewing angle, if you can see them you can read what’s on them. The key phrase here is ‘at a glance’, you don’t really have to look like with an LCD or OLED display, a quick glance is enough. There’s one significant drawback though, they’re bloody expensive.
    To clearly indicate the active step I wanted a LED bar the with more or less the width of the step and not just a single LED. The LED bars contain four LEDs in series and are controlled by a TLC5940 chip (Sparkfun breakout board). The LED bars get their power from the 10V motor supply. The active step is displayed bright and the accents for the current metre are displayed dimmed.
    The faders are 100mm ALPS RSN type touch sensitive motorfaders. They are very fast, a 100ms full power burst will send them to the opposite side. Speed is important because we’re talking parameter recall here, switching fast between different parameters and patterns, waiting just half a second for the faders to settle would become annoying very quickly. I used full size 100mm faders to make it easier to set the pitch for as step, the range currently is 5 octaves form C0 to C5. The development of the motorfader control is described in this thread: Teensy controlled motorfader panel. The PID control still needs some tuning, during ‘link mode’ the faders following the master are sometimes ‘finding their spot’ and move a little but around. This doesn’t affect the operation because when in link mode the linked faders only act as displays, the actual values are set relative to the fader that is being moved.


    Layout
    The form follows function and used components. The faders shouldn’t be to close together and there should be a small gap between the step displays so the spacing is 1” (25.4mm). The spacing for control panel switches is a little less, 9/10”. The control panel switches are placed in two groups and different colours are used to make it easier to find the right switch without really looking. The important functions all have dedicated buttons, there’s a shift button for modifying behaviour but there’re no menu’s and no need for multiple clicks to access a function. The end result is a rather large device 69cm wide and 37cm deep. I didn’t try to make it smaller, I even added a palm rest (aluminum with birch ply cover because aluminium feels cold to the touch). It is what it is.


    Code
    There’s still plenty of refactoring to be done but most of the functions are there and everything seems to be working. Of course there are still bugs and things I didn’t account for with respect to interface behaviour, refresh and things like that. There are a lot of different operating modes and consequently there’re a lot of different state transitions to handle. Fortunately Reaper (DAW software) doesn’t even complain if a new sketch is uploaded to the Teensy, Logic Pro just reports that a port is missing and that it’s back again, this makes it easy to apply changes to the code to quickly fix little bugs, add controller definitions and so.
    When the code has settled it will become more clear what functions would be candidates for methods in classes yet to be defined. I tried to structure the code best as I could using meaningful variable names and adding plenty of comments. Suggestions for improving the code are always welcome.

    Zeus_SPS-16_Master_190120.zip


    Picture of the build:

    Control board with all components, completed control module, fader module with PCB’s.


    Click image for larger version. 

Name:	Control_pcb_buttons.jpg 
Views:	8 
Size:	151.6 KB 
ID:	15739Click image for larger version. 

Name:	Zeus-SPS-16-Control-panel.jpg 
Views:	10 
Size:	100.0 KB 
ID:	15738Click image for larger version. 

Name:	FaderPanel_rear_1.jpg 
Views:	11 
Size:	141.4 KB 
ID:	15740

    Fitting components:

    Click image for larger version. 

Name:	Zeus-SPS-16_frame.jpg 
Views:	9 
Size:	113.1 KB 
ID:	15736

    Rear view with power entry module and connectors in place:

    Click image for larger version. 

Name:	Zeus-SPS-16_rear-view.jpg 
Views:	10 
Size:	57.9 KB 
ID:	15741

    Wired PSUs, fader panel, step displays and control panel operational.

    Click image for larger version. 

Name:	Zeus_psu_view.jpg 
Views:	11 
Size:	140.7 KB 
ID:	15737

    The strip board with the two MIDI in / outs is from from earlier Arduino Due test project, I figured I might as well put it in just in case, it’s not connected yet. The two TRS jack and the USB host are also there for later use and not connected yet. The two DAC outputs of the Teensy are available on headers on the main board, I may use them for simple CV output (just modulation, not pitch).


    The big kick
    For his project I learned to use KiCad and I designed the schematics and pcb layout for six pcb’s, this involved creating schematic symbols and pcb footprints of component like the Digitast switches and the ALPS motorfaders. I designed the front panels using the Schaeffer ‘Front Panel Designer’ to match the pcb layouts. The PCBs and frontpanels were fabricated and, lo and behold, everything fits and works :-) The best thing is that it’s actually a really great sequencer, the amount of control you have over the step parameters allows you to do things that you can’t do or just don’t come up with on a keyboard or any other sequencer.
    Now I have to play with it, a lot :-), to find out what works, what doesn’t and what would be nice to add.
    Last edited by Gerrit; 01-26-2019 at 06:34 PM.

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,045
    Awesome. Striking retro look and an impressive set of features to integrate into one project.

    So few large MIDI projects here seem get out of initial design while yours has a sequencer on top of a everthing else.

  3. #3
    Senior Member
    Join Date
    Jan 2017
    Location
    Maastricht
    Posts
    138
    Quote Originally Posted by oddson View Post
    Awesome. Striking retro look and an impressive set of features to integrate into one project.

    So few large MIDI projects here seem get out of initial design while yours has a sequencer on top of a everthing else.
    Thanks

    I used the motorfader test setup to develop the sequencer engine and display control up to a point where I was confident enough that this was going to work. For example, the LED display library was to slow for my purposes, updating 32 characters on the test setup took 20ms. By using parts of the library code and changing the way the refresh of the display is handled and by replacing the shiftOut() function with a function that uses digitalWriteFast() I managed to get the refresh time for 96 characters down to 470µs. Now a display refresh would no longer through off the timing of the sequencer.

    I noticed that I forgot to include hyperlinks for the shift register and motorfader panel threads, here they are:

    SN74HC165 Shift register revisited

    Teensy 3.6 controlled motorfader panel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •