Note Duration

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Note Duration

ec0000
This post was updated on .
Comments by Louis carried over from user forum.

My original plan was to do a release soonish (although I am spending
less time on this now) that includes the music course i am putting
together. Then to make PB more fun to play by adding gaming features
-- like adding highscore and earning stars that light up as you play
and then to look at adding note durations. But I could swap the gaming
features with the note durations if you are serious about helping.

Warning a proper beautiful musical score is out of the question with
PB as the notes in the horizontal axis are on a fixed time grid and
cannot be space out as in properly typeset music. Then there are note
quantisation, rests, joining notes together with note beams, triplets
etc. I am in two minds about the note duration a) ditch the PB
scrolling score instead display a full musical score that does not
scroll using some other midi to score typesetting program or b) add
rudimentary note duration to  the PB scrolling score. For b) to work
the note stems would be need to smaller and fainter than the note
heads.

Any way let me know what you think about options a) and b) and if you
still want to help with b) the file to look at is draw.cpp and then
search for PB_SYMBOL_note. The notes are drawn rather than bitmaps as
I could not manage to get bitmaps working. As a first step you could
assume that the note duration has been already added to CSymbol.

By the way what synth are you using? the Windows XP synth latency
makes it very difficult to play along.
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
This post was updated on .
It goes back to the design goal of PB.

Are we supposed to look at the PB screen to play music as a training tool?
Does PB also double up as a game to keep up the learning interest?

If these are the goals, I would think note duration, being an important part of music, need to be included. Other part of music notation probably is more in the realm of performance rather than training.

Then the question is how do we do it.

Common choices are:
1) standard notation;
2) piano roll; or
3) alternate notation

I personally think placing notes on a time line is a good starting point. Typesetting for printing could be done by others such as MuseScore etc. PB could then focus on the training and gaming aspect. So I would vote for (b) i.e. to implement some kind of duration in PB.

Perhaps the following scheme may work.

1) Quantize the notes on the track that will be preformed by human.
    * We may want to ask the user to suggest the shortest note in beats as a guide.
2) Once that is done, we can assign the correct note duration to the notes in terms of common beats 1, 2, 3, 4, 1/2, 1/4, 1/8, 1/16, 2/3 etc.
3) To display the result on a uniform time line, we need to use the shortest note as the base drawing unit. We could use the width of the widest notes i.e. a note with a stem and a flag as the width of the drawing unit. This has the side effect of stretching the score. The final score may not look elegant but it should work.
4) We can then decide whether to paint the standard notation or the piano roll. We could even have both of them displayed.

What do you think?

Cheers
ec0000


Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
Thanks for your input - the design goals of PB is defiantly a fun way of learning to read music so I think b) is defiantly worth doing. learning the note timing is an important skill to learn. But as the PB notes are spaced on a fixed time grid the result will always be less than perfect (notes and bar lines will crash into each other etc).

Rendering a beautiful and complete musical score from a midi file is extremely difficult so I would in the long term like to do a) as well eventually. {long term plan - If there is a .png file of the printed score that matches .mid file name then the users could optionally display the display the .png file in place of the pb scrolling score.}


but getting back to b) we could complete b) in a series of small easy steps. The first step would be to get PB to draw the different note lengths. I would just suggest that we start with getting PB to drawing only the following Semibreve/Whole note, down to the Quaver/Eighth note and the dotted notes see

http://en.wikipedia.org/wiki/Modern_musical_symbols#Notes_and_rests

And for now we don't worry about rests, note beams, triples etc


I don't think I really favour using the piano roll notation for the note length although it is a possibility.

Do you have the programming skills/commitment to work on the drawing the different note durations?

I would prefer to first move to using bitmaps for drawing each note rather than manually line drawing each note which PB does at present.

L.

Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Hi Louis

I have programming background in many languages. But I am new to Qt and to some extend C++. I have read the Qt tutorial source code. Qt seems to be reasonably clean and not to hard to use.

But I am time poor as I am, like yourself, learning to play keyboard in my spare time.

I can investigate the bitmap drawing aspect over the week. But I cannot promise quick turn around time.

Cheers
ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
Don't worry about the bitmap drawing for now as I have started
experimenting with it myself. I think I know where went wrong when I
tried it before it was much too slow. Can you subscribe to this forum so
that you get an email when anyone posts. I will post my progress. Just
do as much or little as you want to.

By the way where about in the world are you located. I am near Kingston
Upon Thames in the UK.

Louis

On Sun, 2010-06-20 at 16:31 -0700, ec0000 [via Piano Booster] wrote:

> Hi Louis
> I have programming background in many languages. But I am new to Qt
> and to some extend C++. I have read the Qt tutorial source code. Qt
> seems to be reasonably clean and not to hard to use.
>
> But I am time poor as I am, like yourself, learning to play keyboard
> in my spare time time.
>
> I can investigate the bitmap drawing aspect over the week. But I
> cannot promise quick turn around time.
>
> Cheers
> ec0000
>
>
> ______________________________________________________________________
> View message @
> http://piano-booster.2625608.n2.nabble.com/Note-Duration-tp5200491p5202429.html 
> To start a new topic under Piano Booster Development, email ml-node
> +[hidden email]
> To unsubscribe from Piano Booster Development, click here.
>


Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Hi

I am in Sydney Australia.

Cheers
ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
Ok I have been slowly trying to get png images to work for the notes using opengl "texture mapping". It works but unfortunately I cannot get  transparency working which is no good as each .png image would be square and would cause problems with over laps. I am going to try the bitmap fonts next which should work Ok but with only pixels on or off (soft edges of the notes are not possible)

See:

http://www.glprogramming.com/red/chapter08.html#name1


file:///home/louis/active/pb/gltry/redbook/OpenGL%20Redbook%20Samples.html

Are still up for helping with this (how ever slowly) when I get the bitmap drawing working?

Louis
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Hi L.

I have spent some time reading your source code to understand how the whole thing hang together.

I also read the To-Do in Sourceforge. I can try some simple items on the list as a starting point.

-- ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
OK, although I have made some progress with bitmap drawing of the notes
this is just taking too long to solve some of the technical problems.
(The bit mapped fonts run far too slowly -- compared with manually
drawing the notes that we do at present -- on my under powered netbook
that I use. The mapped textures are working with blending but there are
still issues)

So I suggest that for now use the current technique to draw the other
types of note. I will add the note duration and note type to CSymbol and
leave you to draw the different note durations.

As for the todo list it is a bit out of date (I am updating it) if you
do start work on anything please let me know what it is.  



On Thu, 2010-07-01 at 06:25 -0700, ec0000 [via Piano Booster] wrote:

> Hi L.
>
> I have spent some time reading your source code to understand how the
> whole thing hang together.
>
> I also read the To-Do in Sourceforge. I can try some simply items on
> the list as a starting point.
>
> -- ec0000
>
>
> ______________________________________________________________________
> View message @
> http://piano-booster.2625608.n2.nabble.com/Note-Duration-tp5200491p5243382.html 
> To start a new topic under Piano Booster Development, email ml-node
> +[hidden email]
> To unsubscribe from Piano Booster Development, click here.
>



Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
In reply to this post by ec0000
Ok I have just committed to svn a version that does a very very basic note duration. run "pianobooster -L" to try it out.

it draws solid note shapes if the midi duration is Crotchet / Quarter note or shorter and hollow note shapes if the midi duration is Minim / Half note note or longer.

to improve the code look at  CNotation::calculateScoreNoteLength() and now CDraw::drawNote does the drawing of the different note lengths.

I have now stopped work on this for now so your help with this would be great. I am really not worried how quickly or slowly you make changes, it is entirely up to you! Just let me know please if you don't want to work on this at all. When you are ready let me have a patch and  i'll add it to the source tree.

By the way I have also updated the todo.txt in svn.


Louis

Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
In reply to this post by ec0000
Sorry I could not resist I have add some more improvements to the note duration in svn. Sorry if you have done a bit of work on this already there is still lots todo though.
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Haha....

I have just compiled your changes a couple of hours ago.

At this stage you will be a lot more efficient than me am as I am still trying to understand Qt.

Pls go ahead to do whatever you can.

I could help in other areas (later).

-- ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator
run pb compiled  from svn with -L (type "pianobooster -L) to see the experimental note duration. There is no dotted note duration yet. The CNotation::calculateScoreNoteLength() and CDraw::drawNote() needs loads more work. Help with this would be appreciated.

L.
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Hi L.

I tested the "-L" option, the duration is there.

It is weekend here so I will spend some time on the logic.

I tend to think CNotation::calculateScoreNoteLength() should not be too hard. I would think
1) we need to scan the NoteOn and NoteOff / NoteOn with Velocity = 0 pair to find the note length in ticks
2) we need to divide the length by the ticks in one beat to get the beat count
3) then we round up or down to nearest 1/2, 1/4, 1/8 or 1/16 beat.
     This part could be tricky. I think the user needs to provide the smallest note in beat as a starting point. This could be an iterative process. The user or the PB has to make a guess as a starting point. If the user thinks that is too hard or not correct, he should supply another value for the smallest note.

Is that the correct algorithm?

As a side note, if the midi file is a live recording with lots of variations then the note duration will be all over the place. But the problem is the midi file not the note duration algorithm. Other programs I have used all do the same thing e.g. Anvil Studio, Harmony Assistant. And they are matured products.


As for CDraw::drawNote(), I think you are drawing in OpenGL. I am not familiar with OpenGL enough to change your code yet.

Keep up the good work....But then only do as much as you can...

Cheers
-- ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

ec0000
Hi L.

I found a link with an algorithm of detecting the note duration similar to the idea I suggest but with more details. Unfortunately, the C lib link is broken.

http://stackoverflow.com/questions/2467995/actual-note-duration-from-midi-duration

I tend to think songs that beginners can play probably will not have double dots, or dotted 1/16 etc.

-- ec0000
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Louis B.
Administrator

Ok ec0000,

that link makes sense, a fixed time grid looks a very good idea that way
we can make all the notes and rests in the bar addup correctly to match
the time signature. To do this you will need time for each note/chord
from the start of the bar, I will change pb to add this info to each
Slot (a slot is used internally by PB to store a chord.


Extremely advanced pieces are too difficult for us to handle correctly
but for moderate piece I think we can do a reasonable job, we just have
to find the right level of quantisation. I have got a some commercial
software that does a very good job of this. The best results are when
you assume that notes are all Legato. (you ignore the midi note length
but instead assume the note/chord finishes at the beginning of the next
note/chord) This prevents lots of low value rests from appearing in the
score. Some times the pianist may use the sustain pedal instead of
keeping the keys pressed down. (Another reason not to trust the midi
note length).

I agree we won't need double dots or 1/16th (or triplets??).  

There is complication in that PB already has done some quantisation on
finding the chords ACROSS BOTH HANDS in the music. This NOT done on a
fixed grid but instead just finds notes that are close enough together.
We will have to change CFindChord::findChord() to match your
quantisation levels which may be bit a tricky.

Louis




On Sat, 2010-07-10 at 03:57 -0700, ec0000 [via Piano Booster] wrote:

> Hi L.
>
> I found a link with an algorithm of detecting the note duration
> similar to the idea I suggest but with more details. Unfortunately,
> the C lib link is broken.
>
> http://stackoverflow.com/questions/2467995/actual-note-duration-from-midi-duration
>
> I tend to think songs that beginners can play probably will not have
> double dots, or dotted 1/16 etc.
>
> -- ec0000
>
>
> ______________________________________________________________________
> View message @
> http://piano-booster.2625608.n2.nabble.com/Note-Duration-tp5200491p5277416.html 
> To start a new topic under Piano Booster Development, email ml-node
> +[hidden email]
> To unsubscribe from Piano Booster Development, click here.
>



Ion
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

Ion
Hey fellas.
I think this may be a bad solution since it involves using GNU Lillypond (which I am a fan of) but I recall someone mentioned the generation of a png file to scroll instead of the PB score.
Lilypond supports proportional notation. This is, the length of the note in the score is proportional to the actual duration. On the other hand Lilypond also supports midi generation, therefore a script could be written to alter the .ly file (the lilypond file) and generate a .ps or .pdf or .png file that contains a single line proportional score (already done this once, but manually, not with a script) and also a .midi file. If we could scroll the image file synchronously... pb does the rest already.
The problem with this approach is that pb would be a .ly dependent program instead of a .midi dependent one. I understand this is kinda tough, but it would allow us to focus on the gamification (I don't really like the word) of the learning process.
I can write the script if you make the image file scroll along.
Please tell me what you think.
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

gamby
What happened to this development? Does it work? Where's the code?

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Note Duration

romul