Sorry its my mistake I didnt understand the sources well enough and
asked a silly question again. The name string is the pitch.
If the following code is okay with you,
-------code start -------
//to end to the back of NoteToken Class
public String getPitch() {
return name;
}
public int getPitchPos() {
return NoteNameMap.NM.getPos(getPitch());
}
public Note toNote() {
Note note = new Note(getPitchPos());
note.setDuration(getDurFraction()); // Is there a better way to store
duration in the note class, eg. using singer integer and can be
converted to string or fraction easily?
//todo
//Note Class - constructor for creating a note object with pitch,
duration, and extras (slurs, dynamics, ...)
return note;
/*
// is it better for conversion to be in this method or inside Note
constructor?
return new Note(this);
*/
}
------ code end----
then I can commit it when I back at home.
After this it would be easier to write an absolute to relative converter.
Joshua
On Tue, 30 Nov 2004 11:51:57 +0800, Joshua Koo <jos...@gm...> wrote:
> Bert,
>
> I would like to know whats the way to getting note position from Note Token.
>
> eg. c4 would get 0, c' to 12, d to 2 and so on...
>
> Since notetoken has a method for obtaining its duration fraction,
> should there be a method in NoteToken for obtaining its note position.
> Or would it better to have a "NoteToken to Note" converter.
>
> I assume that after parsing the notetoken to get the note string, it
> would be easily to convert the position using the NoteNameMap class.
>
> Joshua
>
|