Method for displaying pitch bars and computer-readable storage media

By calculating the horizontal and vertical positions of the pitch bars and drawing them, the problem of aligning the score with the pitch bars was solved, the alignment of notes with the pitch bars was achieved, and the ability to correct errors during performance was improved.

CN116863790BActive Publication Date: 2025-11-14FUJIAN STAR NET EVIDEO INFORMATION SYST CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310833354.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-07
Publication Date
2025-11-14
Estimated Expiration
2043-07-07

AI Technical Summary

Technical Problem

In existing technology, the musical score and pitch bar lack alignment, making it difficult to correct note errors in a timely manner during performance.

Method used

By obtaining note and measure information from the score file, the horizontal and vertical positions of the pitch bars are calculated, and the pitch bars are drawn on the canvas, ensuring that the notes are aligned with the pitch bars.

Benefits of technology

It achieves the alignment of notes with pitch bars while keeping the score structure unchanged, allowing users to observe the duration of notes in real time and improve singing accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116863790B_ABST
    Figure CN116863790B_ABST
Patent Text Reader

Abstract

This invention discloses a method for displaying pitch bars and a computer-readable storage medium. The method involves acquiring a musical score file and obtaining the score information for each line; traversing each line of the score and sequentially acquiring one line as the current line; drawing the score graphic of the current line on a canvas and obtaining the horizontal start and end positions of each measure in the score graphic; determining the start and end times of each note and measure in the current line based on the score information; calculating the horizontal start and end positions of the pitch bars corresponding to each note in the current line based on the start and end times of each note and the start and end times and horizontal start and end positions of their respective measures; and drawing the corresponding pitch bar graphic in the pitch bar area based on the horizontal start and end positions of the pitch bars corresponding to each note in the current line. This invention can align the pitch bars of the musical scores with the musical notes while maintaining the original score structure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of multimedia technology, and in particular to a method for displaying a musical note pitch bar and a computer-readable storage medium. Background Technology

[0002] In music score teaching, it is generally necessary to compare the standard pitch bar with the user's singing pitch bar to indicate the accuracy of the user's pitch and rhythm in the singing process, so as to achieve the purpose of error correction.

[0003] In existing technologies, the musical score and the standard pitch bar are generally displayed without being aligned. One method is to display the musical score in one separate area and the pitch bar in another separate area. Using this method, there is no correspondence or alignment between the musical score and the standard pitch bar.

[0004] Another approach is to first display the sheet music as a single long line; then, below this long line, a standard pitch bar, also displayed as a long line. In this method, the sheet music and the pitch bar are drawn independently, without alignment. During performance, these two lines scroll to the current moment. Because this presentation lacks a one-to-one correspondence between the sheet music notes and the pitch bar, it's difficult to immediately identify any errors in note pronunciation. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a method for displaying pitch bars of musical notes and a computer-readable storage medium, which can align the pitch bars of musical notes with the musical notes while ensuring that the structure of the musical score remains unchanged.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for displaying a musical note pitch bar, comprising:

[0007] Obtain the sheet music file, and based on the sheet music file, obtain the sheet music information for each line of the score. The sheet music information includes note information, measure information, and tempo. The note information includes the pitch value of the note and the number of beats of the note.

[0008] Iterate through each line of the score in the score file and obtain one line of score in sequence as the current line of score.

[0009] Based on the score information of the current line of music, draw the score graphic of the current line of music on the canvas, and obtain the horizontal start and end positions of each measure in the score graphic, the horizontal start and end positions include the horizontal start position and the horizontal end position.

[0010] Based on the musical score information of the current line of music, determine the start and end times of each note and the start and end times of each measure in the current line of music. The start and end times include the start time and the end time.

[0011] Calculate the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, based on the start and end times of each note and the start and end times of the measure to which it belongs;

[0012] Based on the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, draw the pitch bar graphics corresponding to each note in the current line of the score in the corresponding pitch bar area.

[0013] The present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0014] The beneficial effects of this invention are as follows: By processing and drawing each line of the score file line by line, the score structure remains unchanged, meaning the final displayed score layout is consistent with the score file; by determining the horizontal start and end positions of the pitch bars corresponding to the notes based on the start and end times of the notes and the start and end times and horizontal start and end positions of their respective measures, the alignment of the notes and their pitch bars is ensured, allowing users to observe the pitch bars corresponding to each note in real time and intuitively during performance. This invention can align the pitch bars with the notes while maintaining the unchanged score structure. Attached Figure Description

[0015] Figure 1 A flowchart illustrating a method for displaying a musical note pitch bar according to the present invention;

[0016] Figure 2 This is a flowchart of the method according to Embodiment 1 of the present invention;

[0017] Figure 3 This is a schematic diagram illustrating the display effect of Embodiment 1 of the present invention;

[0018] Figure 4 This is a schematic diagram of the display effect of the pitch bar in Embodiment 2 of the present invention. Figure 1 ;

