Skip to main content

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.

Metadata

Release files for playdate-midi-converter 0.0.2

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

Source distribution (sdist)

Source distribution for playdate-midi-converter 0.0.2
File Size Uploaded Provenance Actions
playdate-midi-converter-0.0.2.tar.gz 17.0 kB Without provenance Details for playdate-midi-converter-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for playdate-midi-converter 0.0.2
File Interpreter ABI Platform Actions
playdate_midi_converter-0.0.2-py3-none-any.whl Python 3 none any Details for playdate_midi_converter-0.0.2-py3-none-any.whl

Total release size: 39.3 kB

Release files / playdate-midi-converter-0.0.2.tar.gz

Download URL playdate-midi-converter-0.0.2.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bcf2883fc730ab9d71deb19121db24797da09e643672256e96b49defba412314
BLAKE2b-256 checksum
How to use checksums
5d11f67196e6a81f19addaa03f59d3d3b00b1e205e5aec54c3f48134172aa2d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.10

Release files / playdate_midi_converter-0.0.2-py3-none-any.whl

Download URL playdate_midi_converter-0.0.2-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
757cdd88d4ddbfaff9aaf14f92c38b9a3b3a13d69080e6ad822d051076ad27a9
BLAKE2b-256 checksum
How to use checksums
7009024949a3128ca180d39f3c308736c6c3df2afba3f0fc6fcf8722048809df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.10

Security for playdate-midi-converter 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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