|
Thank you both,
I will try Daniel's method later.
However, I did write a function to do the t0 - t1, and I was not obtaining the correct durations. I see that you suggest that it may be because the time is given in 'ticks'. That's a useful information, thanks (even if I don't get what's a 'tick' :).
I will try to convert it to seconds.
Best
Luca
From: owner-sc-users@xxxxxxxxxxxxxxxx <owner-sc-users@xxxxxxxxxxxxxxxx> on behalf of jamshark70@xxxxxxxxx <jamshark70@xxxxxxxxx>
Sent: 07 March 2019 00:03 To: sc-users Subject: Re: [sc-users] SimpleMIDIFile, get the duration and onset-time of the events On Wed, Mar 6, 2019 at 10:57 PM <mr.lucedan@xxxxxxxxxx> wrote:
> I am using the SimpleMIDIFile UGen. It's a language-side class, not a server-side UGen. > The file does provide information for each event like this: [ 0, 1320, noteOn, 0, 50, 127 ] > I don't understand how to get the duration of the event. MIDI represents one note as two events: - noteOn with note number x at time t0 - noteOff with note number x at time t1 The duration, then, is t1 - t0. If you are looking at the noteOn event (array format in SimpleMIDIFile), then you know t0 (= 1320 in your example), but you don't know t1 yet. You have to scan forward in the list of notes until you find the next noteOff with the same note number. Then you have t1. It's not convenient. MIDI is designed for performance data, not musical-analytical data. > I believed that array[1] was the time in ms in which the event happens, but it is not (I have compared it against the actual midi playing). See `timeMode_()` -- 1320 looks like it's measured in "ticks" (internal MIDI representation). These are probably not meaningful to you. But you can set `myMIDIFile.timeMode = \seconds`. hjh _______________________________________________ sc-users mailing list info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx archive: https://listarc.bham.ac.uk/marchives/sc-users/ search: https://listarc.bham.ac.uk/lists/sc-users/search/ |