Hey list, I have a patch that plays melodies with midi notes. The patch also records the melodies into midi files for later use.
The recording is done with [midiformat] and [seq] from the cyclone-library, like this
|60[ | | [makenote 100 500] | | | | [pack f f] | | [midiformat] | | [seq]
[seq] receives "record" , "stop record" and "write" messages for recording and saving the midi files.
My problem is that when I copy the recorded midi file into a daw, the melody's tempo and onsets do not match with the metronome in the daw. Do you know if there is a way to somehow capture the bpm of the melody in pd into the recorded midi-file? The [seq] object knows a [tick[ message, but I have not figured that out yet. I definitely could calculate a bpm from my [metro] in the patch, but I don't know how to get that into the midi-recording.
Maybe someone of you has already dealt with this?! :-)
Thanks! Jakob
well, I dunno, but maybe this is a cyclone issue with [seq]?
Em qua., 1 de abr. de 2020 às 13:08, Jakob Laue jakkesprinter@web.de escreveu:
Hey list, I have a patch that plays melodies with midi notes. The patch also records the melodies into midi files for later use.
The recording is done with [midiformat] and [seq] from the cyclone-library, like this
|60[ | | [makenote 100 500] | | | | [pack f f] | | [midiformat] | | [seq]
[seq] receives "record" , "stop record" and "write" messages for recording and saving the midi files.
My problem is that when I copy the recorded midi file into a daw, the melody's tempo and onsets do not match with the metronome in the daw. Do you know if there is a way to somehow capture the bpm of the melody in pd into the recorded midi-file? The [seq] object knows a [tick[ message, but I have not figured that out yet. I definitely could calculate a bpm from my [metro] in the patch, but I don't know how to get that into the midi-recording.
Maybe someone of you has already dealt with this?! :-)
Thanks! Jakob
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On Fri, Apr 3, 2020 at 12:39 PM Jakob Laue jakkesprinter@web.de wrote:
hey, yes i think so because it seems that [seq] does not offer to specify some kind of ticks when writing to a file. hmm.
Have you tried [midifile] from mrpeach? It can write most of the tags.
Martin
Hey Martin, Thanks for your message. I looked for mrpeach in deken, but the only result I get is mrpeach for extended ( i am on mac os). Does that mean that I cannot use it?
Best, Jakob
Am 03.04.2020 um 19:29 schrieb Martin Peach chakekatzil@gmail.com:
On Fri, Apr 3, 2020 at 12:39 PM Jakob Laue jakkesprinter@web.de wrote:
hey, yes i think so because it seems that [seq] does not offer to specify some kind of ticks when writing to a file. hmm.
Have you tried [midifile] from mrpeach? It can write most of the tags.
Martin
Hi Jakob,
I have uploaded Windows versions of midifile via deken -- look for 'midifile'. Unfortunately I have no access to a mac these days. Someone else may be able to build it for mac, the source is included in the package.
Martin
On Fri, Apr 3, 2020 at 2:30 PM Jakob jakkesprinter@web.de wrote:
Hey Martin, Thanks for your message. I looked for mrpeach in deken, but the only result I get is mrpeach for extended ( i am on mac os). Does that mean that I cannot use it?
Best, Jakob
Am 03.04.2020 um 19:29 schrieb Martin Peach chakekatzil@gmail.com:
On Fri, Apr 3, 2020 at 12:39 PM Jakob Laue jakkesprinter@web.de wrote:
hey, yes i think so because it seems that [seq] does not offer to specify some kind of ticks when writing to a file. hmm.
Have you tried [midifile] from mrpeach? It can write most of the tags.
Martin
On Fri, Apr 3, 2020 at 4:41 PM Jakob Laue jakkesprinter@web.de wrote: ...
Then I opened the help file directly from the ../Pd/externals/mrpeach-folder by double-clicking it and I followed the steps for writing to a file. I
- choose a file
- put the 2 ms into the right inlet of [metro] and then start [metro]
- hit some notes on a usb midi controller connected to pd (the [notein] shows notes coming in)
- hit |flush(
- stop the metro
Then I copy the newly created midi file into ableton, but I cannot see any midi notes being displayed for that file.
Maybe try to load it using the midifile playback subpatch, You can set the verbosity to see what was recorded, if anything. possibly ableton expects some meta information at the start of the file.
Martin
Hey Martin, thanks for the hint. When I read a recorded file that should actually have some recorded notes in it and then load it again with the midifile-read-help-patch, then I get this (verbosity = 3)
midifile_open_path (absolute): /Users/wbjc/Desktop/mp2.mid
midifile: opened /Users/wbjc/Desktop/mp2.mid midifile: Header chunk type: MThd midifile: Header chunk length: 6 midifile: Header chunk format: 0 (Single multichannel track) midifile: Header chunk ntrks: 1 midifile: Header chunk division: 0xE714: 25 frames per second, 20 ticks per frame other_meta: frames_per_sec 25 other_meta: ticks_per_frame 20 midifile: Track chunk 0 type: MTrk, length 35
Does not look like something has been recorded, right?
Best, Jakob
Gesendet: Freitag, 03. April 2020 um 23:26 Uhr Von: "Martin Peach" chakekatzil@gmail.com An: "Jakob Laue" jakkesprinter@web.de Cc: Pd-List pd-list@lists.iem.at Betreff: Re: Re: [PD] including bpm info to midi-recording On Fri, Apr 3, 2020 at 4:41 PM Jakob Laue jakkesprinter@web.de wrote: ...
Then I opened the help file directly from the ../Pd/externals/mrpeach-folder by double-clicking it and I followed the steps for writing to a file. I
- choose a file
- put the 2 ms into the right inlet of [metro] and then start [metro]
- hit some notes on a usb midi controller connected to pd (the [notein] shows notes coming in)
- hit |flush(
- stop the metro
Then I copy the newly created midi file into ableton, but I cannot see any midi notes being displayed for that file.
Maybe try to load it using the midifile playback subpatch, You can set the verbosity to see what was recorded, if anything. possibly ableton expects some meta information at the start of the file.
Martin
On Sat, Apr 4, 2020 at 4:57 PM Jakob Laue jakkesprinter@web.de wrote:
Hey Martin, thanks for the hint. When I read a recorded file that should actually have some recorded notes in it and then load it again with the midifile-read-help-patch, then I get this (verbosity = 3)
midifile_open_path (absolute): /Users/wbjc/Desktop/mp2.mid
midifile: opened /Users/wbjc/Desktop/mp2.mid midifile: Header chunk type: MThd midifile: Header chunk length: 6 midifile: Header chunk format: 0 (Single multichannel track) midifile: Header chunk ntrks: 1 midifile: Header chunk division: 0xE714: 25 frames per second, 20 ticks per frame other_meta: frames_per_sec 25 other_meta: ticks_per_frame 20 midifile: Track chunk 0 type: MTrk, length 35
Does not look like something has been recorded, right?
The last line shows the track chink is 35 bytes long. Did you play it to the end? The third outlet of [midifile] emits a bang when it gets to the end. If you waited a while after starting to record there may be a long pause before something happens. The [dump 0( message should output the entire track to the Pd window.
Martin
On Sun, Apr 5, 2020 at 9:48 AM Jakob Laue jakkesprinter@web.de wrote:
Hey Martin, I tried again today. I recorded a new midi file and then loaded it with the midifile-read-help-patch.
After loading the file I get:
midifile: opened /Users/wbjc/Desktop/mpxy.mid midifile: Header chunk type: MThd midifile: Header chunk length: 6 midifile: Header chunk format: 0 (Single multichannel track) midifile: Header chunk ntrks: 1 midifile: Header chunk division: 0xE714: 25 frames per second, 20 ticks per frame other_meta: frames_per_sec 25 other_meta: ticks_per_frame 20 midifile: Track chunk 0 type: MTrk, length 432
And then if I send a |dump 0( message to [midifile] I get:
midifile: Parsing track[0]... midifile: tick 0 delta 0 status 99 MIDI 0x99 24 60 : channel 10 Note 36 On velocity 96 midifile: tick 0 delta 0 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 2B 65 : channel 10 Note 43 On velocity 101 midifile: tick 0 delta 0 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 2B 7F : channel 10 Note 43 On velocity 127 midifile: tick 0 delta 0 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 25 72 : channel 10 Note 37 On velocity 114 midifile: tick 0 delta 0 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 25 72 : channel 10 Note 37 On velocity 114 midifile: tick 0 delta 0 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 24 7C : channel 10 Note 36 On velocity 124 midifile: tick 0 delta 0 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 26 67 : channel 10 Note 38 On velocity 103 midifile: tick 0 delta 0 status 89 MIDI 0x89 26 00 : channel 10 Note 38 Off velocity 0 midifile: tick 0 delta 0 status 99 MIDI 0x99 26 6A : channel 10 Note 38 On velocity 106 midifile: tick 0 delta 0 status 89 MIDI 0x89 26 00 : channel 10 Note 38 Off velocity 0 midifile: tick 1052 delta 1052 status 99 MIDI 0x99 24 59 : channel 10 Note 36 On velocity 89 midifile: tick 1073 delta 21 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 1120 delta 47 status 99 MIDI 0x99 24 6E : channel 10 Note 36 On velocity 110 midifile: tick 1169 delta 49 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 1248 delta 79 status 99 MIDI 0x99 24 7F : channel 10 Note 36 On velocity 127 midifile: tick 1287 delta 39 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 1400 delta 113 status 99 MIDI 0x99 24 6A : channel 10 Note 36 On velocity 106 midifile: tick 1418 delta 18 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 1455 delta 37 status 99 MIDI 0x99 24 64 : channel 10 Note 36 On velocity 100 midifile: tick 1502 delta 47 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 1591 delta 89 status 99 MIDI 0x99 2B 71 : channel 10 Note 43 On velocity 113 midifile: tick 1657 delta 66 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 1780 delta 123 status 99 MIDI 0x99 2B 7C : channel 10 Note 43 On velocity 124 midifile: tick 1788 delta 8 status 99 MIDI 0x99 2A 29 : channel 10 Note 42 On velocity 41 midifile: tick 1854 delta 66 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 1971 delta 117 status 99 MIDI 0x99 2B 7F : channel 10 Note 43 On velocity 127 midifile: tick 2047 delta 76 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 2213 delta 166 status 99 MIDI 0x99 25 6B : channel 10 Note 37 On velocity 107 midifile: tick 2266 delta 53 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 2352 delta 86 status 99 MIDI 0x99 25 7C : channel 10 Note 37 On velocity 124 midifile: tick 2366 delta 14 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 2424 delta 58 status 99 MIDI 0x99 25 73 : channel 10 Note 37 On velocity 115 midifile: tick 2464 delta 40 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 2571 delta 107 status 99 MIDI 0x99 26 7B : channel 10 Note 38 On velocity 123 midifile: tick 2634 delta 63 status 89 MIDI 0x89 26 00 : channel 10 Note 38 Off velocity 0 midifile: tick 2726 delta 92 status 89 MIDI 0x89 2A 00 : channel 10 Note 42 Off velocity 0 midifile: tick 2728 delta 2 status 99 MIDI 0x99 26 7F : channel 10 Note 38 On velocity 127 midifile: tick 2736 delta 8 status 99 MIDI 0x99 2A 24 : channel 10 Note 42 On velocity 36 midifile: tick 2794 delta 58 status 89 MIDI 0x89 26 00 : channel 10 Note 38 Off velocity 0 midifile: tick 2865 delta 71 status 99 MIDI 0x99 2C 7F : channel 10 Note 44 On velocity 127 midifile: tick 2883 delta 18 status 89 MIDI 0x89 2C 00 : channel 10 Note 44 Off velocity 0 midifile: tick 2928 delta 45 status 99 MIDI 0x99 2C 7F : channel 10 Note 44 On velocity 127 midifile: tick 2959 delta 31 status 89 MIDI 0x89 2C 00 : channel 10 Note 44 Off velocity 0 midifile: tick 2996 delta 37 status 99 MIDI 0x99 2C 6E : channel 10 Note 44 On velocity 110 midifile: tick 3027 delta 31 status 89 MIDI 0x89 2C 00 : channel 10 Note 44 Off velocity 0 midifile: tick 3059 delta 32 status 99 MIDI 0x99 2C 77 : channel 10 Note 44 On velocity 119 midifile: tick 3094 delta 35 status 89 MIDI 0x89 2C 00 : channel 10 Note 44 Off velocity 0 midifile: tick 3151 delta 57 status 99 MIDI 0x99 2D 64 : channel 10 Note 45 On velocity 100 midifile: tick 3170 delta 19 status 89 MIDI 0x89 2D 00 : channel 10 Note 45 Off velocity 0 midifile: tick 3280 delta 110 status 99 MIDI 0x99 2D 74 : channel 10 Note 45 On velocity 116 midifile: tick 3353 delta 73 status 89 MIDI 0x89 2D 00 : channel 10 Note 45 Off velocity 0 midifile: tick 3491 delta 138 status 99 MIDI 0x99 27 7F : channel 10 Note 39 On velocity 127 midifile: tick 3715 delta 224 status 89 MIDI 0x89 27 00 : channel 10 Note 39 Off velocity 0 midifile: tick 3749 delta 34 status 99 MIDI 0x99 28 3A : channel 10 Note 40 On velocity 58 midifile: tick 3794 delta 45 status 89 MIDI 0x89 28 00 : channel 10 Note 40 Off velocity 0 midifile: tick 3868 delta 74 status 99 MIDI 0x99 29 6D : channel 10 Note 41 On velocity 109 midifile: tick 3931 delta 63 status 89 MIDI 0x89 29 00 : channel 10 Note 41 Off velocity 0 midifile: tick 4086 delta 155 status 99 MIDI 0x99 2F 6A : channel 10 Note 47 On velocity 106 midifile: tick 4097 delta 11 status 89 MIDI 0x89 2F 00 : channel 10 Note 47 Off velocity 0 midifile: tick 4202 delta 105 status 99 MIDI 0x99 2F 6F : channel 10 Note 47 On velocity 111 midifile: tick 4262 delta 60 status 89 MIDI 0x89 2F 00 : channel 10 Note 47 Off velocity 0 midifile: tick 4331 delta 69 status 99 MIDI 0x99 2E 68 : channel 10 Note 46 On velocity 104 midifile: tick 4358 delta 27 status 89 MIDI 0x89 2E 00 : channel 10 Note 46 Off velocity 0 midifile: tick 4397 delta 39 status 99 MIDI 0x99 2E 79 : channel 10 Note 46 On velocity 121 midifile: tick 4439 delta 42 status 89 MIDI 0x89 2E 00 : channel 10 Note 46 Off velocity 0 midifile: tick 4470 delta 31 status 99 MIDI 0x99 2E 67 : channel 10 Note 46 On velocity 103 midifile: tick 4500 delta 30 status 99 MIDI 0x99 2D 4E : channel 10 Note 45 On velocity 78 midifile: tick 4509 delta 9 status 89 MIDI 0x89 2E 00 : channel 10 Note 46 Off velocity 0 midifile: tick 4595 delta 86 status 89 MIDI 0x89 2D 00 : channel 10 Note 45 Off velocity 0 midifile: tick 4679 delta 84 status 99 MIDI 0x99 2D 6D : channel 10 Note 45 On velocity 109 midifile: tick 4681 delta 2 status 99 MIDI 0x99 2C 6E : channel 10 Note 44 On velocity 110 midifile: tick 4735 delta 54 status 89 MIDI 0x89 2D 00 : channel 10 Note 45 Off velocity 0 midifile: tick 4743 delta 8 status 89 MIDI 0x89 2C 00 : channel 10 Note 44 Off velocity 0 midifile: tick 4821 delta 78 status 99 MIDI 0x99 2B 71 : channel 10 Note 43 On velocity 113 midifile: tick 4829 delta 8 status 89 MIDI 0x89 2A 00 : channel 10 Note 42 Off velocity 0 midifile: tick 4883 delta 54 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 4966 delta 83 status 99 MIDI 0x99 25 4E : channel 10 Note 37 On velocity 78 midifile: tick 5022 delta 56 status 89 MIDI 0x89 25 00 : channel 10 Note 37 Off velocity 0 midifile: tick 5103 delta 81 status 99 MIDI 0x99 24 62 : channel 10 Note 36 On velocity 98 midifile: tick 5152 delta 49 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 5226 delta 74 status 99 MIDI 0x99 24 24 : channel 10 Note 36 On velocity 36 midifile: tick 5255 delta 29 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 5268 delta 13 status 99 MIDI 0x99 2A 69 : channel 10 Note 42 On velocity 105 midifile: tick 5370 delta 102 status 99 MIDI 0x99 24 68 : channel 10 Note 36 On velocity 104 midifile: tick 5415 delta 45 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 6046 delta 631 status 99 MIDI 0x99 2B 29 : channel 10 Note 43 On velocity 41 midifile: tick 6066 delta 20 status 89 MIDI 0x89 2B 00 : channel 10 Note 43 Off velocity 0 midifile: tick 6292 delta 226 status 99 MIDI 0x99 24 6A : channel 10 Note 36 On velocity 106 midifile: tick 6300 delta 8 status 89 MIDI 0x89 2A 00 : channel 10 Note 42 Off velocity 0 midifile: tick 6366 delta 66 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 6393 delta 27 status 99 MIDI 0x99 2A 21 : channel 10 Note 42 On velocity 33 midifile: tick 6428 delta 35 status 99 MIDI 0x99 24 7F : channel 10 Note 36 On velocity 127 midifile: tick 6473 delta 45 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 6489 delta 16 status 99 MIDI 0x99 24 71 : channel 10 Note 36 On velocity 113 midifile: tick 6550 delta 61 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 6634 delta 84 status 99 MIDI 0x99 24 7F : channel 10 Note 36 On velocity 127 midifile: tick 6678 delta 44 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 6784 delta 106 status 99 MIDI 0x99 24 7F : channel 10 Note 36 On velocity 127 midifile: tick 6829 delta 45 status 89 MIDI 0x89 24 00 : channel 10 Note 36 Off velocity 0 midifile: tick 7745 delta 916 status FF Meta 0x2F length 0 ========End of Track 0==========
So it must have recorded something. But when I imoprt the recorded midi file i ableton, then I only see 4 different , very short notes (c1, c#1, d1 and g1) at the very beginning of the piano roll. But of course I would expect the notes being all over the time line. Hm, might there something be wrong with the timing information?
You have a bunch of notes right at the beginning (tick 0) that go on and off instantly. Not sure how you did that, it may confuse ableton. Maybe you could take a simple file made in ableton, that works in ableton, and load it into [midifile] to see what it looks like. Ableton may be looking for a time signature or something like that in the first chunk.
When I recorded the file, I sent the 2,005 message into the right inlet of [metro], but that is correct, isn't it?
If that's 2 point 005 not two thousand, yes. But that only tells the [metro] how fast to tick, it doesn't write anything to the file to say how fast to play it. Also loading a file with a bpm and time signature doesn't automatically set the metro to match those values. The help patch is set up so that the first bang sent to [midifile] after loading a file willl take the timing info from the first chunk and set the [metro] for you. (The latest version of the help patch will do that, older ones may be different) Click the bang "step_one_tick".
Martin
On Mon, Apr 6, 2020 at 3:27 AM Jakob Laue jakkesprinter@web.de wrote:
Hey Martin, thanks for your hints!
I created a midi file in ableton, exported it and then read it with the midifile-read-help-patch. This is what I get after reading:
midifile: opened /Users/wbjc/Desktop/ableton.mid midifile: Header chunk type: MThd midifile: Header chunk length: 6 midifile: Header chunk format: 0 (Single multichannel track) midifile: Header chunk ntrks: 1 midifile: Header chunk division: 0x60: 96 ticks per quarter note midifile: Track chunk 0 type: MTrk, length 81
And this is what I get after the |dump 0( message:
midifile: Parsing track[0]... midifile: tick 0 delta 0 status FF Meta 0x03 length 1 Sequence/Track Name midifile: tick 0 delta 0 status FF Meta 0x58 length 4 Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note midifile: tick 0 delta 0 status FF Meta 0x58 length 4 Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note midifile: tick 0 delta 0 status 90 MIDI 0x90 42 64 : channel 1 Note 66 On velocity 100 midifile: tick 24 delta 24 status 80 MIDI 0x80 42 40 : channel 1 Note 66 Off velocity 64 midifile: tick 72 delta 48 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 96 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 120 delta 24 status 90 MIDI 0x90 46 64 : channel 1 Note 70 On velocity 100 midifile: tick 144 delta 24 status 80 MIDI 0x80 46 40 : channel 1 Note 70 Off velocity 64 midifile: tick 168 delta 24 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 192 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 216 delta 24 status 90 MIDI 0x90 40 64 : channel 1 Note 64 On velocity 100 midifile: tick 240 delta 24 status 80 MIDI 0x80 40 40 : channel 1 Note 64 Off velocity 64 midifile: tick 264 delta 24 status 90 MIDI 0x90 45 64 : channel 1 Note 69 On velocity 100 midifile: tick 288 delta 24 status 80 MIDI 0x80 45 40 : channel 1 Note 69 Off velocity 64 midifile: tick 312 delta 24 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 336 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 336 delta 0 status FF Meta 0x2F length 0 ========End of Track 0==========
The differences that I noticed:
In the ableton-file the "header chunk division" is given as "ticks per quarter note", whereas in the midifile-file it is given in "frames per second and ticks per frame".
midifile: Header chunk division: "0x60: 96 ticks per quarter note" midifile: Header chunk division: "0xE714: 25 frames per second, 20 ticks per frame"
In the ableton-file there is an info given about the time signature: "Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note"
This info is not present after loading the file that i recorded with [midifile].
You have to add it yourself, since [midifile] has no idea what time signature or tempo you are using (when writing, the ticks don't have to be in real time). With the latest version of [midifile] there is a [meta( message for this. With earlier versions you can write the meta tags directly, for example to get the time signature, Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note you can send [255 88 4 4 36 8{ and the tempo [255 81 500000( sets 500000 microseconds per quarter note.
You can find more info here: http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html
Martin
Furthermore, looking at the first lines of the dump-info of the ableton-exported-file, we can see that there is also one note being played at tick 0, but I did not actually put a note there. The same applies for the [midifile]-recorded file. I did not play notes directly after hitting the record-[bang]. I don't know how these notes on the first tick (0) have gotten there.
As a side-note the help-patches that I am using are from 2010 (write-help-patch) and 2011 (read-help-patch). These were included in the mrpeach_v0-0-extended package that I downloaded via deken.
Best, Jakob
Hey Martin, thanks for your nice help. The last couple of days I spend some time with [midifile] and your information and now I found a way to record midifiles with [midifile] in a way that ableton understands them correctly. These are the steps that I have to do:
remember my time interval between one quarter note (eg. 500 ms) that my patch uses for [metro] to play melodies. This equals to eg. 60/(500 ms) = 120 bpm.
send meta information to [midifile] for setting time signature and tempo. Setting the tempo causes ableton to change its tempo when the midifile is pasted into a newly opened ableton session. For the time signature "4/4 36 clocks per tick 8 32nd notes per quarter note" I send a [255 88 4 4 2 36 8( to [midifile]. For the tempo of 120 bpm I need to set 500000 microseconds, so I send a [255 81 3 7 161 32( to [midifile]. For setting the tempo there is some math needed. If I want to set 500000 microseconds, first I convert 500000 to hex. This is 0x7A120. Now I need to convert this back to three seperate 8 bit decimal numbers because [midifile] expects it like that (and the midi-standard). So I do: 0x7 = 7, 0xA1 = 161 and 0x20 = 32 and send this to [midifile]. I will need to build a subpatch that does this calculation generically, because in my patch the tempo will vary. I have not thought about it more deeply, but maybe there is a more efficient way of calculating these three numbers.
set [metro 2] to [metro 1] and change set the fps-number that I send to [midifile] equally to my quarter-note-time-interval. With this I get an accurate timing in ableton. Eg for 120 bpm:
[metro 1] | [write myfile.mid 500( |/ [midifile]
Best regards, Jakob
Gesendet: Dienstag, 07. April 2020 um 17:25 Uhr Von: "Martin Peach" chakekatzil@gmail.com An: "Jakob Laue" jakkesprinter@web.de Cc: "Pd-List" pd-list@lists.iem.at Betreff: Re: Re: Re: Re: Re: [PD] including bpm info to midi-recording On Mon, Apr 6, 2020 at 3:27 AM Jakob Laue jakkesprinter@web.de wrote:
Hey Martin, thanks for your hints!
I created a midi file in ableton, exported it and then read it with the midifile-read-help-patch. This is what I get after reading:
midifile: opened /Users/wbjc/Desktop/ableton.mid midifile: Header chunk type: MThd midifile: Header chunk length: 6 midifile: Header chunk format: 0 (Single multichannel track) midifile: Header chunk ntrks: 1 midifile: Header chunk division: 0x60: 96 ticks per quarter note midifile: Track chunk 0 type: MTrk, length 81
And this is what I get after the |dump 0( message:
midifile: Parsing track[0]... midifile: tick 0 delta 0 status FF Meta 0x03 length 1 Sequence/Track Name midifile: tick 0 delta 0 status FF Meta 0x58 length 4 Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note midifile: tick 0 delta 0 status FF Meta 0x58 length 4 Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note midifile: tick 0 delta 0 status 90 MIDI 0x90 42 64 : channel 1 Note 66 On velocity 100 midifile: tick 24 delta 24 status 80 MIDI 0x80 42 40 : channel 1 Note 66 Off velocity 64 midifile: tick 72 delta 48 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 96 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 120 delta 24 status 90 MIDI 0x90 46 64 : channel 1 Note 70 On velocity 100 midifile: tick 144 delta 24 status 80 MIDI 0x80 46 40 : channel 1 Note 70 Off velocity 64 midifile: tick 168 delta 24 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 192 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 216 delta 24 status 90 MIDI 0x90 40 64 : channel 1 Note 64 On velocity 100 midifile: tick 240 delta 24 status 80 MIDI 0x80 40 40 : channel 1 Note 64 Off velocity 64 midifile: tick 264 delta 24 status 90 MIDI 0x90 45 64 : channel 1 Note 69 On velocity 100 midifile: tick 288 delta 24 status 80 MIDI 0x80 45 40 : channel 1 Note 69 Off velocity 64 midifile: tick 312 delta 24 status 90 MIDI 0x90 41 64 : channel 1 Note 65 On velocity 100 midifile: tick 336 delta 24 status 80 MIDI 0x80 41 40 : channel 1 Note 65 Off velocity 64 midifile: tick 336 delta 0 status FF Meta 0x2F length 0 ========End of Track 0==========
The differences that I noticed:
In the ableton-file the "header chunk division" is given as "ticks per quarter note", whereas in the midifile-file it is given in "frames per second and ticks per frame".
midifile: Header chunk division: "0x60: 96 ticks per quarter note" midifile: Header chunk division: "0xE714: 25 frames per second, 20 ticks per frame"
In the ableton-file there is an info given about the time signature: "Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note"
This info is not present after loading the file that i recorded with [midifile].
You have to add it yourself, since [midifile] has no idea what time signature or tempo you are using (when writing, the ticks don't have to be in real time). With the latest version of [midifile] there is a [meta( message for this. With earlier versions you can write the meta tags directly, for example to get the time signature, Time Signature 4/4 36 clocks per tick, 8 32nd notes per quarter note you can send [255 88 4 4 36 8{ and the tempo [255 81 500000( sets 500000 microseconds per quarter note.
You can find more info here: http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html
Martin
Furthermore, looking at the first lines of the dump-info of the ableton-exported-file, we can see that there is also one note being played at tick 0, but I did not actually put a note there. The same applies for the [midifile]-recorded file. I did not play notes directly after hitting the record-[bang]. I don't know how these notes on the first tick (0) have gotten there.
As a side-note the help-patches that I am using are from 2010 (write-help-patch) and 2011 (read-help-patch). These were included in the mrpeach_v0-0-extended package that I downloaded via deken.
Best, Jakob
Em sex., 3 de abr. de 2020 às 17:43, Jakob Laue jakkesprinter@web.de escreveu:
Hi, okay so I installed the mrpeach-v0-0-extended package from deken on my 0.48-vanilla on mac osx.
any reason why you're not using the latest 0.50-2?
Em sáb., 4 de abr. de 2020 às 17:47, Jakob Laue jakkesprinter@web.de escreveu:
Hey Alexandre, well, that is a legitimate question ;-) Well, I had not used pd for quite some time and then - one year ago - I started a big university project with the old version that I had installed. I installed many externals and set many startup flags and so on and I just did not want to do this all again as long as my university project was still going on.
flags and preferences don't get overwritten when you upgrade
On 4/3/20 8:30 PM, Jakob wrote:
Hey Martin, Thanks for your message. I looked for mrpeach in deken, but the only result I get is mrpeach for extended ( i am on mac os). Does that mean that I cannot use it?
there's no such thing as "for extended" on deken. there are many uploads that have a version numer "v0.0.extended" which means that this is the same version as was used in the last Pd-extended release.
if the external shows up in the deken search results, there's usually no reason to assume that it won't work, regardless of version. (although, if you only get a "v0.0.extended" version you can assume that either:
gfmarsd IOhannes
Hi! ah okay, sorry I did not know that. When I search for mrpeach in deken, I get mrpeach-v0-0-extended. Okay, well thanks for clarifying, then I will try that out.
Best, Jakob
Gesendet: Freitag, 03. April 2020 um 21:14 Uhr Von: "IOhannes m zmölnig" zmoelnig@iem.at An: pd-list@lists.iem.at Betreff: Re: [PD] including bpm info to midi-recording On 4/3/20 8:30 PM, Jakob wrote:
Hey Martin, Thanks for your message. I looked for mrpeach in deken, but the only result I get is mrpeach for extended ( i am on mac os). Does that mean that I cannot use it?
there's no such thing as "for extended" on deken. there are many uploads that have a version numer "v0.0.extended" which means that this is the same version as was used in the last Pd-extended release.
if the external shows up in the deken search results, there's usually no reason to assume that it won't work, regardless of version. (although, if you only get a "v0.0.extended" version you can assume that either:
gfmarsd IOhannes
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list