[0019] Figure 5 This is a schematic diagram of the display effect of the pitch bar in Embodiment 2 of the present invention. Figure 2 . Detailed Implementation

[0020] To explain the technical content, objectives, and effects of the present invention in detail, the following description is provided in conjunction with the embodiments and accompanying drawings.

[0021] Please see Figure 1 A method for displaying a note pitch bar, comprising:

[0022] Obtain the sheet music file, and based on the sheet music file, obtain the sheet music information for each line of the score. The sheet music information includes note information, measure information, and tempo. The note information includes the pitch value of the note and the number of beats of the note.

[0023] Iterate through each line of the score in the score file and obtain one line of score in sequence as the current line of score.

[0024] Based on the score information of the current line of music, draw the score graphic of the current line of music on the canvas, and obtain the horizontal start and end positions of each measure in the score graphic, the horizontal start and end positions include the horizontal start position and the horizontal end position.

[0025] Based on the musical score information of the current line of music, determine the start and end times of each note and the start and end times of each measure in the current line of music. The start and end times include the start time and the end time.

[0026] Calculate the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, based on the start and end times of each note and the start and end times of the measure to which it belongs;

[0027] Based on the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, draw the pitch bar graphics corresponding to each note in the current line of the score in the corresponding pitch bar area.

[0028] As can be seen from the above description, the beneficial effect of the present invention is that, while ensuring that the structure of the musical score remains unchanged, the pitch bar can be aligned with the notes, allowing the user to easily and in real time observe the duration of each note during the singing process.

[0029] In an optional embodiment, before drawing the score graphic of the current line of music on the canvas based on the score information of the current line of music, the method further includes:

[0030] Create a canvas, and construct a two-dimensional coordinate system with the top left corner of the canvas as the origin, the rightward direction as the positive X-axis, and the downward direction as the positive Y-axis.

[0031] In an optional embodiment, after drawing the score graphic of the current line of music on the canvas based on the score information of the current line of music, and obtaining the horizontal start and end positions of each measure in the score graphic, the method further includes:

[0032] Obtain the vertical bottom position of the musical score graphic;

[0033] Based on the pitch values ​​of each note in the current line of the score, determine the maximum and minimum pitch values ​​of the current line of the score;

[0034] Calculate the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, as well as the preset mapping coefficients and upper and lower margin values;

[0035] Based on the pitch values ​​of each note in the current line of the score, the minimum pitch value of the current line of the score, the vertical bottom position of the score graphic, the height of the pitch bar area, and the preset mapping coefficients and upper and lower margin values, calculate the vertical position of the pitch bar corresponding to each note in the current line of the score.

[0036] As described above, by determining the height of the corresponding pitch area based on the maximum and minimum pitch values ​​in each line of the score, the height of the pitch area dynamically adapts to the pitch difference of each line of the score. Compared to a fixed pitch area height, this ensures that the pitch bars have reasonable display space while maintaining the compactness of the overall layout. Furthermore, by determining the vertical position of the pitch bars based on the pitch values ​​of the notes, the pitch relationship between different pitch bars can be intuitively displayed.

[0037] In an optional embodiment, after calculating the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, preset mapping coefficients, and upper and lower margin values, the process further includes:

[0038] Based on the horizontal start position of the first measure, the horizontal end position of the last measure, the vertical bottom position of the score graphic, and the height of the corresponding pitch bar area, the pitch bar area corresponding to the current line of the score is determined below the score graphic of the current line of the score.

[0039] As can be seen from the above description, strict alignment between the score and the pitch bar area can be guaranteed.

[0040] In an optional embodiment, after determining the pitch bar area corresponding to the current line of the score below the score graphic based on the horizontal start position of the first measure, the horizontal end position of the last measure, the vertical bottom position of the score image, and the height of the corresponding pitch bar area, the process further includes:

[0041] Draw vertical lines in the corresponding pitch bar area of ​​the current musical notation based on the horizontal end position of each measure in the current musical notation.

[0042] As described above, measure dividing lines can be drawn within the pitch bar area to separate the pitch bars of each measure, thus making it clearer to see the measure to which each pitch bar belongs.

[0043] In an optional embodiment, the step of calculating the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, preset mapping coefficients, and upper and lower margin values ​​specifically involves:

[0044] The height of the pitch bar region corresponding to the current line of the score is calculated using the height calculation formula, H. i =a×(MaxPitch) i -MinPitch i )+2×b, where H i MaxPitch represents the height of the pitch bar area corresponding to the current line of the score. i and MinPitch i These are the maximum and minimum pitch values ​​for the current line of the score, respectively. 'a' is the preset mapping coefficient, and 'b' is the preset vertical margin value.

[0045] As described above, this allows the height of the pitch range to be dynamically adapted to the pitch difference of each line of the score.

[0046] In an optional embodiment, the step of calculating the vertical position of the pitch bar corresponding to each note in the current line of the score based on the pitch value of each note in the current line of the score, the minimum pitch value of the current line of the score, the vertical bottom position of the score graphic, the height of the pitch bar area, and preset mapping coefficients and upper and lower margin values, specifically involves:

