Skip to main content

Library to convert MIDI files to the PlayDate Pulp IDE's JSON format.

Project description

PlayDate Pulp Midi-to-JSON Converter

*Developed by Ryan Beard and Anthony Beard of Bro-Code.dev

This simple command line utility to convert standard MIDI (.mid) files into the PlayDate Pulp's JSON (.json) audio schema for import into the web-based development environment.

The PlayDate Pulp's JSON Audio Format Spec

The Pulp's audio spec (below) follows a simple comma delimited schema that allows the import of multilple song contents within a single file.

[{
    "id":[SONG ID NUMBER - 0 based index],
    "bpm":[bpm integer]
    "name":["name of song as string"]
    "notes:
    [[(sine track notes)],
    [(square track notes)],
    [(sawtooth track notes)],
    [(triangle track notes)],
    [(noise track notes)],
    ]
    "ticks":[number of 1/6th notes in length of the total track],
    "splits": [[sine split locations, in 16'th notes],[square],[sawtooth],[triangle],[noise]],
    "voices":[optional - voice adjustments]
    "loopFrom": [optional loop starting position]
}]

Each song contains four sections that itentify the id, bpm, name, and notes.

  • ID: The 0-based index of the song within the collection of songs. Allows update of existing songs.
  • BPM: the songs integer tempo as displayed in the Pulp editor
  • NAME: The song name to be displayed in Pulp "Songs" dropdown list.
  • NOTES: The comprehensive list of note events in the song, arranged by track.

Notes are arranged by track in the following sequence:

  • Sine Track
  • Square Track
  • Sawtooth Track
  • Traingle Track
  • Noise Track

Each track must be present in the import file, even if it contains no notes. Empty tracks are presented as an empty list/array: [ ].

Within a track, note are stored as tuples. Each note must contain the following:

  • The note value, represented as an integer on a 12 note linear scale (1 = C, 12 = B)
  • The note octave (0 through 8)
  • The duration of the note in number of 1/16th note increments (e.g. an 1/8 note would be 2)

Rests are stored as empty 1/6th note tuplets (e.g. 0,0,0). This includes empty 1/6th note positions that occur under other sustained notes. For example, an 1/8th note would be represented with two tuples: one for the note start event during the first 1/16th note, and one for the sustained note held during the second 1/16th note.

[1,1,2,0,0,0]

There are a total of 512 note positions available (1/16th note slots) in each pulp song.

Installing the PlayDate MIDI Converter

To install the PlayDate Midi Converter, run the following command:

pip install playdate-midi-converter

Note that the PlayDate MIDI Converter requires Python 3.9.* or higher.

During installation, the following dependencies will also be installed:

  • mido v1.2.10
  • pathlib v1.0.1
  • pick v1.2.0

Running the Audio Converter

Run the PlayDate MIDI Converter with the following command:

playdate-pulp-midi

You can specifcy a .mid input and .json output file with the -i and -o arguments, but if none are applied, you will be prompted to select an input file and save location with your operating systems native file explorer.

For each track present in the input MIDI file, you will be required to map it to one of the 5 avialable PlayDate Pulp audio tracks, or you can choose to ignore the midi track.

Please assign track #1 "Inst 1" to a channel:
        [0]     (Ignore)
        [1]     Sine
        [2]     Square
        [3]     Sawtooth
        [4]     Triangle
        [5]     Noise

Each PlayDate Pulp audio track can only be assigned once. After each track has been assigned, and the mappings have been, the .json output file is saved to the user specific location.

Conversion Notes

Note that during the conversion, the MIDI file is evaluated for track tempo and minimum note denomomination. This allows the resulting JSON file to be scaled to maximize the usage of the available 512 note positions. For example, if an input MIDI file has no notes shorter than a 1/4 note, the tempo can be divided by 4 and the 1/4 notes can be represented as 1/6th notes to allow more note content in the ouput file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

playdate-midi-converter-0.0.2.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

playdate_midi_converter-0.0.2-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file playdate-midi-converter-0.0.2.tar.gz.

File metadata

  • Download URL: playdate-midi-converter-0.0.2.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for playdate-midi-converter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bcf2883fc730ab9d71deb19121db24797da09e643672256e96b49defba412314
MD5 daa1a2568fb46f3bb6b556b4ff3fd62c
BLAKE2b-256 5d11f67196e6a81f19addaa03f59d3d3b00b1e205e5aec54c3f48134172aa2d0

See more details on using hashes here.

File details

Details for the file playdate_midi_converter-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for playdate_midi_converter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 757cdd88d4ddbfaff9aaf14f92c38b9a3b3a13d69080e6ad822d051076ad27a9
MD5 b76b5c3bfb4c90f5ddba74928ce437aa
BLAKE2b-256 7009024949a3128ca180d39f3c308736c6c3df2afba3f0fc6fcf8722048809df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page