models icon indicating copy to clipboard operation
models copied to clipboard

Programmatically control Elektron's model:cycles & model:samples via midi using Go

drawing drawing

Go Reference

elektron:models

Go package to programmatically control Elektron's model:cycles & model:samples via midi.

Prerequisites

Go

Install Go https://golang.org/doc/install.

RtMidi

Ubuntu 20.04+

apt install librtmidi4 librtmidi-dev

For older versions take a look here.

MacOS

brew install rtmidi

For more information see the formulae page.

Windows

Help needed.

Quick Use

A complete example can be found in the example folder.

The relevant cycles/samples manuals' part for this library is the APPENDIX A: MIDI SPECIFICATIONS.

drawing drawing

Code to get a single kick drum hit at C4 key, with velocity set at 120 and length at 200 milliseconds:

package main

import (
	"time"

	m "github.com/bh90210/models"
)

func main() {
	p, _ := m.NewProject(em.CYCLES)
	defer p.Close()

	p.Note(m.T1, m.C4, 120, 200, m.PT1())
	time.Sleep(200 * time.Millisecond)
}

There are four Free methods to use, Preset to set preset on the fly, Note to fire a note on/off for given duration, CC to send a single control change message && PC for program changes.