Jump to content

Has Anyone Used A Programming Language To Automate MIDI Files?


Recommended Posts

I am looking to make the workflow of producing a new song in Cakewalk less tedious by automating some of the repetitive operations.  The concept is that I have a structure of the song in my mind or on paper, intro, verse, chorus, etc. with chord progressions in each.  I would like to feed that structure into a file and then have a program spit out a MIDI file with some basic tracks with simple chords and bass lines that follow the chord progressions.  It would also label the chord changes in the timeline above the track view.

I see that Cakewalk includes the CAL language to work with MIDI files.  I see a programming guide for that language is available on the Internet.  I could learn that new language, but I see there is also an article with some C# programs that someone created to modify MIDI files.  I will probably start reading that because I have worked with C# for about 10 years and I am familiar with that language.

The question is basically, has someone worked on something like this before and is there a better solution than those 2 options?  If not, I may build out an entire project with a user interface to guide non-programmers through the use of this, if they wanted it enough to buy it.  But my immediate desire is just to use it myself.  Below is a link to the C# project that I found which modifies MIDI files.

C# MIDI Library

Edited by DallasSteve
Link to comment
Share on other sites

I have a quick update to this idea.  It looks like I may have to do this in CAL if I want to be able to edit/update files I have already worked on in Cakewalk.  The Cakewalk associated features are stored in a CWP file, not in a MIDI file.  The only think I could do from C# is to set up the basic structure in a MIDI and then import it into a Cakewalk project.  Things like setting the timeline chord labels probably can't be done from MIDI.  Also, making changes to the structure after I begin working on a Cakewalk project could not be done from C#/MIDI.

A further update: It looks like CAL doesn't offer control over advanced features like the Arranger, so I won't be able to automate the creation of Arranger sections.

Edited by DallasSteve
Link to comment
Share on other sites

If you really want to create/modify MIDI data programmatically, MIDICSV may be a good starting point.

This converts MIDI data to a CSV file. It also includes a utility to convert CSV back to MIDI.

The page contains worked examples in PERL but anything that can read a text file will work.

  • Like 1
Link to comment
Share on other sites

3 hours ago, scook said:

If you really want to create/modify MIDI data programmatically, MIDICSV may be a good starting point.

This converts MIDI data to a CSV file. It also includes a utility to convert CSV back to MIDI.

The page contains worked examples in PERL but anything that can read a text file will work.

Thanks for that link.  That's an interesting possibility.

I also opened a CAL file in Notepad and I can almost understand what they are doing just by browsing it.  It is an uncompiled text file that is human friendly.  I found the CAL programming guide  at this website: https://www.academia.edu/  I will look into what I can do with that and I may try to open a MIDI file with MIDICSV and see what that looks like.

Link to comment
Share on other sites

If anyone is following this, I was able to create the automation process that I wanted, but it was a 10 hour project mixing together a C# program and a couple of CAL scripts.  I was able to load the Markers shown in the timeline below from a simple text file and then update the notes to match the chord changes in the piano roll below.  Now this is not a complete music production process.  As I write a song I will modify the chord and bass rhythms and then re-run the chord change portion to quickly apply the changes.  This is what I wanted to remove a lot of the tedium and modification errors that I always faced when doing it manually.

Cakewalk2.jpg

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...