Re: [PD] font issues/questions, and also discrepancies between operating systems

2020-04-15 Thread Matt Davey
is there a way to get osx to remember font settings?  It used to work
automatically, but now it doesn't.
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] including bpm info to midi-recording

2020-04-15 Thread Jakob Laue

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:
1) 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.

2) 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 50 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 50 microseconds, first I convert 50 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.
3) 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" 
An: "Jakob Laue" 
Cc: "Pd-List" 
Betreff: Re: Re: Re: Re: Re: [PD] including bpm info to midi-recording
On Mon, Apr 6, 2020 at 3:27 AM Jakob Laue  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