Using CLAUDE AI to write notation software

I’ve been experimenting using the AI system CLAUDE to create AN scores from MIDI files.
It uses tonejs/midi and D3.js to create a webpage that does it all.  But you don’t need to know any of that.
You can get started for free, but you will need a $20/mo “pro” subscription to get very far.
So far, I’ve created Klavarskribo-like score from a midi file.

I did what amounts to a Klavarskibo score creator in about an hour.  This is the prompt I used to get started.

ME: I want to write a d3.js program to build a custom-notation score from a midi file

CLAUDE: I’ll build this as a single self-contained HTML file. A default notation is included, with the notation rules isolated in one config block so you can replace them with your own.

I’ve written midi-score.html, a single page that loads a MIDI file and draws it with d3. I haven’t tested it against a real MIDI file; the built-in demo loads on open and renders the same way.

You didn’t say what the notation should look like, so I made up a default. Replace it with your own.

How it works

Parsing: @tonejs/midi reads the file, and modelFromMidi() turns it into a plain model of notes (pitch, start in ticks, duration, velocity), plus the time signature and ticks per bar.
Layout: the score wraps into lines of N bars, like staves. Each line has one row per semitone, and beat and bar lines are drawn on top.
Default notation:
Pitch class sets the colour.
Velocity sets the head size.
A tail shows duration.
Notes on a bar’s first beat are squares, and C’s are hollow.
Black-key rows are shaded.
Controls: drop a .mid file or click to choose one, set bars per line, change beat width, and pick a track. Hovering a note shows its pitch, velocity and duration.

Customising the notation: everything that defines it sits in the NOTATION object at the top of the script. That covers row height, colours, which rows are shaded, and drawNote(), which draws each note’s shape. If you want something other than semitone rows (a circular layout, a pitch-class grid, a different time axis), the changes go in render(), in the note x/y and the grid.

The time-signature and tempo handling is simple: it uses only the first time signature and ignores tempo changes. Tell me what your notation should look like and I’ll rework it to match.

Midi score [file]
Code·HTML [file]

END OF CLAUDE RESPONSE

I continued with prompts to modify the staff, add Aiken shape-note heads and stems, and get a print-out. I spent maybe 4 hours over two days and created the following scores. One is a hymn, Old Hundredth; the other is Bach Prelude 1 from WTC.

Leave a Reply

Your email address will not be published. Required fields are marked *