[0047] Based on the formula for calculating the vertical position of notes, the vertical position of each note in the current line of the score is calculated. The formula for calculating the vertical position of notes is as follows:

[0048] y ij =YMeasure i +H i -[a×(Pitch ij -MinPitch i )+b];

[0049] Among them, y ij YMeasure represents the vertical position of the pitch bar corresponding to the j-th note in the current line of the score. i H represents the vertical bottom position of the score graphic in the current line. i Pitch represents the height of the pitch bar area corresponding to the current line of the score. ij MinPitch is the pitch value of the j-th note in the current line of the score. i is the minimum pitch value of the current line of the score, 'a' is the preset mapping coefficient, and 'b' is the preset vertical spacing value.

[0050] As can be seen from the above description, by determining the vertical position of the pitch bars based on the pitch value of the notes, the pitch relationship between different pitch bars can be intuitively shown.

[0051] In an optional embodiment, the step of drawing the pitch bar graphics corresponding to each note in the current line of the score according to the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score specifically involves:

[0052] Based on the horizontal start and end positions and vertical positions of the pitch bars corresponding to each note in the current line of the score, as well as the preset pitch bar height, pitch bar graphic style, and pitch bar color, draw the pitch bar graphic corresponding to each note in the current line of the score in the corresponding pitch bar area.

[0053] In an optional embodiment, the step of calculating the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score based on the start and end times of each note and the start and end times of the measure to which it belongs, and the horizontal start and end positions, specifically involves:

[0054] Calculate the horizontal width of each measure based on the horizontal start and end positions of each measure in the current musical score, and calculate the duration of each measure based on the start and end times of each measure in the current musical score.

[0055] Based on the formula for calculating the horizontal starting position, calculate the horizontal starting position of the pitch bar corresponding to each note in the current line of the score. The formula for calculating the horizontal starting position is as follows:

[0056] xStart ij =(PitchStartTime) ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij

[0057] +XMeasureStart ij ;

[0058] Based on the formula for calculating the horizontal end position, the horizontal end position of the pitch bar corresponding to each note in the current line of the score is calculated. The formula for calculating the horizontal end position is as follows:

[0059] xEnd ij =(PitchEndTime) ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij

[0060] +XMeasureStart ij ;

[0061] Where, xStartij and xEnd ij These represent the horizontal start and end positions of the pitch bar corresponding to the j-th note in the current line of the score, respectively, and PitchStartTime. ij and PitchEndTime ij These are the start and end times of the j-th note in the current line of the score, respectively.

[0062] MeasureDuration ij MeasureDuration is the duration of the measure containing the j-th note in the current line of the score. ij =MeasureEndTime ij -MeasureStartTime ij MeasureStartTime ij and MeasureEndTime ij These are the start and end times of the measure to which the j-th note belongs in the current line of the score;

[0063] MeasureW ij MeasureW represents the horizontal width of the measure containing the j-th note in the current line of the score. ij =XMeasureEnd ij -XMeasureStart ij XMeasureStart ij and XMeasureEnd ij These are the horizontal start and end positions of the measure to which the j-th note belongs in the current line of the score.

[0064] As described above, the horizontal start and end positions of the pitch bar within a measure are determined based on the time ratio of the notes in the measure, so as to ensure that the notes in each measure are aligned with the pitch bar.

[0065] In an optional embodiment, after determining the start and end times of each note and the start and end times of each measure in the current musical score based on the score information of the current line, the method further includes:

[0066] Correct the start and end times of each note in the current line of the score.

[0067] In an optional embodiment, the step of correcting the start and end times of each note in the current line of the score specifically involves:

[0068] According to the correction formula, the start and end times of each note in the current line of the score are corrected. The correction formula is: FixedPitchStartTime ij=PitchStartTime ij +PitchDuration ij ×c, FixedPitchEndTime ij =PitchEndTime ij -PitchDuration ij ×d;

[0069] Among them, FixedPitchStartTime ij and FixedPitchEndTime ij These are the start and end times of the modified j-th note in the current line of the score, respectively, and PitchDuration. ij PitchDuration is the duration of the j-th note in the current line of the score. ij =PitchEndTime ij -PitchStartTime ij PitchStartTime ij and PitchEndTime ij These are the start and end times of the j-th note in the current line of the score, respectively; c is the preset first correction coefficient, and d is the preset second correction coefficient.

[0070] As described above, by correcting the start and end times of the notes, the horizontal start and end positions of the corresponding pitch bars are adjusted, allowing users to sing in a more natural way following the note pitch bars.

[0071] In an optional embodiment, if the j-th note in the current line of the score is a long note, then d > c; otherwise, d = c.

[0072] As can be seen from the above description, if the note is a long tone, its duration is further reduced.

