Infinite Playground Logo

Analog Pixel

Noodling with Midi

Sometimes I'm on a computer that doesn't have a full DAW, and just want to fool around with a midi keyboard; use the keyboard as a simple piano to noodle around with some simple riffs. While searching around for programs to just play some sound when a midi event comes through, I came across: AU Lab from apple. It is a free program that allows you to just play some sounds on your midi instrument. (yes, I could use garage band, but it's slow, and makes my fan run.)i

Now that I had the ability to play some sounds, I wanted a way to capture the notes being played so If I made some sounds I liked, I could go back and replicate them. the simplest way was this python program I wrote:

#!/usr/bin/env python

import mido

print( mido.get_input_names() )

def midi_note_to_name(note_number):
    notes = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
    octave = (note_number // 12) - 1
    return notes[note_number % 12] + str(octave)

with mido.open_input("nanoKEY Studio KEYBOARD/CTRL") as inport:
    for msg in inport:
        if msg.type == 'note_on':
            note_name = midi_note_to_name(msg.note)
            print(note_name, ",", end="", flush=True)

That works well for catching notes, but the goal of all of this is to play simple riffs on the piano and then transfer them over to the guitar, and since I don't have all the notes and octaves memeorized this was slowing me down, so I wrote a little website that shows you the notes you are playing on the guitar as you play them on your midi keyboard:

midifretboardscreenshot

you can play with it here

note : webmidi is weird; if it doesn't work, you can save the file local, run python -m http.server and then connect to localhost:8000 and run it. And even then, webmidi will only work on localhost or an https session ¯\_(ツ)_/¯


guitar midi music 2024-01-11 #

Home