midigen
Python library for generating simple chord progression midi files
Installation
pip install midigen
Example usage
Command line
Play a ii-V-I-vi pattern in the key of G; loop it four times
midigen --key G --chords ii V I vi --loop 4 --play
Python
from midigen.notes import Note
from midigen.keys import Key, Mode
from midigen.time import TimeSignature, Measure
from midigen.sequencer import Song, Track, open_output
port = open_output()
# play C minor scale
Key(Note.C, Mode.Minor).to_track().play(port)
# make a simple ii V I vi chord progression in the key of C
key = Key(Note.C, Mode.Major)
time_signature = TimeSignature(4, 4)
tempo = 90
progression = [2, 5, 1, 6]
chords = Track.from_measures([
Measure.from_pattern(
pattern=[
key.relative_key(degree).chord(
# default chords are the base triad - try adding extensions
extensions=[7],
# pick a voicing close to the root triad
match_voicing=key.triad()
)
] * time_signature.numerator,
time_signature=time_signature,
velocity=90
)
for degree in progression
])
# play to port
chords.play(port, tempo=tempo)
# write the song to a MIDI file
Song([chords]).to_midi('midigen.mid', tempo=tempo)
Metadata
Release files for midigen 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| midigen-0.0.13.tar.gz | 159.0 kB | With provenance | Details for midigen-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| midigen-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for midigen-0.0.13-py3-none-any.whl |
Total release size: 316.5 kB
Release files / midigen-0.0.13.tar.gz
| Download URL | midigen-0.0.13.tar.gz |
|---|---|
| Size | 159.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50fdbc39afd486c5dc20b78638bd7835e9f7d4880b87b66bec28a663cbc4ed0d
|
|
BLAKE2b-256 checksum How to use checksums |
e616191d23fa8161d6222ad4c7d541aba710c95a88f934a7fbfbed25ed0f838d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2024.
Transparency logRelease files / midigen-0.0.13-py3-none-any.whl
| Download URL | midigen-0.0.13-py3-none-any.whl |
|---|---|
| Size | 157.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81262d9e0a296c05592bb68ad6a1af2b1e39401df93e384b24f5d88a54d4b751
|
|
BLAKE2b-256 checksum How to use checksums |
8b9e13a487d331d988c35fea451b7d98f190da66f32f0a2f22fbbf1e96850eda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2024.
Transparency logSecurity for midigen 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for midigen-0.0.13.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.