Grant Proposal: Perl as piano sheet music/compiler/synthesizer

The Grants Committee has received the following grant proposal for the July/August round. Before the Committee members vote, we would like to solicit feedback from the Perl community on the proposal.

Review the proposal below and please comment here by August 26th, 2018. The Committee members will start the voting process following that.

Perl as piano sheet music/compiler/synthesizer

  • Name:

    Yang Bo

  • Amount Requested:

    USD 2,500


Write a piece of piano music in Perl, then compile it with a Perl compiler, finally synthesize it with a Perl synthesizer. Yes, you can interpret any piano music however you like with Perl, listen and enjoy it using Perl, and touch Bach/Beethoven/Brahms/Schumann/Schubert all those great souls through Perl.

Benefits to the Perl Community

There's literally not once that I went to the explore page of github and didn't see a project that's used to write music programmatically, music and programming languages, they are such a combination and there's a lot of interest of them among software developers, unlike natural languages, both of them are precise, but while it may take a quite while to appreciate a programming language, music could be feeled right now and instantly grab one's mind, by providing a direct link from Perl to piano music, one can listen to a beautiful piano piece and get impressed by Perl right away, thus contributing to the attractiveness of Perl overall and potentially get/keep new/old developers to Perl.


  1. A piano sheet music format that's:
    1. declarative.
    2. valid Perl code.
    3. able to describe arbitrarily complex piano piece.
    4. a natural and close reflection of a real piano sheet music.
  2. A compiler written in Perl that compiles any piano piece written in this format as MIDI.
  3. A synthesizer written in XS that's:
    1. targeted to a freely available piano sample library so that there's no barrier for anybody to use.
    2. specialized in piano synthesizing so that efficiency is maximized, only two seconds are required to render the entire Brahms Op.79 No.2 on a six years old laptop.
    3. required for being self contained, you can of course use any other synthesizer you like better or a commercially one you've purchased but that's all optional.

Project Details

It's a complete pipeline to produce piano music. The first part is the format of the sheet music/source code, just like you don't write a program in machine instructions but in a high level programming language, you don't write a piece of piano music in MIDI instructions but in a much more natural way similar to how you would read a piece of piano sheet music, you can have a look at the source code of Brahms Op.79 No.2 to get the hang of it.

Then the source is compiled by the compiler, which is the second part, to produce binary instructions/MIDI for the synthesizer, it handles expansions, event ordering, accidentals, key signatures, dynamic tempos, to name a few.

The third and last part is the synthesizer producing sound samples from data generated by the compiler, which could then be played directly or encoded and saved.

It's not a program to just make sounds, or play some notes/chords, it's designed from ground up to interpret the most difficult/complex piano music, and it's proven, I have already interpreted twelve pieces of piano music, most of which are non-trivial classical pieces, and can be viewed at "youtube".


  1. Split this project out into a stand alone git repository, rebase all related commits and write meaningful commit messages.
  2. Write detailed documentation, especially for the music source format.
  3. Upload the first release to CPAN, with source demos for three piano pieces.
  4. Read MIDI specification throughly, I'm using a customized binary format that's very similar to MIDI at the moment, but MIDI is inevitable since it provides the freedom to use arbitrary synthesizer.
  5. Implement MIDI output, and upload the second release to CPAN with MIDI files of those three demos.
  6. Depending on community feedback, implement most wanted features or interpret more pieces.

Project Schedule

This project will take six months, I can start working on it after it's approved.

Completeness Criteria

A release uploaded to CPAN with all deliverables accomplished.


I'm creative and experienced in Perl, I created a new Linux distribution with Perl, I wrote the first reference counting CPAN client, I invented a new object system for Perl with no code.

I played piano for three years, I've already received three copyright infringement claims uploading piano music I programmed and synthesized with this project to "youtube", claiming that it's actually done by some professional piano players.


About TPF

The Perl Foundation - supporting the Perl community since 2000. Find out more at

About this Entry

This page contains a single entry by Coke published on August 19, 2018 7:04 PM.

Maintaining the Perl 5 Core (Dave Mitchell): Grant Report for July 2018 was the previous entry in this blog.

Grant Proposals: July/August 2018 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


OpenID accepted here Learn more about OpenID
Powered by Movable Type 6.2.2