detonate and export/write midi files

Julien-Robert's icon

I need to write a midi file from a list of notes and on-set times (not real-time). I though I'd be better to use detonate. I've been able to record the events inside detonate but when it comes to export into midi files, it puts all the notes at the beginning....? I tied different combinations like write 0 0, write 1 0, write 2 0, write 1 1, write 2 1 etc. and it's all doing the same.
My goal is to import it inside Ableton so MIDI type 1 with multitrack is not an option since it's not supported by Ableton.

any idea?

Thanks

broc's icon

Maybe the notes are not recorded correctly?
Double-click on detonate to see the graphical representation.

Exporting type 0 midi file should work with [write 0 0].

Julien-Robert's icon

When I see the notes inside the graphical representation of Detonate, they are at the good place with the good durations.

exporting using write 0 0 didn't do the job.

broc's icon

Strange. I've just checked a small example that works for me as expected.
Maybe post your patch here?

Julien-Robert's icon

Ok, did some tests and found that on mac, it works well. The problem occurs on Windows (10). When we [write 0 0], all the notes appear at the same time at the beginning. It's a bug between Max and Windows.

I guess I'll have to find a workaround... is there another way to record a midi file "offline" (sending a list of on-set and pitches)?

this is the patch I use for my tests.

Max Patch
Copy patch and select New From Clipboard in Max.

broc's icon

You could use [seq] but it requires a different format of the note list (e.g. explicit note-on and note-offs). Converting your note list off-lIne to this format is possible but somewhat tricky, in particular for the timing data.

Dan Nigrin's icon

You could try John MacCallum's Java-based midifile: http://cnmat.berkeley.edu/downloads-old

Julien-Robert's icon

Broc, I don't see how to use [seq] not in real-time. You say it's possible to dumb a list of note-on note-off to generate a midi sequence? how?

About the Java-based external midifile, it's a good workaround, thanks.

broc's icon

For using [seq] not in real-time the note events must but be stored in a _text_ file. For example

1000 144 60 80;
1500 144 60 0;

represents a note C3 with velocity 80, start time 1sec and duration 0.5sec.
From the text file you can generate a type 0 midi file simply with 'read' and 'write'.

Max Patch
Copy patch and select New From Clipboard in Max.

Personally, I try to avoid 3rd party stuff whenever possible.

Andrew Milne's icon

I have also experienced this detonate bug -- all notes go to the beginning. For me the problem only exhibited itself when in Windows and when the patch was saved as a standalone.

Have you reported this bug to Cycling 74? I would love to see this issue fixed!

I'll have a look at the [seq] workaround Broc below...

Julien-Robert's icon

No I didn't report the bug. We should. For now, I'm using midifile and it's good for me.

Andrew Milne's icon

I prefer to avoid Java-based solutions seeing as how Java is being gradually deprecated in Max, and all the shenanigans required by having to have a "legacy" version of Java installed for Max in OS X.

broc's icon

Unfortunately Max seems to require a Java installation even if you don't use any Java externals.