Ernest Micklei's Blog

things I create and problems I solve, to remember and share

Midicycles: visualizing MIDI in polar space

midicycles is a small tool written in Go that visualizes incoming MIDI notes. It was originally created to both hear and visualize output from Melrōse programs, but it also works with any MIDI source. The project is simple to start and flexible to tune. On startup it opens one or more MIDI input ports and renders note activity in near-real time. Why this is fun When composing with loops and pattern transforms, listening is essential, but seeing timing and note distribution pleases the brain.

MCP Server

melrose-mcp is a tool that uses the MCP protocol to receive melrōse expressions to play. You install this tool locally on your machine and connect it from an MCP client such as Claude Desktop, Goose, VSC etc. example Prompt: play a tune from Claude Debussy AI: I'll create a small segment inspired by Claude Debussy's impressionist style using the Melrose language. MCP server: { `expression`: `sequence('(F4 A4 D5) 4(F4 A4 D5) (G4 B4 E5) 4(G4 B4 E5) (A4 C5 F5) 4(A4 C5 F5) (G4 B4 E5) 4(G4 B4 E5) (F4 A4 D5) 8= 8(E4 G4 C5) 4(F4 A4 D5)')` } See melrose-mcp for details how to install and use it.

Introducing 'map'

The function map is used to create a composition by applying a transformation on each sequence in a collection. 1 2 3 4 5 6 7 a1 = sequence('G_3 D_ G_ A D_5 G_5') a2 = sequence('D_3 A_3 D_ E A_ D_5') a3 = sequence('E3 B3 E A_ B E5 ') a4 = sequence('B2 G_3 B3 E_ G_ B') c = map( join(a1,a3,a4,a2), fraction(8,resequence('1 4 2 4 3 6 5 4', _ )) ) loop(c) line 1.

More Drum Patterns

Using the notemap function with dots . and bangs ! you can write a pattern for an instrument. In this example, multiple instruments are choosen from the General MIDI set. The note C2 is typically assigned to a Kick drum. The loop plays the 16 beats in a bar and for each bang ! it will shortly (16th) play the note. You can start and stop each loop individually. Once you have a MIDI capable sound program (such as a DAW) opened then tryout this example with the online Melrōse Playground yourself.

Drum Pattern

This script is an example that uses the Melrōse language to create your own drum beats. Line by line, I will explain how it is composed. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 bpm(85) // https://usermanuals.finalemusic.com/SongWriter2012Win/Content/PercussionMaps.htm open = midi(16,46,60) close = midi(16,42,60) clap = midi(16,39,60) kick = midi(16,36,80) d1 = notemap(' 3 10 11',open) d2 = notemap('4 12',close) d3 = notemap('5 13',clap) d4 = notemap('1 2 4 7 9 10 12 15',kick) d5 = notemap('16',note('16=')) // 1/16 rest at the end to make 16 notes in the set set = merge(d1,d2,d3,d4,d5) lp_set = loop(channel(10, set)) // channel 10 is the general midi for a drumkit 🎶 Play

Iterating over patterns

1 2 3 4 5 6 7 8 9 bpm(90) s = sequence('c e g b') i = iterator( '(1 2) (3 4)', '(1 3) (2 4)', '1 (2 3) 4', '(1 4) (2 3)') m = resequence(i,s) l = loop(m,next(i)) 🎶 Play Using resequence you can compose a new sequence with index-based entries. The first compostion played by the loop is (C E) (G B).

DAW - Apple Logic Pro X

Logic Pro is a product of Apple Inc. Goal Logic Pro is a professional Digital Audio Workstation (DAW) available for Apple Mac OSX. Melrōse can communicate with Logic Pro by sending MIDI messages. Logic Pro has a rich set of sounds and instruments to play MIDI notes. In addition, Logic Pro is able to play multiple MIDI channels simultaneously which can be programmed individualy by melrōse. This article describes the steps to get Melrōse working with Logic Pro such that you can play your melody per-channel.

DAW - Apple Garageband

GarageBand is a registered trademark of Apple Inc. Goal Garageband is a simple Digital Audio Workstation (DAW) that comes with the standard installation of Apple Mac OSX on devices such as MacBook or MacPro. Melrōse can communicate with GarageaBand by exchanging MIDI messages. GarageBand has a rich set of sounds and instruments to play MIDI notes. This article describes the steps to get Melrōse working with GarageBand such that you can play your melodies.

protocheck: Lightweight Protobuf Validation in Go

For Go developers working with Protocol Buffers, ensuring data integrity is crucial. While Protobufs guarantee type safety, they don’t enforce semantic rules out of the box. This is where protocheck comes in, a lightweight and powerful tool for adding validation logic to your Protobuf messages. This blog post will explore the design choices behind protocheck, focusing on its simplicity of declaration and code generation. We’ll also compare it to bufbuild/protovalidate to help you choose the right tool for your project.

The Growing Developer

Why you want this and how to become one 10-15 minutes read This article is part of a series that began with The Replaceable Developer. That article examines how developers can prevent their current work from hindering their professional growth. TL;DR Growing your skills will open doors to new challenging opportunities, which in turn can lead to making a bigger impact and, with promotions, a higher salary. The TEC model is a structured approach for achieving this.