Re: Re: Re: [Lily4jedit-devel] My near plans
Brought to you by:
fodber
From: Joshua K. <zz...@la...> - 2004-11-27 01:02:13
|
Thanks for explaining the concepts of midi, it gave me a clearer view of what to do... Anyway I went to jsresources.org I found some good examples of working java and midi. I now working the MidiPlayer to detect Tempo, Time / Key Signature changes, lilypond does a good job of placing all these change infomation into the midi, so it shouldnt be a problem to detect them :) That webpage also have some samples on how to take in midi input like when u press your midi keyboard, should wouldnt be a problem if we decides to add midi input feature for lilypond. However, is there really no way we can know which bars the score is at? Maybe by detecting the bar numbers or bar lines... Maybe I leave that thought till later when the midiplayer more accurate at counting the beats. Joshua >Yes, this would be useful. However, I think we need a more precise method. >A lot of my lilypondings change tempo. See what I wrote about that below. > >> Dscho, if this works, the midiplayer can trigger the page flip in jdvi? >> this will make the page seems to be following the music. > >Yes, that's easy ;-). The LilyToolPlugin has a static member >"jdviInstance" of class jdvi.JDvi, which has a public member "dvi" of >class JDviViewerPanel, which has a member "page" of class JDviPanel. It is >relatively easy to write a method (I would do that) to search for a >certain special:src (those are the anchors for point-and-click) and make >sure that it is visible. Maybe the interface would look something like > > public void assureSrcIsVisible(int line,int column) > >I think the best place for this would be in JDvi, so that you can call > > jdviInstance.assureSrcIsVisible(line,column); > > >There are two problems: You have to find out line and column, not the beat >(and if there is more than one voice, this is ambiguous). And if you use >phrases, i.e. > >leloup = \notes \relative c' { d4 g8.( b16-.) d8-. e-. d8.-\>( b16) } > >then the jumping around could lead to confusion, as the phrase can be used >multiple times, thus being ambigous, too. So you should add a checkbox >"Try to follow score" to MidiPlayer. > >> 1 more question which i could figure the ans myself is what's the >> seekFirstTick method in the midiplayer for? > >In a MIDI file, the time is not measured in milliseconds, but rather in >ticks. A MIDI file normally says right at the beginning how many ticks are >supposed to be one quarter note. Thus, when the tempo changes, the quarter >note still has the same amount of ticks, and you just changed the duration >of one tick. When you record a MIDI, the MIDI file typically doesn't care >about that standard, but Lilypond does. So you could use the ticks instead >of calculating the time and dividing by the tempo, assuming that the tempo >hasn't changed. > >For ease of computation, some MIDI generators don't start at tick 0, >because there can be partial notes at the beginning. In order to start >with the first note, you call "getFirstTick()" to know what is the first >tick. > >Hth, >Dscho > |