Skip to main content

This package generates a PrettyMIDI object from Array of Array. Here is a sample code.

import mdpw
a = ['s',['n',64,1,64,1],['n',68,1,64,1],['n',71,1,64,1],
   ['c',['n',64,1,64,1],['n',68,1,64,1],['n',71,1,64,1]]]
mdpw.compile(a, 120).write("hello.mid")

‘n’ means a note and followed values are pitch, duration, velocity and instrument. The instrument 129 means Drum. ‘s’ means to play sequentially and ‘c’ means to play simultaneously.

Here is anther sample code.

from mdpw import INSTRUMENTS as I
from mdpw import DRUMS as D
from mdpw import note, seq, chord, compile
dph = D['PedalHi-Hat']
i = I['Drum']
hh = ['s',['n',dph,1,127,i],['n',dph,1],['n',dph,1],['n',dph,1]]
b = seq(note(64,.5,0,I['ElectricBassPick']),note(64,1,127),note(64,1),note(64,1))
m = chord(seq(hh,hh,hh,hh),seq(b,b,b,b))
compile(m, 120).write("sample.mid")

In fact, the functions ‘note’, ‘seq’, ‘chord’ return arrays.

You can generate a round chant like this:

import mdpw
from mdpw import note as n
from mdpw import seq as s
from mdpw import chord as c
from mdpw import compile

m0 = s(n(64,1,64,17), n(66), n(68), n(69), n(68),n(66),n(64),n(0,1,0))
m01 = s(n(64,.5,64,17),n(64), n(66), n(66), n(68),n(68), n(69),n(69), n(68),n(68),n(66),n(66),n(64,1),n(0,1,0))
m1 = s(n(68,1,64,17), n(69), n(71), n(73), n(71),n(69),n(68),n(0,1,0))
m2 = s(n(64,2,125,17), n(64), n(64), n(64))
a = s(m0, m1, m2,m01)
r = n(0,8,0,1)
a =c(a, s(r, a), s(r, r, a))
mdpw.compile(a, 120).write("frog.mid")

Metadata

Release files for mdpw 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdpw 0.0.3
File Size Uploaded Provenance
mdpw-0.0.3.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mdpw 0.0.3
File Interpreter ABI Platform
mdpw-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / mdpw-0.0.3.tar.gz

Download URL mdpw-0.0.3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2603ac7fded04c7ba47a4e7fa985d9520686cc79d9c4bb02663464bd6bc28e7b
BLAKE2b-256 checksum
How to use checksums
a940862612ce80fe9dc13c9ac9858308092b9353c8bc45614fd84d179a3c11e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

Release files / mdpw-0.0.3-py3-none-any.whl

Download URL mdpw-0.0.3-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5783e8410a2dd34e37136aac470ae2b63b07779e67213caf1f2bbd56ff16ef3a
BLAKE2b-256 checksum
How to use checksums
bb0abee4dc581ffc6009b22e0337af4abead794493f1cbbdef2bd13b824a6bd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.2

Security for mdpw 0.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page