[0073] In an optional embodiment, if the note value is greater than a preset value or the note has a breath mark, then the note is determined to be a long note.

[0074] In an optional embodiment, determining the start and end times of each note and the start and end times of each measure in the current line of the score based on the score information specifically involves:

[0075] Calculate the duration of each note in the current line of the score based on the note information and tempo of the score;

[0076] The sum of the durations of all notes preceding the first note is taken as the start time of the first note, and the sum of the durations of the first note and all notes preceding it is taken as the end time of the first note.

[0077] The start time of the first note in a measure is taken as the start time of the measure, and the end time of the last note in a measure is taken as the end time of the measure.

[0078] The present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0079] Example 1

[0080] Please refer to Figure 2-3 Embodiment 1 of the present invention is: a method for displaying note pitch bars, which can be applied to music score teaching, such as... Figure 2 As shown, it includes the following steps:

[0081] S1: Obtain the sheet music file, i.e., load a sheet music file in a custom format, and obtain the sheet music information for each line of the score based on the sheet music file. The sheet music file refers to a data stream recording sheet music information, which can be a local file, a record in a database, or a resource embedded in the application, etc. Its internal format can be musicxml, ABC notation, or a custom sheet music information organization format. The sheet music information includes note information, measure information, and tempo (in beats, how many beats per minute). Note information includes the MIDI value of the note and the number of beats (in beats, how many beats in total). The pitch value of the note can be obtained from the MIDI value.

[0082] S2: Create a canvas and render the score header on the canvas using H5 canvas technology, including information such as title, major key, time signature, and composer.

[0083] Furthermore, in this embodiment, a two-dimensional coordinate system is constructed with the upper left corner of the canvas as the origin, the rightward direction as the positive X-axis, and the downward direction as the positive Y-axis.

[0084] S3: Traverse each line of the score in the score file, and sequentially obtain one line of score as the current line of score, that is, obtain the i-th line of score as the current line of score, and the initial value of i is 1.

[0085] S4: Based on the score information of the current line of music, draw the score graphic of the current line of music on the canvas, and obtain the horizontal start and end positions of each measure in the score graphic and the vertical bottom position of the score graphic. The horizontal start and end positions include the horizontal start position and the horizontal end position. In this embodiment, the score graphic can be a graphic composed of simplified musical notation.

[0086] S5: Based on the score information of the current line of music, determine the start and end times of each note, the start and end times of each measure, and the maximum and minimum pitch values ​​in the current line of music. The start and end times include the start time and the end time.

[0087] Specifically, based on the note information and tempo of the current line of the score, the duration of each note in the current line of the score is calculated, that is, the note duration PitchDuration = number of beats of the note × (60 × 1000 / tempo), in milliseconds.

[0088] For the start and end times of a note, the sum of the durations of all notes preceding the note is taken as the start time of the note, and the sum of the durations of the note and all notes preceding it is taken as the end time of the note; that is, the start time of the nth note = the sum of the durations of the 1st note to the (n-1)th note, and the end time of the nth note = the sum of the durations of the 1st note to the nth note.

[0089] For the start and end times of a measure, the start time of the first note in a measure is taken as the start time of the measure, and the end time of the last note in a measure is taken as the end time of the measure; that is, the measure start time MeasureStartTime = the start time of the first note in the measure, and the measure end time MeasureEndTime = the end time of the first note in the measure.

[0090] Finally, based on the pitch values ​​of each note in the current line of the score, determine the maximum and minimum pitch values ​​of the current line of the score.

[0091] S6: Calculate the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, as well as the preset mapping coefficients and upper and lower margin values.

[0092] Specifically, according to the height calculation formula H i =a×(MaxPitch) i -MinPitch i )+2×b, calculate the height H of the pitch bar region corresponding to the current line of the score. i Among them, MaxPitch i and MinPitch i These are the maximum and minimum pitch values ​​for the current line of the score, respectively. 'a' is the preset mapping coefficient, and 'b' is the preset vertical margin value.

[0093] In this embodiment, a = 5 and b = 15.

[0094] S7: Based on the horizontal start position of the first measure, the horizontal end position of the last measure, the vertical bottom position of the score graphic, and the height of the corresponding pitch bar area, determine the pitch bar area corresponding to the current line of the score below the score graphic, and draw measure dividing lines within the pitch bar area.

[0095] For example, suppose the vertical bottom position of the score graph of the current line of music is YMeasure. i Then the pitch bar area corresponding to the current line of the score is the top left vertex (XMeasureStart[0], YMeasureStart[0]). i ), bottom right vertex (XMeasureEnd[-1], YMeasure i The rectangular region is defined as XMeasureStart[0], where XMeasureStart[0] is the horizontal start position of the first measure in the current line of the score, and XMeasureEnd[-1] is the horizontal end position of the last measure in the current line of the score.

[0096] Furthermore, after determining the pitch bar area, a preset background color is filled in the pitch bar area. This background color is different from the background color of the musical score graphic, and in this embodiment it is light yellow.

[0097] Then, based on the horizontal end position of each measure in the current line of the score (i.e., the horizontal position of the bar line in the score), vertical lines are drawn in the pitch bar area corresponding to the current line of the score as measure separators. In this embodiment, the length of the measure separator is consistent with the height of the pitch bar area corresponding to the current line of the score, that is, a vertical line is drawn in the pitch bar area from YMeasure to YMeasure+H.

[0098] S8: Calculate the vertical position of the pitch bar corresponding to each note in the current line of the score based on the pitch value of each note in the current line of the score, the minimum pitch value of the current line of the score, the vertical bottom position of the score graphic, the height of the pitch bar area, and the preset mapping coefficient and the upper and lower margin values.

[0099] Specifically, the vertical position of each note in the current line of the score is calculated according to the formula for calculating the vertical position of notes. The formula for calculating the vertical position of notes is as follows:

[0100] y ij =YMeasure i +H i -y ij ',y ij '=a×(Pitch ij -MinPitch i )+b;

[0101] Among them, yij YMeasure represents the vertical position of the pitch bar corresponding to the j-th note in the current line of the score. i H represents the vertical bottom position of the score graphic in the current line. i Pitch represents the height of the pitch bar area corresponding to the current line of the score. ij MinPitch is the pitch value of the j-th note in the current line of the score. i This represents the minimum pitch value of the current line of the score.

[0102] In an optional embodiment, the pitch bar area corresponding to the current line of the score can also be drawn above the score graphic of the current line of the score. In this case, the vertical top position of the score graphic is obtained in step S4, and the pitch bar area corresponding to the current line of the score is determined above the score graphic of the current line of the score based on the vertical top position of the score graphic. In this step, the vertical position of the note is the vertical top position of the score graphic minus y. ij '.

[0103] S9: Calculate the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, based on the start and end times of each note and the start and end times of the measure to which it belongs, and the horizontal start and end positions.

[0104] Specifically, firstly, the horizontal width of each measure is calculated based on the horizontal start and end positions of each measure in the current musical score, i.e., the horizontal width of the measure MeasureW = the horizontal end position of the measure × MeasureEnd - the horizontal start position of the measure × MeasureStart; and secondly, the duration of each measure is calculated based on the start and end times of each measure in the current musical score, i.e., the duration of the measure MeasureDuration = the end time of the measure MeasureEndTime - the start time of the measure MeasureStartTime.

[0105] Then, based on the formulas for calculating the horizontal start position and the horizontal end position, calculate the horizontal start position and the horizontal end position of the pitch bar corresponding to each note in the current line of the score.

[0106] The formula for calculating the horizontal starting position is:

[0107] xStart ij =(PitchStartTime) ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij

[0108] +XMeasureStart ij ;

[0109] The formula for calculating the lateral end position is:

[0110] xEnd ij =(PitchEndTime) ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij

[0111] +XMeasureStart ij ;

[0112] Where, xStart ij and xEnd ij These represent the horizontal start and end positions of the pitch bar corresponding to the j-th note in the current line of the score, respectively, and PitchStartTime. ij and PitchEndTime ij These are the start and end times of the j-th note in the current line of the score, respectively.

[0113] MeasureDuration ij MeasureDuration is the duration of the measure containing the j-th note in the current line of the score. ij =MeasureEndTime ij -MeasureStartTime ij MeasureStartTime ij and MeasureEndTime ij These are the start and end times of the measure to which the j-th note belongs in the current line of the score; MeasureW ij MeasureW represents the horizontal width of the measure containing the j-th note in the current line of the score. ij =XMeasureEnd ij -XMeasureStart ij XMeasureStart ij and XMeasureEnd ij These are the horizontal start and end positions of the measure to which the j-th note belongs in the current line of the score.

[0114] Based on the time proportions of the notes within a measure, the horizontal start and end positions of the corresponding pitch bars within that measure are determined to ensure alignment between the notes and the pitch bars in each measure. In other words, pitch bars of the same duration may have different widths in different measures, thus achieving a balanced alignment.

[0115] S10: Based on the horizontal start and end positions, vertical positions, preset pitch bar height, pitch bar graphic style, and pitch bar color of each note in the current musical score, draw the pitch bar graphic corresponding to each note in the current musical score in the corresponding pitch bar area.

[0116] In this embodiment, the pitch bar graphic style is a rectangle, the pitch bar color is green (the border color is green, and the fill color is none), the pitch bar height is 5, the horizontal start position of the pitch bar is xStart as the left side of the rectangle, and the horizontal end position is xEnd as the right side of the rectangle. A hollow rectangle is drawn in the pitch bar area corresponding to the current line of the score, which is the pitch bar corresponding to the note.

[0117] S11: Determine if all lines of the score file have been traversed. If so, the drawing is complete, and the final result is shown in the image below. Figure 3 If not, proceed to step S12.

[0118] S12: Continue to obtain the next line of the score as the current line of the score, that is, let i = i + 1, and then return to execute step S3.

[0119] Steps S9 and S6-S8 can be executed in any order, and the step of drawing the section separator line in step S7 can also be executed after step S10.

[0120] This embodiment processes and draws each line of the score file line by line, ensuring the score structure remains unchanged, meaning the final displayed score layout is consistent with the score file. By determining the height of the corresponding pitch area based on the maximum and minimum pitch values ​​in each line of the score, the height of the pitch area dynamically adapts to the pitch difference between each line of the score. Compared to a fixed pitch area height, this ensures reasonable display space for the note pitch bars while maintaining a compact overall layout. By determining the vertical position of the note pitch bars based on the pitch values ​​of the notes, the pitch relationships between different pitch bars can be visually represented. By determining the horizontal start and end positions of the pitch bars corresponding to the notes based on the start and end times of the notes and the start and end times and horizontal start and end positions of the measures to which they belong, the alignment of the notes and their pitch bars can be ensured, allowing users to observe the pitch bars corresponding to each note in real time during performance.

[0121] Example 2

[0122] Please refer to Figure 4-5This embodiment is a further extension of Embodiment 1.

[0123] Because the start and end times of each note in a musical score are closely arranged—the end time of the previous note is the start time of the next note—the corresponding singing times for each pitch bar are also closely arranged. However, in actual singing, the pitch of the human voice is affected by transitions and breathing, making it impossible to sing in such a strict manner. Therefore, in this embodiment, when drawing and scoring the pitch bars, a "head and tail reduction algorithm" is used to correct the horizontal start and end positions of the pitch bars.

[0124] Specifically, after step S5, the method further includes: correcting the start and end times of each note in the current line of the score. In step S9, the horizontal start and end positions of the corresponding pitch bars are calculated using the corrected start and end times of each note.

[0125] Specifically, according to the correction formula, the start and end times of each note in the current line of the score are corrected. The correction formula is as follows:

[0126] FixedPitchStartTime ij =PitchStartTime ij +PitchDuration ij ×c,

[0127] FixedPitchEndTime ij =PitchEndTime ij -PitchDuration ij ×d;

[0128] Among them, PitchDuration ij PitchDuration is the duration of the j-th note in the current line of the score. ij =PitchEndTime ij -PitchStartTime ij PitchStartTime ij and PitchEndTime ij FixedPitchStartTime represents the start and end times of the j-th note in the current line of the score. ij and FixedPitchEndTime ij These are the start and end times of the modified j-th note in the current line of the score, respectively; c is the preset first correction coefficient, and d is the preset second correction coefficient.

[0129] Alternatively, the start and end times can be corrected by reducing the duration of each note by a fixed value, for example, FixedPitchStartTime. ij =PitchStartTime ij +C, FixedPitchEndTime ij =PitchEndTime ij -D, where C is the preset first correction time and D is the preset second correction time.

[0130] In an optional embodiment, c = d = 0.1. The pitch bars subsequently drawn are as follows: Figure 4 As shown.

[0131] In another alternative embodiment, long notes are further reduced. Specifically, if the j-th note in the current line of the score is a long note, then d > c; otherwise, d = c. For example, c = 0.1, d = 0.2, in which case the total duration of the note is reduced by the PitchDuration. ij ×0.3. The pitch bars drawn subsequently are as follows: Figure 5 As shown.

[0132] The determination of long notes can be done manually by setting a marker when notating the music, or it can be determined by a program. For example, one rule is to classify a note as a long note if it meets one of the following conditions:

[0133] (1) The note value is greater than the preset value. For example, the note value is greater than or equal to the half note, such as the half note or the whole note; or the note value of all notes in the score file is obtained, and the 10% of notes with larger note values ​​are judged as long notes.

[0134] (2) Notes with breathing marks. Breathing marks in musical scores are generally represented by "V" and are used to give prompts to performers or singers. When the symbol Ⅴ is encountered, it means that the melody has reached this point, a musical phrase has ended, and it is necessary to lift the hand or take a breath.

[0135] Furthermore, in practical applications, when drawing pitch bars, a common start-end reduction algorithm (i.e., c = d) can be used to correct the start and end times of notes, thereby correcting the horizontal start and end positions of the pitch bars. However, when scoring within the system, a long-tone reduction algorithm (i.e., d > c) can be used to correct the start and end times of notes.

[0136] This embodiment reduces the pitch bar at both ends, concentrating the effective scoring time in the middle of the notes, which is the more stable part of the human voice. This allows users to sing in a more natural way, following the pitch bar.

[0137] Example 3

[0138] This embodiment is a computer-readable storage medium corresponding to the above embodiments, on which a computer program is stored. When the program is executed by a processor, it implements the various steps of the method for displaying a note pitch bar as described in the above embodiments, and can achieve the same technical effect, which will not be repeated here.

[0139] In summary, the present invention provides a method for displaying note pitch bars and a computer-readable storage medium. By processing and drawing each line of the score file line by line, the structure of the score remains unchanged, meaning the final displayed score layout is consistent with the score file. By determining the height of the corresponding pitch area based on the maximum and minimum pitch values ​​in each line of the score, the height of the pitch area dynamically adapts to the pitch difference between each line of the score. Compared to a fixed pitch area height, this method ensures reasonable display space for the note pitch bars while maintaining a compact overall layout. Furthermore, by determining the pitch value of each note... The vertical position of the pitch bars visually demonstrates the pitch relationships between different pitch bars. By determining the horizontal start and end positions of the pitch bars corresponding to the notes based on the start and end times of the notes and the start and end times of the measures they belong to, the alignment of the notes and their pitch bars can be ensured. This allows users to observe the pitch bars corresponding to each note in real time during singing. By appropriately shortening the beginning and end of the pitch bars, the effective scoring time is concentrated in the middle part of the notes, that is, in the more stable part of the human voice. This allows users to sing in a more natural way following the pitch bars of the notes.

[0140] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for displaying a musical note pitch bar, characterized in that, include: Obtain the sheet music file, and based on the sheet music file, obtain the sheet music information for each line of the score. The sheet music information includes note information, measure information, and tempo. The note information includes the pitch value of the note and the number of beats of the note. Iterate through each line of the score in the score file and obtain one line of score in sequence as the current line of score. Based on the score information of the current line of music, draw the score graphic of the current line of music on the canvas, and obtain the horizontal start and end positions of each measure in the score graphic, the horizontal start and end positions include the horizontal start position and the horizontal end position. Based on the musical score information of the current line of music, determine the start and end times of each note and the start and end times of each measure in the current line of music. The start and end times include the start time and the end time. Calculate the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, based on the start and end times of each note and the start and end times of the measure to which it belongs; Based on the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, draw the pitch bar graphics corresponding to each note in the current line of the score in the corresponding pitch bar area; Before drawing the score graphic of the current line of music on the canvas based on the score information of the current line of music, the method further includes: Create a canvas, and construct a two-dimensional coordinate system with the top left corner of the canvas as the origin, the rightward direction as the positive X-axis, and the downward direction as the positive Y-axis; After drawing the score graphic of the current line of music on the canvas based on the score information of the current line of music, and obtaining the horizontal start and end positions of each measure in the score graphic, the process further includes: Obtain the vertical bottom position of the musical score graphic; Based on the pitch values ​​of each note in the current line of the score, determine the maximum and minimum pitch values ​​of the current line of the score; Calculate the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, as well as the preset mapping coefficients and upper and lower margin values; Based on the pitch values ​​of each note in the current line of the score, the minimum pitch value of the current line of the score, the vertical bottom position of the score graphic, the height of the pitch bar area, and the preset mapping coefficients and the upper and lower margin values, calculate the vertical position of the pitch bar corresponding to each note in the current line of the score. The height of the pitch bar area corresponding to the current line of the score is calculated based on the maximum and minimum pitch values ​​of the current line of the score, as well as preset mapping coefficients and upper and lower margin values. Specifically: The height of the pitch bar region corresponding to the current line of the score is calculated using the height calculation formula, H. i =a×(MaxPitch i -MinPitch i )+2×b, where H i MaxPitch represents the height of the pitch bar area corresponding to the current line of the score. i and MinPitch i These are the maximum and minimum pitch values ​​for the current line of the score, respectively. 'a' is the preset mapping coefficient, and 'b' is the preset vertical margin value.

2. The method for displaying a note pitch bar according to claim 1, characterized in that, After calculating the height of the pitch bar area corresponding to the current line of the score based on the maximum and minimum pitch values, preset mapping coefficients, and upper and lower margin values, the process further includes: Based on the horizontal start position of the first measure, the horizontal end position of the last measure, the vertical bottom position of the score graphic, and the height of the corresponding pitch bar area, the pitch bar area corresponding to the current line of the score is determined below the score graphic of the current line of the score.

3. The method for displaying a note pitch bar according to claim 2, characterized in that, The step of determining the pitch bar area corresponding to the current line of the score below the score graphic based on the horizontal start position of the first measure, the horizontal end position of the last measure, the vertical bottom position of the score image, and the height of the corresponding pitch bar area, further includes: Draw vertical lines in the corresponding pitch bar area of ​​the current musical notation based on the horizontal end position of each measure in the current musical notation.

4. The method for displaying a note pitch bar according to claim 1, characterized in that, The process involves calculating the vertical position of the pitch bar corresponding to each note in the current line of the score based on the pitch value of each note, the minimum pitch value of the current line of the score, the vertical bottom position of the score graphic, the height of the pitch bar area, and preset mapping coefficients and upper and lower margin values. Specifically: Based on the formula for calculating the vertical position of notes, the vertical position of each note in the current line of the score is calculated. The formula for calculating the vertical position of notes is as follows: y ij =YMeasure i +H i -[a×(Pitch ij -MinPitch i )+b]; Among them, y ij YMeasure represents the vertical position of the pitch bar corresponding to the j-th note in the current line of the score. i H represents the vertical bottom position of the score graphic in the current line. i Pitch represents the height of the pitch bar area corresponding to the current line of the score. ij MinPitch is the pitch value of the j-th note in the current line of the score. i is the minimum pitch value of the current line of the score, 'a' is the preset mapping coefficient, and 'b' is the preset vertical spacing value.

5. The method for displaying a note pitch bar according to claim 1, characterized in that, The step of drawing the pitch bar graphic corresponding to each note in the current line of the score according to the horizontal start and end positions of the pitch bar corresponding to each note in the current line of the score is as follows: Based on the horizontal start and end positions and vertical positions of the pitch bars corresponding to each note in the current line of the score, as well as the preset pitch bar height, pitch bar graphic style, and pitch bar color, draw the pitch bar graphic corresponding to each note in the current line of the score in the corresponding pitch bar area.

6. The method for displaying a note pitch bar according to claim 1, characterized in that, The calculation of the horizontal start and end positions of the pitch bars corresponding to each note in the current line of the score, based on the start and end times of each note and the start and end times of the measure to which they belong, and their horizontal start and end positions, is as follows: Calculate the horizontal width of each measure based on the horizontal start and end positions of each measure in the current musical score, and calculate the duration of each measure based on the start and end times of each measure in the current musical score. Based on the formula for calculating the horizontal starting position, calculate the horizontal starting position of the pitch bar corresponding to each note in the current line of the score. The formula for calculating the horizontal starting position is as follows: xStart ij =(PitchStartTime ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij +XMeasureStart ij ; Based on the formula for calculating the horizontal end position, the horizontal end position of the pitch bar corresponding to each note in the current line of the score is calculated. The formula for calculating the horizontal end position is as follows: xEnd ij =(PitchEndTime ij -MeasureStartTime ij ) / MeasureDuration ij ×MeasureW ij +XMeasureStart ij ; Where, xStart ij and xEnd ij These represent the horizontal start and end positions of the pitch bar corresponding to the j-th note in the current line of the score, respectively, and PitchStartTime. ij and PitchEndTime ij These are the start and end times of the j-th note in the current line of the score, respectively. MeasureDuration ij MeasureDuration is the duration of the measure containing the j-th note in the current line of the score. ij =MeasureEndTime ij -MeasureStartTime ij MeasureStartTime ij and MeasureEndTime ij These are the start and end times of the measure to which the j-th note belongs in the current line of the score; MeasureW ij MeasureW represents the horizontal width of the measure containing the j-th note in the current line of the score. ij =XMeasureEnd ij -XMeasureStart ij XMeasureStart ij and XMeasureEnd ij These are the horizontal start and end positions of the measure to which the j-th note belongs in the current line of the score.

7. The method for displaying a note pitch bar according to claim 1, characterized in that, After determining the start and end times of each note and each measure in the current musical score based on the score information, the process further includes: Correct the start and end times of each note in the current line of the score.

8. The method for displaying a note pitch bar according to claim 7, characterized in that, The correction of the start and end times of each note in the current line of the score is as follows: According to the correction formula, the start and end times of each note in the current line of the score are corrected. The correction formula is: FixedPitchStartTime ij =PitchStartTime ij +PitchDuration ij ×c, FixedPitchEndTime ij =PitchEndTime ij -PitchDuration ij ×d; Among them, FixedPitchStartTime ij and FixedPitchEndTime ij These are the start and end times of the modified j-th note in the current line of the score, respectively, and PitchDuration. ij PitchDuration is the duration of the j-th note in the current line of the score. ij =PitchEndTime ij -PitchStartTime ij PitchStartTime ij and PitchEndTime ij These are the start and end times of the j-th note in the current line of the score, respectively; c is the preset first correction coefficient, and d is the preset second correction coefficient.

9. The method for displaying a note pitch bar according to claim 8, characterized in that, If the j-th note in the current line of the score is a long note, then d > c; otherwise, d = c.

10. The method for displaying a note pitch bar according to claim 9, characterized in that, If the note value is greater than the preset note value or the note has a breath mark, then the note is determined to be a long note.

11. The method for displaying a note pitch bar according to claim 1, characterized in that, The step of determining the start and end times of each note and the start and end times of each measure in the current musical score based on the score information is as follows: Calculate the duration of each note in the current line of the score based on the note information and tempo of the score; The sum of the durations of all notes preceding the first note is taken as the start time of the first note, and the sum of the durations of the first note and all notes preceding it is taken as the end time of the first note. The start time of the first note in a measure is taken as the start time of the measure, and the end time of the last note in a measure is taken as the end time of the measure.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Music data display control apparatus and method

    CN103093750A

  • Music score presenting method

    CN106683651A

  • Visual music score display method and storage medium

    CN115132156A