VexFlow JavaScript - Is there any way to fix multi voice with rest(r/4) not overlapping with note(c/5)?










0















How to bring rest not higher or lower (don't change key "r/4"). Link demo: JSFindle



Here is code demo:



// Create the notes

new VF.StaveNote( keys: ["c/4", "e/4", "g/4"], duration: "q" )


enter image description here










share|improve this question




























    0















    How to bring rest not higher or lower (don't change key "r/4"). Link demo: JSFindle



    Here is code demo:



    // Create the notes

    new VF.StaveNote( keys: ["c/4", "e/4", "g/4"], duration: "q" )


    enter image description here










    share|improve this question


























      0












      0








      0


      1






      How to bring rest not higher or lower (don't change key "r/4"). Link demo: JSFindle



      Here is code demo:



      // Create the notes

      new VF.StaveNote( keys: ["c/4", "e/4", "g/4"], duration: "q" )


      enter image description here










      share|improve this question
















      How to bring rest not higher or lower (don't change key "r/4"). Link demo: JSFindle



      Here is code demo:



      // Create the notes

      new VF.StaveNote( keys: ["c/4", "e/4", "g/4"], duration: "q" )


      enter image description here







      javascript xml angular frontend






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 10 at 3:11









      karel

      2,25462732




      2,25462732










      asked Aug 22 '18 at 9:47









      Thanh TranThanh Tran

      2316




      2316






















          1 Answer
          1






          active

          oldest

          votes


















          2














          It's not clear what you're trying to do musically, but looking at the JSFiddle, you have 2 voices on the same stave and the rest from the first voice is overlapping with the second note from the second voice.



          One voice creates the rest with this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          and another voice has a note at the same position as the rest:



           new VF.StaveNote( keys: ["c/5"], duration: "h" )


          Assuming that the note in the second voice is where you want it to be, you can control the vertical position of the rest in the first voice so that it doesn't overlap. You can do this by using a note letter indicating how high you want the rest to appear on the stave. For example replace this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          with this code:



           new VF.StaveNote( keys: ["c/4"], duration: "qr" ),


          and your rest will appear at C4 below the C5 note that it currently overlaps with.



          If you don't want to change key "r/4", you could change key "c/4" to avoid the overlap.



          If you really want the rest and note to appear at the same height on the stave but not overlapping, I think you will end up with something that is not readable as music, but you can always take complete control over the position of a StaveNote (either the note or the rest) by deriving your own class from StaveNote and overriding getAbsoluteX:



          class FixedStaveNote extends VF.StaveNote 
          getAbsoluteX()
          return 72;

          ;


          (You would need to do this for both of the overlapping StaveNotes and return different values. If you only do it for the first one, the formatter will align the second one to it).



          And finally if you want to control the vertical position of the rest without changing key "r/4", you could override calculateKeyProps:



          class FixedStaveNote extends VF.StaveNote 
          calculateKeyProps()
          super.calculateKeyProps();

          for (let i = 0; i < this.keyProps.length; ++i)
          const props = this.keyProps[i];
          if (props.key === 'R')
          props.line = 0;






          This changes the stave line at which the rest will appear.



          Here's an updated JSFiddle with no overlap using the override of calculateKeyProps.






          share|improve this answer

























          • You're awesome. Thank you.

            – Thanh Tran
            Nov 14 '18 at 10:38










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51964107%2fvexflow-javascript-is-there-any-way-to-fix-multi-voice-with-restr-4-not-over%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          It's not clear what you're trying to do musically, but looking at the JSFiddle, you have 2 voices on the same stave and the rest from the first voice is overlapping with the second note from the second voice.



          One voice creates the rest with this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          and another voice has a note at the same position as the rest:



           new VF.StaveNote( keys: ["c/5"], duration: "h" )


          Assuming that the note in the second voice is where you want it to be, you can control the vertical position of the rest in the first voice so that it doesn't overlap. You can do this by using a note letter indicating how high you want the rest to appear on the stave. For example replace this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          with this code:



           new VF.StaveNote( keys: ["c/4"], duration: "qr" ),


          and your rest will appear at C4 below the C5 note that it currently overlaps with.



          If you don't want to change key "r/4", you could change key "c/4" to avoid the overlap.



          If you really want the rest and note to appear at the same height on the stave but not overlapping, I think you will end up with something that is not readable as music, but you can always take complete control over the position of a StaveNote (either the note or the rest) by deriving your own class from StaveNote and overriding getAbsoluteX:



          class FixedStaveNote extends VF.StaveNote 
          getAbsoluteX()
          return 72;

          ;


          (You would need to do this for both of the overlapping StaveNotes and return different values. If you only do it for the first one, the formatter will align the second one to it).



          And finally if you want to control the vertical position of the rest without changing key "r/4", you could override calculateKeyProps:



          class FixedStaveNote extends VF.StaveNote 
          calculateKeyProps()
          super.calculateKeyProps();

          for (let i = 0; i < this.keyProps.length; ++i)
          const props = this.keyProps[i];
          if (props.key === 'R')
          props.line = 0;






          This changes the stave line at which the rest will appear.



          Here's an updated JSFiddle with no overlap using the override of calculateKeyProps.






          share|improve this answer

























          • You're awesome. Thank you.

            – Thanh Tran
            Nov 14 '18 at 10:38















          2














          It's not clear what you're trying to do musically, but looking at the JSFiddle, you have 2 voices on the same stave and the rest from the first voice is overlapping with the second note from the second voice.



          One voice creates the rest with this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          and another voice has a note at the same position as the rest:



           new VF.StaveNote( keys: ["c/5"], duration: "h" )


          Assuming that the note in the second voice is where you want it to be, you can control the vertical position of the rest in the first voice so that it doesn't overlap. You can do this by using a note letter indicating how high you want the rest to appear on the stave. For example replace this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          with this code:



           new VF.StaveNote( keys: ["c/4"], duration: "qr" ),


          and your rest will appear at C4 below the C5 note that it currently overlaps with.



          If you don't want to change key "r/4", you could change key "c/4" to avoid the overlap.



          If you really want the rest and note to appear at the same height on the stave but not overlapping, I think you will end up with something that is not readable as music, but you can always take complete control over the position of a StaveNote (either the note or the rest) by deriving your own class from StaveNote and overriding getAbsoluteX:



          class FixedStaveNote extends VF.StaveNote 
          getAbsoluteX()
          return 72;

          ;


          (You would need to do this for both of the overlapping StaveNotes and return different values. If you only do it for the first one, the formatter will align the second one to it).



          And finally if you want to control the vertical position of the rest without changing key "r/4", you could override calculateKeyProps:



          class FixedStaveNote extends VF.StaveNote 
          calculateKeyProps()
          super.calculateKeyProps();

          for (let i = 0; i < this.keyProps.length; ++i)
          const props = this.keyProps[i];
          if (props.key === 'R')
          props.line = 0;






          This changes the stave line at which the rest will appear.



          Here's an updated JSFiddle with no overlap using the override of calculateKeyProps.






          share|improve this answer

























          • You're awesome. Thank you.

            – Thanh Tran
            Nov 14 '18 at 10:38













          2












          2








          2







          It's not clear what you're trying to do musically, but looking at the JSFiddle, you have 2 voices on the same stave and the rest from the first voice is overlapping with the second note from the second voice.



          One voice creates the rest with this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          and another voice has a note at the same position as the rest:



           new VF.StaveNote( keys: ["c/5"], duration: "h" )


          Assuming that the note in the second voice is where you want it to be, you can control the vertical position of the rest in the first voice so that it doesn't overlap. You can do this by using a note letter indicating how high you want the rest to appear on the stave. For example replace this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          with this code:



           new VF.StaveNote( keys: ["c/4"], duration: "qr" ),


          and your rest will appear at C4 below the C5 note that it currently overlaps with.



          If you don't want to change key "r/4", you could change key "c/4" to avoid the overlap.



          If you really want the rest and note to appear at the same height on the stave but not overlapping, I think you will end up with something that is not readable as music, but you can always take complete control over the position of a StaveNote (either the note or the rest) by deriving your own class from StaveNote and overriding getAbsoluteX:



          class FixedStaveNote extends VF.StaveNote 
          getAbsoluteX()
          return 72;

          ;


          (You would need to do this for both of the overlapping StaveNotes and return different values. If you only do it for the first one, the formatter will align the second one to it).



          And finally if you want to control the vertical position of the rest without changing key "r/4", you could override calculateKeyProps:



          class FixedStaveNote extends VF.StaveNote 
          calculateKeyProps()
          super.calculateKeyProps();

          for (let i = 0; i < this.keyProps.length; ++i)
          const props = this.keyProps[i];
          if (props.key === 'R')
          props.line = 0;






          This changes the stave line at which the rest will appear.



          Here's an updated JSFiddle with no overlap using the override of calculateKeyProps.






          share|improve this answer















          It's not clear what you're trying to do musically, but looking at the JSFiddle, you have 2 voices on the same stave and the rest from the first voice is overlapping with the second note from the second voice.



          One voice creates the rest with this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          and another voice has a note at the same position as the rest:



           new VF.StaveNote( keys: ["c/5"], duration: "h" )


          Assuming that the note in the second voice is where you want it to be, you can control the vertical position of the rest in the first voice so that it doesn't overlap. You can do this by using a note letter indicating how high you want the rest to appear on the stave. For example replace this code:



           new VF.StaveNote( keys: ["r/4"], duration: "qr" ),


          with this code:



           new VF.StaveNote( keys: ["c/4"], duration: "qr" ),


          and your rest will appear at C4 below the C5 note that it currently overlaps with.



          If you don't want to change key "r/4", you could change key "c/4" to avoid the overlap.



          If you really want the rest and note to appear at the same height on the stave but not overlapping, I think you will end up with something that is not readable as music, but you can always take complete control over the position of a StaveNote (either the note or the rest) by deriving your own class from StaveNote and overriding getAbsoluteX:



          class FixedStaveNote extends VF.StaveNote 
          getAbsoluteX()
          return 72;

          ;


          (You would need to do this for both of the overlapping StaveNotes and return different values. If you only do it for the first one, the formatter will align the second one to it).



          And finally if you want to control the vertical position of the rest without changing key "r/4", you could override calculateKeyProps:



          class FixedStaveNote extends VF.StaveNote 
          calculateKeyProps()
          super.calculateKeyProps();

          for (let i = 0; i < this.keyProps.length; ++i)
          const props = this.keyProps[i];
          if (props.key === 'R')
          props.line = 0;






          This changes the stave line at which the rest will appear.



          Here's an updated JSFiddle with no overlap using the override of calculateKeyProps.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 '18 at 12:55

























          answered Nov 13 '18 at 9:59









          CCoderCCoder

          341138




          341138












          • You're awesome. Thank you.

            – Thanh Tran
            Nov 14 '18 at 10:38

















          • You're awesome. Thank you.

            – Thanh Tran
            Nov 14 '18 at 10:38
















          You're awesome. Thank you.

          – Thanh Tran
          Nov 14 '18 at 10:38





          You're awesome. Thank you.

          – Thanh Tran
          Nov 14 '18 at 10:38



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51964107%2fvexflow-javascript-is-there-any-way-to-fix-multi-voice-with-restr-4-not-over%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Crossroads (UK TV series)

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế