Generating MIDI files programmatically?
You are Unregistered, please register to gain Full access.    
Advertisements


Modular software & programming MaxMSP, Reaktor, Pure Data, Jeskola BUZZ, and other modular programs. Any questions relating to these programs (patching, favorite ensembles) should be posted in this forum.

Reply
Thread Tools
Old 16-11-2014, 07:46 AM   #1
SpinVector
Soundscaper
SpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MC
SpinVector's Avatar
melbs
Posts: 372
MC Status: 6892084
Thanks: 50
Thanked 65 Times in 51 Posts
Generating MIDI files programmatically?

I'm interested in creating a program to generating a midi file using one of the languages I am familiar with.

Does anyone know any good libraries for Java, JS, python or C#?

Or perhaps a program with it's own scripting language for midi?

Just basic stuff like note on note off, and CCs.

I've had a brief look at the midi file specs and I know I can create my own library, but if I could use something ready made that would be a great time saver.

Thanks.

Advertisements

SpinVector is offline   Thanks Reply With Quote
Old 16-11-2014, 08:43 AM   #2
SpinVector
Soundscaper
SpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MC
SpinVector's Avatar
melbs
Posts: 372
MC Status: 6892084
Thanks: 50
Thanked 65 Times in 51 Posts
Re: Generating midi files programmatically?

Ok so I've found a few things.

[Only registered and activated users can see links. Click here to register]
is a Java library that has it's own text string based notation system, like so:
Code:
player.play("C D E F G A B");
player.play("C3w D6h E3q F#5i Rs Ab7q Bb2i");
not what I'm after but interesting none the less.
Would be good for quickly generating variations of chord progressions, as it has extensive chord notation.

I found a massive list of python midi libraries, which is super confusing because there's so many options and some of them haven't been updated in ages.

[Only registered and activated users can see links. Click here to register]
looks promising as it's fairly simple and has been updated recently.
Code:
 # Add track name and tempo.
MyMIDI.addTrackName(track,time,"Sample Track")
MyMIDI.addTempo(track,time,120)

# Add a note. addNote expects the following information:
track = 0
channel = 0
pitch = 60
time = 0
duration = 1
volume = 100

# Now add the note.
MyMIDI.addNote(track,channel,pitch,time,duration,volume)

# And write it to disk.
binfile = open("output.mid", 'wb')
MyMIDI.writeFile(binfile)
binfile.close()
As for C#, [Only registered and activated users can see links. Click here to register]
comes recommended via a post on stackexchange.

This one looks like the most complex of the examples, it has support for sending and recieving real time midi data through midi ports, which may come in handy later. I couldn't find any examples of writing midi files on the site, but there is support for it in the description.

I wonder how difficult it would be to emulate a midi device so i could send midi data to my DAW?

I would be interested to know if anyone's used any of these.
SpinVector is offline   Thanks Reply With Quote
Old 16-11-2014, 08:52 PM   #3
iDoG
IDMf SupporterIDMf Artist
iDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MCiDoG is a savage MC
iDoG's Avatar
Chicago
Posts: 674
MC Status: 17260
Thanks: 259
Thanked 345 Times in 234 Posts
Re: Generating midi files programmatically?

Quote:
Originally Posted by SpinVector View Post

This one looks like the most complex of the examples, it has support for sending and recieving real time midi data through midi ports, which may come in handy later. I couldn't find any examples of writing midi files on the site, but there is support for it in the description.

I wonder how difficult it would be to emulate a midi device so i could send midi data to my DAW?
Just had a look through that library and it looks like there are a bunch of sample projects and one of them should demonstrate what you need:

[Only registered and activated users can see links. Click here to register]


I don't have any direct experience with this, but since you don't really have to specify a particular midi device and port in Cubase for a particular channel, you might not have to do anything special at all to make this functional. Just make sure to run your custom app before you start Cubase, so once it creates a midi out port, Cubase should potentially "sense" it. Just a guess...
iDoG is offline   Thanks Reply With Quote
Thanks to iDoG
SpinVector (18-11-2014)
Old 01-12-2014, 07:43 PM   #4
philc
IDMf Supporter
philc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud ofphilc has much to be proud of
philc's Avatar
Montana
Posts: 49
MC Status: 1310
Thanks: 19
Thanked 26 Times in 13 Posts
Re: Generating midi files programmatically?

Quote:
Originally Posted by SpinVector View Post
I wonder how difficult it would be to emulate a midi device so i could send midi data to my DAW?
I'm needing to do just that and found tobias-erichsen.de/software/virtualmidi.html (can't post links yet) which I will be utilizing. I haven't used it yet so can't speak from any experience with it.
philc is offline   Thanks Reply With Quote
Thanks to philc
SpinVector (01-12-2014)
Old 01-12-2014, 08:54 PM   #5
SpinVector
Soundscaper
SpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MCSpinVector is a savage MC
SpinVector's Avatar
melbs
Posts: 372
MC Status: 6892084
Thanks: 50
Thanked 65 Times in 51 Posts
Re: Generating midi files programmatically?

Thanks.

I've started messing around with midi.net. Got a very basic melody randomiser up and running.

I've also found this program called [Only registered and activated users can see links. Click here to register]
. It's a very interesting approach to generative midi, based on graphical spacial networking. Unfortunately it's a bit clunky and under developed. Fascinating to use though. I reckon there's a lot of potential there.

Advertisements

SpinVector is offline   Thanks Reply With Quote
Reply


Thread Tools

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Maschine patterns as MIDI files? A Tree Hardware and Gear 5 02-01-2014 03:00 AM
Audio Files or Midi Files YvesB Tutorials Section 20 15-10-2013 01:11 PM
Realistic Midi Drum Files WillyZi Sound Design, Mixing, & Studio Techniques 28 27-04-2013 03:47 PM
Where to get MIDI files of top house artists? Mimeticz House / Dubstep 12 09-05-2012 04:55 PM
Dance Music downloadable MIDI files bigdaveo11 The Studio 0 11-10-2011 08:19 PM


All times are GMT +1. The time now is 11:38 PM.


Electronic Music Forums

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.