Re: Small pitch bends correct and tested. (issue4654063)
lemniskata.bernoull...@gmail.com wrote: Graham, I'm worried that i don't hear anything from you since 2 weeks! Do you experience any problems with fixing code style issues pointed to by Neil? Is that me? I'm supposed to do something? Here's a patch Graham From 2d6bc54fa0cf64ff6ca9be6ce575fdb427ca784a Mon Sep 17 00:00:00 2001 From: Graham Breed gbr...@gmail.com Date: Mon, 11 Jul 2011 10:23:52 +0100 Subject: [PATCH 3/3] Formatting from Neil --- lily/midi-item.cc |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 02bdd7a..aa96849 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -199,8 +199,8 @@ int Midi_note::get_semitone_pitch () const { double tune = double ((audio_-pitch_.tone_pitch () - + audio_-transposing_.tone_pitch ()) * Rational (2)); - return (tune 0)? int (tune + 0.5): int(tune - 0.5); + + audio_-transposing_.tone_pitch ()) * Rational (2)); + return int (rint (tune)); } string @@ -213,7 +213,7 @@ Midi_note::to_string () const // print warning if fine tuning was needed, HJJ if (get_fine_tuning () != 0) { - finetune = PITCH_WHEEL_CENTER + get_fine_tuning(); + finetune = PITCH_WHEEL_CENTER + get_fine_tuning (); str += ::to_string ((char) (0xE0 + channel_)); str += ::to_string ((char) (finetune 0x7F)); -- 1.7.0.4 ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
2011/7/11 Graham Breed gbr...@gmail.com: Is that me? I'm supposed to do something? Here's a patch Perfect! Mike: please push this. Colin: sorry for overlooking that the countdown was over. We definately need an integrated patch/issue tracker! cheers, Janek From 54d259942dd3a7d0c5461ca71b111796be2f59ec Mon Sep 17 00:00:00 2001 From: Graham Breed gbr...@gmail.com Date: Fri, 24 Jun 2011 00:12:52 +0100 Subject: [PATCH] Pitch bends of full precision centered on zero. --- lily/midi-item.cc | 16 ++-- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 1fcb259..aa96849 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -28,10 +28,8 @@ #include string-convert.hh #include warn.hh -#define PITCH_WHEEL_TOP 0x3FFF #define PITCH_WHEEL_CENTER 0x2000 -#define PITCH_WHEEL_BOTTOM 0x -#define PITCH_WHEEL_RANGE (PITCH_WHEEL_TOP - PITCH_WHEEL_BOTTOM) +#define PITCH_WHEEL_SEMITONE 0X1000 Midi_item * Midi_item::get_midi (Audio_item *a) @@ -193,15 +191,16 @@ Midi_note::get_fine_tuning () const + audio_-transposing_.tone_pitch ()) * Rational (2); tune -= Rational (get_semitone_pitch ()); - tune *= 100; + tune *= PITCH_WHEEL_SEMITONE; return (int) double (tune); } int Midi_note::get_semitone_pitch () const { - return int (double ((audio_-pitch_.tone_pitch () - + audio_-transposing_.tone_pitch ()) * Rational (2))); + double tune = double ((audio_-pitch_.tone_pitch () + + audio_-transposing_.tone_pitch ()) * Rational (2)); + return int (rint (tune)); } string @@ -214,10 +213,7 @@ Midi_note::to_string () const // print warning if fine tuning was needed, HJJ if (get_fine_tuning () != 0) { - finetune = PITCH_WHEEL_CENTER; - // Move pitch wheel to a shifted position. - // The pitch wheel range (of 4 semitones) is multiplied by the cents. - finetune += (PITCH_WHEEL_RANGE *get_fine_tuning ()) / (4 * 100); + finetune = PITCH_WHEEL_CENTER + get_fine_tuning (); str += ::to_string ((char) (0xE0 + channel_)); str += ::to_string ((char) (finetune 0x7F)); -- 1.7.0.4 ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
2011/7/11 Janek Warchoł lemniskata.bernoull...@gmail.com: 2011/7/11 Graham Breed gbr...@gmail.com: Is that me? I'm supposed to do something? Here's a patch Perfect! Mike: please push this. Please don't push without adding a commit message. Thanks, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
2011/7/11 Janek Warchoł lemniskata.bernoull...@gmail.com: Sorry, i didn't notice. Attached is a nicely described patch. Thanks, pushed to master. Cheers, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
Graham, I'm worried that i don't hear anything from you since 2 weeks! Do you experience any problems with fixing code style issues pointed to by Neil? If you are very busy, i can fix them myself, but i'd prefer that you fix them and send me the collection of all patches, up-to-date (this will minimize the risk of messing something up). If you encounter any problems with git, i'll gladly help. cheers, Janek On 2011/06/26 13:13:50, Neil Puttock wrote: LGTM. http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc File lily/midi-item.cc (right): http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode202 lily/midi-item.cc:202: + audio_-transposing_.tone_pitch ()) * Rational (2)); indent: ((audio_ + audio http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode203 lily/midi-item.cc:203: return (tune 0)? int (tune + 0.5): int(tune - 0.5); int (rint (tune)); http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode216 lily/midi-item.cc:216: finetune = PITCH_WHEEL_CENTER + get_fine_tuning(); get_fine_tuning (); http://codereview.appspot.com/4654063/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
LGTM, with Neil's comments taken Carl http://codereview.appspot.com/4654063/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
Colin Campbell c...@shaw.ca wrote: Thanks for this, Graham! I've added this to the tracker as issue 1711. Can you also provide a test file which would demonstrate the problem? I recognise this may not be all that easy to do, but it would help in verifying the fix. Here's an example based on one Richard Sabey sent me. In 2.14.1, the sixth tone sharp g comes out as a flattened g sharp. The pitch bend message is 0xe0 0x71 0x2a and the note-on 0x90 0x38 0x5a. Without pitch bends, g the note-on is 0x90 0x37 0x5a, so g is 0x37 not 0x38. The third byte of the pitch bend should be between 0x30 and 0x50 if they're minimized. A one semitone pitch bend is 0x1000. The f is flat by a f is flat by a sixth tone or a third of a semitone, so the LSB of the bend should be (-0x1000/-3)0x7f or (0x4000 - 0x2000/6)0x7f, which is either 0x2a or 0x2b depending on how you round it. With 2.1.14, it's 0x39 (0xe0 0x39 0x35) and with the patch it's 0xe0 0x2b 0x35. Graham \version 2.12.3 xxxivPitchNames = #`( (f . ,(ly:make-pitch -1 3 -1/6)) (g . ,(ly:make-pitch -1 4 1/6)) ) #(ly:parser-set-note-names parser xxxivPitchNames) \score { \new Staff { g4 f } \midi { } } ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
LGTM. http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc File lily/midi-item.cc (right): http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode202 lily/midi-item.cc:202: + audio_-transposing_.tone_pitch ()) * Rational (2)); indent: ((audio_ + audio http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode203 lily/midi-item.cc:203: return (tune 0)? int (tune + 0.5): int(tune - 0.5); int (rint (tune)); http://codereview.appspot.com/4654063/diff/1/lily/midi-item.cc#newcode216 lily/midi-item.cc:216: finetune = PITCH_WHEEL_CENTER + get_fine_tuning(); get_fine_tuning (); http://codereview.appspot.com/4654063/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Small pitch bends correct and tested. (issue4654063)
Reviewers: gbreed, Message: Graham Breed wrote: I've found and patched two problems with the pitch bend tuning code: 1) The pitch isn't always rounded to the nearest equally tempered value, so the result looks strange in a sequencer, and artifacts caused by the pitch bends are more severe. 2) The tuning is rounded to cents before the pitch bends are calculated. It may not be a big deal, but there's no need for it, and the code's simpler calculating the bends directly. I don't think either of these are registered issues. As I'm new with Git, the two issues are mixed in the two patches. Problem (1) is fixed in get_semitone_pitch(). It's just a question of rounding off the result. Everything else is for problem (2). Description: Small pitch bends correct and tested. Pitch bends are not rounded to cents. Pitch bends of full precision centered on zero. Please review this at http://codereview.appspot.com/4654063/ Affected files: M lily/midi-item.cc Index: lily/midi-item.cc diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 1fcb259ae13c2c0b6b0ee94967476cd8099f3928..02bdd7ac84b1e09cd44afb71873da4984d494a03 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -28,10 +28,8 @@ #include string-convert.hh #include warn.hh -#define PITCH_WHEEL_TOP 0x3FFF #define PITCH_WHEEL_CENTER 0x2000 -#define PITCH_WHEEL_BOTTOM 0x -#define PITCH_WHEEL_RANGE (PITCH_WHEEL_TOP - PITCH_WHEEL_BOTTOM) +#define PITCH_WHEEL_SEMITONE 0X1000 Midi_item * Midi_item::get_midi (Audio_item *a) @@ -193,15 +191,16 @@ Midi_note::get_fine_tuning () const + audio_-transposing_.tone_pitch ()) * Rational (2); tune -= Rational (get_semitone_pitch ()); - tune *= 100; + tune *= PITCH_WHEEL_SEMITONE; return (int) double (tune); } int Midi_note::get_semitone_pitch () const { - return int (double ((audio_-pitch_.tone_pitch () - + audio_-transposing_.tone_pitch ()) * Rational (2))); + double tune = double ((audio_-pitch_.tone_pitch () + + audio_-transposing_.tone_pitch ()) * Rational (2)); + return (tune 0)? int (tune + 0.5): int(tune - 0.5); } string @@ -214,10 +213,7 @@ Midi_note::to_string () const // print warning if fine tuning was needed, HJJ if (get_fine_tuning () != 0) { - finetune = PITCH_WHEEL_CENTER; - // Move pitch wheel to a shifted position. - // The pitch wheel range (of 4 semitones) is multiplied by the cents. - finetune += (PITCH_WHEEL_RANGE *get_fine_tuning ()) / (4 * 100); + finetune = PITCH_WHEEL_CENTER + get_fine_tuning(); str += ::to_string ((char) (0xE0 + channel_)); str += ::to_string ((char) (finetune 0x7F)); ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Small pitch bends correct and tested. (issue4654063)
On 11-06-25 02:13 PM, lemniskata.bernoull...@gmail.com wrote: Graham Breed wrote: I've found and patched two problems with the pitch bend tuning code: 1) The pitch isn't always rounded to the nearest equally tempered value, so the result looks strange in a sequencer, and artifacts caused by the pitch bends are more severe. 2) The tuning is rounded to cents before the pitch bends are calculated. It may not be a big deal, but there's no need for it, and the code's simpler calculating the bends directly. I don't think either of these are registered issues. As I'm new with Git, the two issues are mixed in the two patches. Problem (1) is fixed in get_semitone_pitch(). It's just a question of rounding off the result. Everything else is for problem (2). Thanks for this, Graham! I've added this to the tracker as issue 1711. Can you also provide a test file which would demonstrate the problem? I recognise this may not be all that easy to do, but it would help in verifying the fix. Colin Campbell Bug Squad -- The human race has one really effective weapon, and that is laughter. -- Mark Twain ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel