mdpw


Namemdpw JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttp://github.com/cwbp/mdpw
SummaryGenerate MIDI file from Array of Array data.
upload_time2024-06-29 10:25:39
maintainerNone
docs_urlNone
authorcwbp
requires_pythonNone
licenseMIT
keywords midi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            MDPW
====
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")







            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/cwbp/mdpw",
    "name": "mdpw",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "MIDI",
    "author": "cwbp",
    "author_email": "cwbp@cwbp.com",
    "download_url": "https://files.pythonhosted.org/packages/a9/40/862612ce80fe9dc13c9ac9858308092b9353c8bc45614fd84d179a3c11e5/mdpw-0.0.3.tar.gz",
    "platform": null,
    "description": "MDPW\n====\nThis package generates a PrettyMIDI object from Array of Array. \nHere is a sample code.\n:: \n\n import mdpw\n a = ['s',['n',64,1,64,1],['n',68,1,64,1],['n',71,1,64,1],\n    ['c',['n',64,1,64,1],['n',68,1,64,1],['n',71,1,64,1]]]\n mdpw.compile(a, 120).write(\"hello.mid\")\n\n\n'n' means a note and followed values are pitch, duration, velocity and instrument. The instrument 129 means Drum.\n's' means to play sequentially and 'c' means to play simultaneously.\n\n\nHere is anther sample code.\n::\n\n from mdpw import INSTRUMENTS as I\n from mdpw import DRUMS as D\n from mdpw import note, seq, chord, compile\n dph = D['PedalHi-Hat']\n i = I['Drum']\n hh = ['s',['n',dph,1,127,i],['n',dph,1],['n',dph,1],['n',dph,1]]\n b = seq(note(64,.5,0,I['ElectricBassPick']),note(64,1,127),note(64,1),note(64,1))\n m = chord(seq(hh,hh,hh,hh),seq(b,b,b,b))\n compile(m, 120).write(\"sample.mid\")\n\nIn fact, the functions 'note', 'seq', 'chord' return arrays.\n\nYou can generate a round chant like this:\n::\n\n   import mdpw\n   from mdpw import note as n\n   from mdpw import seq as s\n   from mdpw import chord as c\n   from mdpw import compile\n\n   m0 = s(n(64,1,64,17), n(66), n(68), n(69), n(68),n(66),n(64),n(0,1,0))\n   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))\n   m1 = s(n(68,1,64,17), n(69), n(71), n(73), n(71),n(69),n(68),n(0,1,0))\n   m2 = s(n(64,2,125,17), n(64), n(64), n(64))\n   a = s(m0, m1, m2,m01)\n   r = n(0,8,0,1)\n   a =c(a, s(r, a), s(r, r, a))\n   mdpw.compile(a, 120).write(\"frog.mid\")\n\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate MIDI file from Array of Array data.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "http://github.com/cwbp/mdpw"
    },
    "split_keywords": [
        "midi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb0abee4dc581ffc6009b22e0337af4abead794493f1cbbdef2bd13b824a6bd9",
                "md5": "3a7b252c719bb9a0d422399f13eabd8d",
                "sha256": "5783e8410a2dd34e37136aac470ae2b63b07779e67213caf1f2bbd56ff16ef3a"
            },
            "downloads": -1,
            "filename": "mdpw-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a7b252c719bb9a0d422399f13eabd8d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5344,
            "upload_time": "2024-06-29T10:25:37",
            "upload_time_iso_8601": "2024-06-29T10:25:37.574080Z",
            "url": "https://files.pythonhosted.org/packages/bb/0a/bee4dc581ffc6009b22e0337af4abead794493f1cbbdef2bd13b824a6bd9/mdpw-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a940862612ce80fe9dc13c9ac9858308092b9353c8bc45614fd84d179a3c11e5",
                "md5": "40f59bd4cc6c3090dd9cfa0b9e359425",
                "sha256": "2603ac7fded04c7ba47a4e7fa985d9520686cc79d9c4bb02663464bd6bc28e7b"
            },
            "downloads": -1,
            "filename": "mdpw-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "40f59bd4cc6c3090dd9cfa0b9e359425",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5333,
            "upload_time": "2024-06-29T10:25:39",
            "upload_time_iso_8601": "2024-06-29T10:25:39.393755Z",
            "url": "https://files.pythonhosted.org/packages/a9/40/862612ce80fe9dc13c9ac9858308092b9353c8bc45614fd84d179a3c11e5/mdpw-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-29 10:25:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cwbp",
    "github_project": "mdpw",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mdpw"
}
        
Elapsed time: 0.52686s