Skip to content

Repository files navigation

sketchtune

CI License: MIT Python

A tiny Python toolkit for sketching musical ideas fast. Go from a scale and a feel to a MIDI file — or a rough audio render — in a handful of lines, without booting up a DAW.

It grew out of my own scratchpad: I kept rewriting the same "give me a Euclidean pattern in D dorian and bounce it to MIDI" snippet, so I turned it into something reusable.

Install

pip install sketchtune

Or from a checkout:

pip install -e .

The only runtime dependency is NumPy (used for audio rendering).

Quickstart

from sketchtune import Scale, Rng, random_walk, euclidean, from_pattern, write_midi

scale = Scale.from_name("D", "dorian")
notes = random_walk(scale, 16, rng=Rng(42))       # 16 in-scale pitches
seq = from_pattern(notes, euclidean(11, 16), step=0.25, tempo=110)
write_midi(seq, "sketch.mid")                      # drop into any DAW

Want to hear it without leaving Python?

from sketchtune import render_to_wav
render_to_wav(seq, "sketch.wav", waveform="triangle")

What's in the box

  • Scales & modes — church modes, pentatonics, blues and whole-tone, with degree() lookups and snap() to pull stray notes back into key.
  • Rhythms — Euclidean patterns via the Bjorklund algorithm, plus weighted probabilistic step sequences.
  • Chords — chord qualities, inversions, diatonic triads and roman-numeral progressions (ii V7 I).
  • Melodies — scale-aware random walks, motif-seeded Markov chains and arpeggios.
  • Export — a hand-written Standard MIDI File writer and a small offline synth that renders to WAV.
  • Reproducible — every generator takes a seed, so a good accident stays good.

Command line

sketchtune euclid 5 8
sketchtune chords C major --roman ii V7 I
sketchtune melody A minor_pentatonic --length 16 --seed 3 --out idea.mid
sketchtune render C lydian --length 24 --out idea.wav

Documentation

License

MIT — see LICENSE.

About

a generative music toolkit in Python for creative composition: scales/modes, euclidean & probabilistic rhythms, chord and melody generators, and export to MIDI + rendered audio, for sketching musical

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages