pitch error

3 messages Options
Embed this post
Permalink
Raffaele-3

pitch error

Reply Threaded More More options
Print post
Permalink
Hi all,
I'm working on the MusicXML export code to correct some bugs that I
found working with Musescore and Finale...
In particular there's a little bug in the pitch calculation algorithm
but I'm having difficulty to figure out how to solve.

The problem arise with notes like B#. The algorithm is calculating
correctly the note name but it goes wrong with the octave and the
alter tags.
For example, a B# in the fourth octave is translated into:
<pitch>
  <step>B</step>
  <alter>-11</alter>
  <octave>5</octave>
</pitch>

The error arise because the pitch is effectively part of the fifth
octave but the note is on the fourth octave...
This code in my opinion is wrong:
int pitch  = note->pitch() - 12;
octave     = pitch / 12;

But...I don't understand clearly how to calculate the real octave of a
note on the score...

Any suggestions?

Thank you,
Raffaele

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
lasconic

Re: pitch error

Reply Threaded More More options
Print post
Permalink
Hi,
I took a quick look. As far as I understand the case of Cb is solved
by the if (alter > 2) clause.
For B#, we might want to add the same ?

Lasconic

2009/7/21 Raf <[hidden email]>:

> Hi all,
> I'm working on the MusicXML export code to correct some bugs that I
> found working with Musescore and Finale...
> In particular there's a little bug in the pitch calculation algorithm
> but I'm having difficulty to figure out how to solve.
>
> The problem arise with notes like B#. The algorithm is calculating
> correctly the note name but it goes wrong with the octave and the
> alter tags.
> For example, a B# in the fourth octave is translated into:
> <pitch>
>  <step>B</step>
>  <alter>-11</alter>
>  <octave>5</octave>
> </pitch>
>
> The error arise because the pitch is effectively part of the fifth
> octave but the note is on the fourth octave...
> This code in my opinion is wrong:
> int pitch  = note->pitch() - 12;
> octave     = pitch / 12;
>
> But...I don't understand clearly how to calculate the real octave of a
> note on the score...
>
> Any suggestions?
>
> Thank you,
> Raffaele
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Mscore-developer mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mscore-developer
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
lasconic

Re: pitch error

Reply Threaded More More options
Print post
Permalink
Hack commited in r1940
Btw, if you have not copyrighted musicXML files to test. Feel free to share :)

Lasconic

2009/7/21 Lasconic <[hidden email]>:

> Hi,
> I took a quick look. As far as I understand the case of Cb is solved
> by the if (alter > 2) clause.
> For B#, we might want to add the same ?
>
> Lasconic
>
> 2009/7/21 Raf <[hidden email]>:
>> Hi all,
>> I'm working on the MusicXML export code to correct some bugs that I
>> found working with Musescore and Finale...
>> In particular there's a little bug in the pitch calculation algorithm
>> but I'm having difficulty to figure out how to solve.
>>
>> The problem arise with notes like B#. The algorithm is calculating
>> correctly the note name but it goes wrong with the octave and the
>> alter tags.
>> For example, a B# in the fourth octave is translated into:
>> <pitch>
>>  <step>B</step>
>>  <alter>-11</alter>
>>  <octave>5</octave>
>> </pitch>
>>
>> The error arise because the pitch is effectively part of the fifth
>> octave but the note is on the fourth octave...
>> This code in my opinion is wrong:
>> int pitch  = note->pitch() - 12;
>> octave     = pitch / 12;
>>
>> But...I don't understand clearly how to calculate the real octave of a
>> note on the score...
>>
>> Any suggestions?
>>
>> Thank you,
>> Raffaele
>>
>> ------------------------------------------------------------------------------
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>> details at: http://p.sf.net/sfu/Challenge
>> _______________________________________________
>> Mscore-developer mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/mscore-developer
>>
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer