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

Thread: Teensy 4.1 as midi sequencer?

  1. #1

    Teensy 4.1 as midi sequencer?

    I was finally able to find a Teensy 4.1 and after looking at the existing projects I was curious if anyone tried this.

    I saw some synth projects based on the Teensy, although I am not interested in it producing sounds only, but more interested in how could I use it as companion for a synth that does not have an onboard sequencer for example.

    The SD card would be able to hold midi data and all the logic required to store patterns and other midi data, while the connections should be enough to get a midi 5 pin DIN port and a usb host port to connect devices and send midi/receive midi from a master keyboard or other sort of device. A LCD is also something I want to add to the project; and I can use just few buttons or rotary encoders to navigate the functionalities. Since this would be just used to record midi data and play it back, I am pretty confident that the UI and physical controls can be kept to a minimum.

    As far as getting started, I am looking to learn how to
    - read and send midi data
    - make a ui that can be displayed on a small (2-4 inches) screen
    - use controls to translate signals like button press and encoders to midi events

    Ideally if there is a similar project I can use as starting point that would be even better, but I am willing to learn piece by piece. The challenge is just that I don't know where to start. I am pretty decent at coding but with limited hardware experience for sure. Any guidance would be really appreciated

  2. #2
    Guess there is no interest in such usage for the Teensy? Still searching for something to use as starting point but I guess I can start getting a simple UI running with micropython maybe. That should be simple enough to start prototyping.

  3. #3
    For some reasons I can't see the replies I got via mail, but thanks for suggesting Vimana and Microdexed! They both seem quite advanced and solid; not sure if I have the right skillset to take those projects and simplify them for my needs, but it is a great starting point.

    I actually like the idea of having a tracker interface like the Microdexed and the features in the Vimana like the euclidean pattern generator. As far as user case, I would like to hook it up to an instrument and record from it; as I would do if I had a standard 16 steps sequencer and arpeggiator; because that instrument does not have either. Then I thought that since I am there, I can maybe add more than just 16 steps and one channel, because the instrument has poliphony, so it can output more than just one note. And then since I have the ability to record one track, I can probably record more, taking the midi signal from other instruments, but that is more of a stretch goal to be honest... The main point for me to make a sequencer is to use it on instruments that does not have one

    I will start experimenting with the source code; got the audio shield already and the screen, so I just need some buttons and encoders to start with the interface. I'll be sure to check the github repos for those 2 projects and see if I can learn how those features I am interested in were written. Cheers!

  4. #4
    Junior Member
    Join Date
    Oct 2020
    Hey! I am working on MIDI Sequencing with the Teensy for some time and just finished my first “professional” prototype a few days ago. Still unsure what Display I use. started with the 320x240TFT but had performance issues, switched to an OLED that does a little better and yesterday found the issue that has to do with how the Data from the INPUT is read, so will try to move back to the TFT for more UI Space.

    Reading and writing MIDI is not much to learn about. The MIDI Example and the usbMIDI info on the pjrc page tells you more or less everyhing you need, from how to setup the code to how to build the MIDI DIN Port.

    The part of sending and receiving MIDI data is a very small amount in a Sequencer Project. Data management and UI is a way bigger part. I wrote one object that I hand notes to play to, that is updated every pulse (I have 6 pulses per 32th note) that handles noteOn and noteOff events (evaluating when to stop the note, that I store with a length in my data). There is one place that sends the midi transport data on start, stop and on click ticks, one place in my code that sends program changes when needed and a few that trigger controlChanges for modulation.
    Setting up your data to be able to do all this is way more complex. Calculating modulation based on math without having it take too long, calculating probabilities based on what the user setup, getting all the LFOs, Modulation-Data from drawing curves on my Button-Grid etc. together to that one value you need to send to the synthesizer is what takes up time.

    I added 16Mb RAM to my Teensy 4.1 to be able to store as much data as possible without having to access the SD Card. I have no dynamic allocation of memory in that sequencing-related data. Currently I am 16 tracks, 16 patterns per track, 256 steps per pattern, 8 independent notes per step (not having all notes share he same length, velocity, probability like Elektron, Novation etc.) 4 LFO, an Arpeggiator, a Notes-to-scale quantizer, 8 modulation lanes and a few configuration settings for S&H modulation. Every Note has its own Note-Value, Length, Velocity and Propability. Tracks manage midi ports (have 4 USB and 3 DIN currently) as well as the Midi-Channel and type (I differ between Melody and Drum Tracks mostly for UI purposes, as you can setup 8 drum lanes per track with independent MIDIPort/Channel and Note-configurations). Patterns manage Program Changes, Length (1-256 steps), Resolution (Length of every step from 1/1 to /32th note) and play-direction. currently thst data structure takes up around 2.4MB of Ram, that lets me enhance this to 32 tracks and 16 patterns without hitting the limitations of Memory.
    most of my coding time goes into the UI, second data-structure and algorithms. Most complex part was getting all that data-access tight as it’s done quite often (pulses are triggered from a Hardware-Timer that ticks often enough to get a tight midi clock even with 400+ BPM as well as managing LFOs. you don’t want to call sinus-functions every pulse. I pre calculate the timing of the values and just access that table during playback. that’s precalculation is fast enough to be instant in UI -workflow but might take up too much time to be done every pulse.

    to the Hardware: I use Neo Trellis For the 16x8 Matrix, 24 mechanical keys as well as 8 encoders for the User-Input. there os a Raspberry PI Pico on the Board that handles the mechanical buttons and encoders and sends the data over serial to the Teensy. 128button grid is accessed via I2C (that’s way to slow to have fun playing live on it so I am currently thinking bought building this myself) and Display is filled via SPI, so port-wise the Teensy is highly under-utilized.

    This is at least the 10th hardware attempt since I bought the Neo Trellis Stuff End of 2019, so even if it looks inspired by the hapax, the first UI Concept (that did not work, because I tried to build the PCBs myself) is from end 2020/start 2021 and was more inspired by the Deluge and my idea to combine the Deluge Grid-Workflow with the UI concept of Elektron Boxes.

    This actual version is around 7000 lines of code of which more than half go into UI and tones of constants with configuration values and I spent a high 2-digit number of hours into PCB design (as it was my first PCB I designed with way to little knowledge about electronics) and an unknown amount of hours in PlatformIO!

    Click image for larger version. 

Name:	IMG_5095.jpg 
Views:	5 
Size:	139.5 KB 
ID:	29071

    Making images of the display is bad, as the frequency tends to never show everything
    Last edited by Uija; 07-31-2022 at 04:54 AM.

Posting Permissions

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