No project description provided
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file midigen-0.0.13.tar.gz.
File metadata
- Download URL: midigen-0.0.13.tar.gz
- Upload date:
- Size: 159.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50fdbc39afd486c5dc20b78638bd7835e9f7d4880b87b66bec28a663cbc4ed0d
|
|
| MD5 |
282f41ee766121bfa8d70d7049318ecc
|
|
| BLAKE2b-256 |
e616191d23fa8161d6222ad4c7d541aba710c95a88f934a7fbfbed25ed0f838d
|
Provenance
The following attestation bundles were made for midigen-0.0.13.tar.gz:
Publisher:
publish.yml on dbjohnson/midigen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
midigen-0.0.13.tar.gz -
Subject digest:
50fdbc39afd486c5dc20b78638bd7835e9f7d4880b87b66bec28a663cbc4ed0d - Sigstore transparency entry: 152658820
- Sigstore integration time:
-
Permalink:
dbjohnson/midigen@db25d82fac3cdd79dd0301353c650ec76993e449 -
Branch / Tag:
refs/tags/0.0.13 - Owner: https://github.com/dbjohnson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db25d82fac3cdd79dd0301353c650ec76993e449 -
Trigger Event:
push
-
Statement type:
File details
Details for the file midigen-0.0.13-py3-none-any.whl.
File metadata
- Download URL: midigen-0.0.13-py3-none-any.whl
- Upload date:
- Size: 157.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81262d9e0a296c05592bb68ad6a1af2b1e39401df93e384b24f5d88a54d4b751
|
|
| MD5 |
4c3aea31d06a59579b618b655f8f9cda
|
|
| BLAKE2b-256 |
8b9e13a487d331d988c35fea451b7d98f190da66f32f0a2f22fbbf1e96850eda
|
Provenance
The following attestation bundles were made for midigen-0.0.13-py3-none-any.whl:
Publisher:
publish.yml on dbjohnson/midigen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
midigen-0.0.13-py3-none-any.whl -
Subject digest:
81262d9e0a296c05592bb68ad6a1af2b1e39401df93e384b24f5d88a54d4b751 - Sigstore transparency entry: 152658821
- Sigstore integration time:
-
Permalink:
dbjohnson/midigen@db25d82fac3cdd79dd0301353c650ec76993e449 -
Branch / Tag:
refs/tags/0.0.13 - Owner: https://github.com/dbjohnson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db25d82fac3cdd79dd0301353c650ec76993e449 -
Trigger Event:
push
-
Statement type: