Skip to main content

Notochord is a real-time neural network model for MIDI performances.

Project description

Notochord (Documentation | Paper | Video)

Max Ernst, Stratified Rocks, Nature's Gift of Gneiss Lava Iceland Moss 2 kinds of lungwort 2 kinds of ruptures of the perinaeum growths of the heart b) the same thing in a well-polished little box somewhat more expensive, 1920

Notochord is a neural network model for MIDI performances. This package contains the training and inference model implemented in pytorch, as well as interactive MIDI processing apps using iipyper.

Getting Started

Using your python environment manager of choice (e.g. virtualenv, conda), make a new environment with a Python version at least 3.10. Then pip install notochord.

For developing notochord, see our dev repo

Install fluidsynth (optional)

fluidsynth is a General MIDI synthesizer which you can install from the package manager. On macOS:

brew install fluidsynth

fluidsynth needs a soundfont to run, like this one: https://drive.google.com/file/d/1-cwBWZIYYTxFwzcWFaoGA7Kjx5SEjVAa/view

run fluidsynth in a terminal. For example, fluidsynth -v -o midi.portname="fluidsynth" -o synth.midi-bank-select=mma ~/'Downloads/soundfonts/Timbres of Heaven (XGM) 4.00(G).sf2'

Notochord MIDI Apps

Notochord includes several iipyper apps which can be run in a terminal. They have a clickable text-mode user interface and connect directly to MIDI ports, so you can wire them up to your controllers, DAW, etc.

The homunculus provides a text-based graphical interface to manage multiple input, harmonizing or autonomous notochord channels:

notochord homunculus

You can set the MIDI in and out ports with --midi-in and --midi-out. If you use a General MIDI synthesizer like fluidsynth, you can add --send-pc to also send program change messages.

If you are using fluidsynth as above, try:

notochord homunculus --send-pc --midi-out fluidsynth --thru

Note: on windows, there are no virtual MIDI ports and no system MIDI loopback, so you may need to attach some MIDI devices or run a loopback driver like loopMIDI before starting the app.

There are also two simpler notochord apps: improviser and harmonizer. The harmonizer adds extra concurrent notes for each MIDI note you play in. In a terminal, make sure your notochord Python environment is active and run:

notochord harmonizer

try notochord harmonizer --help to see more options.

Development is now focused on homunculus, which is intended to subsume all features of improviser and harmonizer.

Python API

See the docs for Notochord.feed and Notochord.query for the low-level Notochord inference API which can be used from Python code. notochord/app/simple_harmonizer.py provides a minimal example of how to build an interactive app.

OSC server

You can also expose the inference API over Open Sound Control:

notochord server

this will run notochord and listen continously for OSC messages.

Tidal interface

see notochord/tidalcycles in iil-examples repo (updated examples coming soon):

add Notochord.hs to your tidal boot file. Probably replace the tidal <- startTidal line with something like:

:script ~/iil-examples/notochord/tidalcycles/Notochord.hs

let sdOscMap = (superdirtTarget, [superdirtShape])
let oscMap = [sdOscMap,ncOscMap]

tidal <- startStream defaultConfig {cFrameTimespan = 1/240} oscMap

In a terminal, start the python server as described above.

In Supercollider, step through examples/notochord/tidalcycles/tidal-notochord-demo.scd which will receive from Tidal, talk to the python server, and send MIDI on to a synthesizer. There are two options, either send to fluidsynth to synthesize General MIDI, or specify your own mapping of instruments to channels and send on to your own DAW or synth.

Train your own Notochord model (GPU recommended)

preprocess the data:

python notochord/scripts/lakh_prep.py --data_path /path/to/midi/files --dest_path /path/to/data/storage

launch a training job:

python notochord/train.py --data_dir /path/to/data/storage --log_dir /path/for/tensorboard/logs --model_dir /path/for/checkpoints --results_dir /path/for/other/logs train

progress can be monitored via tensorboard.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notochord-0.5.7.tar.gz (74.0 kB view details)

Uploaded Source

Built Distribution

notochord-0.5.7-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

Details for the file notochord-0.5.7.tar.gz.

File metadata

  • Download URL: notochord-0.5.7.tar.gz
  • Upload date:
  • Size: 74.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for notochord-0.5.7.tar.gz
Algorithm Hash digest
SHA256 5f57c95c9f4d4083a1b3cdd2d7fca95d7ec39c1545aaebd4fce61070ce2651bb
MD5 5298af1e79ff065cbd42591875bec8ee
BLAKE2b-256 5ed90956038d507f526596e44e51ee8cc25f9f3267ca5c4b795d3c471c65bfdc

See more details on using hashes here.

File details

Details for the file notochord-0.5.7-py3-none-any.whl.

File metadata

  • Download URL: notochord-0.5.7-py3-none-any.whl
  • Upload date:
  • Size: 81.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for notochord-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7653531b8b1c3f2caa7818f0b60d3553d6f744212b5e78634399e017f5b343cc
MD5 d55ad77f4aa908162abe78b7e728b96c
BLAKE2b-256 b5c45359122c3913f76befd0c9f0ee0f3535776d42d1b693b5706989a5e616bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page