A music rhythm display method and device, a storage medium and an electronic device

By updating the historical rhythm graph during music playback, the number of times the rhythm graph is redrawn is reduced, solving the problems of time-consuming, labor-intensive, and memory-intensive processes in existing technologies, improving the user experience, and achieving efficient music rhythm display.

CN115686429BActive Publication Date: 2026-06-26GREAT WALL MOTOR CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GREAT WALL MOTOR CO LTD
Filing Date
2022-11-15
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies are time-consuming, labor-intensive, and memory-intensive when drawing music rhythm diagrams, especially due to memory overhead and user experience issues caused by frequent redrawing.

Method used

By detecting the music playback status, it can determine whether a rhythm graph has been created. If it has been created, the historical rhythm graph is updated using the current audio frame to avoid redrawing. The target height of the rhythm bar is determined by using Fast Fourier Transform, and the rhythm graph can be drawn only once to achieve real-time display.

Benefits of technology

It reduces the number of times the rhythm graph is redrawn, saves memory, improves the user experience, avoids black screen flickering, and achieves efficient music rhythm display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115686429B_ABST
    Figure CN115686429B_ABST
Patent Text Reader

Abstract

The application provides a music rhythm display method and device, a storage medium and an electronic device, and belongs to the field of audio signal processing. In the application, whether a beatmap of music has been created is determined when music is detected to be played; and when it is determined that the beatmap of music has been created, a current audio frame of the music and a historical beatmap are obtained, and then the historical beatmap can be updated based on the current audio frame to obtain a current beatmap, and the current beatmap is displayed. In the application, the historical beatmap can be updated according to the current audio frame when the music is played to obtain and display the current beatmap, and thus the beatmap does not need to be redrawn every time, time and effort are saved, the problem of time and effort consumption caused by multiple drawings is solved, and memory expenditure is effectively saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of audio signal processing, and in particular to a method, apparatus, storage medium, and electronic device for displaying music rhythm. Background Technology

[0002] Current music players not only support music playback, but also display the rhythm of the music as a rhythm graph during playback, so as to meet the user's need to grasp the rhythm of the music based on the rhythm graph during music appreciation.

[0003] Current techniques for drawing rhythm graphs typically involve acquiring music audio data in real time at fixed sampling intervals, and then drawing the current rhythm graph based on the acquired audio data. Therefore, the rhythm graph is redrawn every time new audio data is acquired, which is not only time-consuming and labor-intensive, but also consumes a significant amount of memory. Summary of the Invention

[0004] This application provides a music rhythm display method, device, storage medium, and electronic device to solve the problem of time-consuming and labor-intensive drawing of rhythm diagrams in the prior art.

[0005] To solve the above problems, this application adopts the following technical solution:

[0006] In a first aspect, embodiments of this application provide a method for displaying music rhythm, the method comprising:

[0007] If music is detected playing, determine whether a rhythm graph of the music has been created;

[0008] When it is determined that a rhythm graph of the music has been created, the current audio frame and the historical rhythm graph of the music are obtained; the historical rhythm graph is created based on the previous audio frame of the current audio frame;

[0009] Based on the current audio frame, update the historical rhythm graph to obtain the current rhythm graph, and display the current rhythm graph.

[0010] In one embodiment of this application, determining whether a rhythm graph of the music has been created includes:

[0011] Determine whether the pre-constructed collection object is an empty collection; the collection object is used to store the rhythm diagram of the music;

[0012] If the set object is determined to be an empty set, it is determined that the rhythm diagram of the music has not been created;

[0013] When the set object is determined to be a non-empty set, it is determined that the rhythm graph of the music has been created.

[0014] In one embodiment of this application, the rhythm diagram includes n rhythm bars, where n is a positive integer greater than or equal to 1;

[0015] Based on the current audio frame, update the historical rhythm graph to obtain the current rhythm graph, including:

[0016] Based on the current audio frame, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph;

[0017] The heights of the n rhythm bars in the historical rhythm graph are updated to their respective target heights to obtain the current rhythm graph.

[0018] In one embodiment of this application, determining the target height corresponding to each of the n rhythm bars of the current rhythm graph based on the current audio frame includes:

[0019] Perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array includes n bytes, and different bytes correspond to different rhythm bars;

[0020] Based on the byte array, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph.

[0021] In one embodiment of this application, determining the target height corresponding to each of the n rhythm bars of the current rhythm graph based on the byte array includes:

[0022] Perform absolute value transformation on the n bytes to obtain n numerical values;

[0023] Based on the maximum and minimum values ​​among the n values ​​and the preset maximum height of the rhythm bar, the height conversion ratio is determined;

[0024] Based on the n values ​​and the height conversion ratio, the target height corresponding to each of the n rhythm bars in the current rhythm diagram is determined.

[0025] In one embodiment of this application, determining the height conversion ratio based on the maximum and minimum values ​​among the n values ​​and the preset maximum height of the rhythm bar includes:

[0026] The height conversion ratio is determined according to the following formula;

[0027]

[0028] Where P represents the height conversion ratio; H max H represents the maximum value among the n values; min H represents the minimum value among the n values; H0 represents the maximum height of the preset rhythm bar.

[0029] In one embodiment of this application, the method further includes:

[0030] If it is determined that no rhythm graph of the music has been created, an initial rhythm graph of the music is created based on the current audio frame of the music, and the initial rhythm graph is stored in the collection object.

[0031] Secondly, based on the same inventive concept, embodiments of this application provide a music rhythm display device, the music rhythm display device comprising:

[0032] The judgment module is used to determine whether a rhythm graph of the music has been created when music playback is detected.

[0033] The acquisition module is used to acquire the current audio frame and historical rhythm graph of the music when it is determined that a rhythm graph of the music has been created; the historical rhythm graph is created based on the previous audio frame of the current audio frame.

[0034] The display module is used to update the historical rhythm graph based on the current audio frame to obtain the current rhythm graph and display the current rhythm graph.

[0035] In one embodiment of this application, the determination module includes:

[0036] The judgment submodule is used to determine whether the pre-constructed collection object is an empty collection; the collection object is used to store the rhythm diagram of the music;

[0037] The first determining submodule is used to determine that the rhythm diagram of the music has not been created when the set object is determined to be an empty set;

[0038] The second determining submodule is used to determine that the rhythm diagram of the music has been created when the set object is determined to be a non-empty set.

[0039] In one embodiment of this application, the rhythm graph includes n rhythm bars, where n is a positive integer greater than or equal to 1; the display module includes:

[0040] The target height determination submodule is used to determine the target height corresponding to each of the n rhythm bars of the current rhythm graph based on the current audio frame;

[0041] The height update submodule is used to update the height of the n rhythm bars in the historical rhythm graph to their respective target heights, so as to obtain the current rhythm graph.

[0042] In one embodiment of this application, the target height determination submodule includes:

[0043] The Fast Fourier Transform (FFT) unit is used to perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array includes n bytes, and different bytes correspond to different rhythm bars;

[0044] The target height determination unit is used to determine the target height corresponding to each of the n rhythm bars of the current rhythm diagram based on the byte array.

[0045] In one embodiment of this application, the target height determination unit includes:

[0046] An absolute value transformation subunit is used to perform absolute value transformation on the n bytes to obtain n numerical values;

[0047] The proportion determination subunit is used to determine the height conversion ratio based on the maximum and minimum values ​​among the n values ​​and the preset maximum height of the rhythm bar;

[0048] The target height determination subunit is used to determine the target height corresponding to each of the n rhythm bars of the current rhythm diagram based on the n values ​​and the height conversion ratio.

[0049] In one embodiment of this application, the ratio determination subunit is specifically used to determine the height conversion ratio according to the following formula;

[0050]

[0051] Where P represents the height conversion ratio; H max H represents the maximum value among the n values; min H represents the minimum value among the n values; H0 represents the maximum height of the preset rhythm bar.

[0052] In one embodiment of this application, the music rhythm display device further includes:

[0053] The initial rhythm graph creation module is used to create an initial rhythm graph for the music based on the current audio frame of the music when it is determined that no rhythm graph has been created for the music, and to store the initial rhythm graph in the collection object.

[0054] Thirdly, based on the same inventive concept, embodiments of this application provide a storage medium storing machine-executable instructions, which, when executed by a processor, implement the music rhythm display method proposed in the first aspect of this application.

[0055] Fourthly, based on the same inventive concept, embodiments of this application provide an electronic device, including a processor and a memory; the memory stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions to implement the music rhythm display method proposed in the first aspect of this application.

[0056] Compared with the prior art, this application has the following advantages:

[0057] This application embodiment determines whether a music rhythm graph has been created when music playback is detected. If a rhythm graph has been created, it acquires the current audio frame and historical rhythm graphs. Based on the current audio frame, it updates the historical rhythm graph to obtain the current rhythm graph and displays it. This embodiment can update the historical rhythm graph based on the current audio frame while music is playing, thus eliminating the need to redraw the rhythm graph each time, saving time and effort. It not only solves the problem of time-consuming and labor-intensive multiple redrawing processes but also effectively saves memory. Attached Figure Description

[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0059] Figure 1 This is a flowchart of the steps of a music rhythm display method in one embodiment of this application.

[0060] Figure 2 This is a schematic diagram of the functional modules of a music rhythm display device according to an embodiment of this application.

[0061] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of this application.

[0062] Reference numerals: 200-Music rhythm display device; 201-Judgment module; 202-Acquisition module; 203-Display module; 300-Electronic device; 301-Processor; 302-Memory. Detailed Implementation

[0063] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0064] It should be noted that existing music players can display a rhythm graph during music playback, such as by showing 54 rhythm bars whose height changes over time to represent the rhythm of the music. When creating a rhythm graph, existing technology acquires the music's audio data (PCM data) in real time, performs a Fourier transform on the audio data, converting the audio signal from the time domain to the frequency domain. Each discrete frequency corresponds to an amplitude, and the rhythm graph uses these amplitudes to determine the height of the 54 rhythm bars.

[0065] In related technologies, SurfaceView is typically used to draw rhythm graphs. Whenever new audio data is acquired at a fixed sampling interval (e.g., 80 milliseconds), SurfaceView draws a new rhythm graph based on the new audio data. That is, a new rhythm graph consisting of 54 rhythm bars will be drawn every 80 milliseconds. This is not only time-consuming and resource-intensive, but also consumes a lot of memory. Traditional SurfaceView also suffers from screen flickering due to its double buffering mechanism, which affects the user experience.

[0066] To address the problems existing in the background technology described above, the embodiments of this application aim to provide a music rhythm display method that can realize the real-time display of music rhythm by drawing the rhythm diagram only once, thereby eliminating the need to redraw the rhythm diagram each time, saving time and effort. It not only solves the problem of time-consuming and labor-intensive multiple drawing, but also effectively saves memory expenditure, and avoids the black screen flickering phenomenon when drawing the rhythm diagram using SurfaceView.

[0067] Reference Figure 1 The diagram illustrates a flowchart of a music rhythm display method according to this application. The method specifically includes the following steps:

[0068] S101: If music playback is detected, determine whether a music rhythm graph has been created.

[0069] It should be noted that the executing entity of this embodiment can be the operating system (OS) in an electronic device capable of playing music. The operating system can include, but is not limited to, Windows operating system, Android operating system, HarmonyOS operating system, etc. This embodiment will use Android operating system (hereinafter referred to as Android system) as an example for explanation.

[0070] In this implementation, when the Android system detects that a music app is playing music, it first determines whether a rhythm graph for that music has already been created. If it is determined that no rhythm graph has been created, the Android system uses a SurfaceView to draw the rhythm graph for that music. If it is determined that a rhythm graph has already been created, it means that the SurfaceView has already drawn the rhythm graph for that music, and the rhythm graph will not be redrawn in the future.

[0071] S102: When determining the rhythm graph of the music that has been created, obtain the current audio frame and the historical rhythm graph of the music; the historical rhythm graph is created based on the previous audio frame of the current audio frame.

[0072] It should be noted that an audio frame refers to the PCM (Pulse-code modulation) data of the music, that is, the raw audio data. Specifically, an audio frame refers to the PCM data of the music acquired in real time at fixed sampling intervals.

[0073] In this embodiment, if it is determined that a rhythm map of the music has already been created, it means that a historical rhythm map has been created based on the previous audio frame of the current audio frame. In a specific implementation, the historical rhythm map of the music can be stored in a pre-created database, and then the historical rhythm map of the music can be directly obtained from the database.

[0074] In this embodiment, the most native and efficient system API (Application Programming Interface) in the Android system can be called to obtain PCM data, thereby obtaining the current audio frame of the music.

[0075] S103: Based on the current audio frame, update the historical rhythm graph to obtain the current rhythm graph and display the current rhythm graph.

[0076] In this embodiment, the historical rhythm graph can be updated by comparing the current audio frame with the previous audio frame and then based on the difference between the two adjacent audio frames to obtain the current rhythm graph.

[0077] In a specific implementation, Fourier transforms can be performed on the current audio frame and the previous audio frame to obtain the rhythm data corresponding to each of the two adjacent audio frames. Then, based on the rhythm data corresponding to each of the two adjacent audio frames, the amplitude corresponding to each of the two adjacent audio frames can be determined. Finally, based on the difference between the amplitudes corresponding to each of the two adjacent audio frames, the historical rhythm graph is updated to obtain the current rhythm graph.

[0078] In this embodiment, the rhythm graph can be displayed using an electrocardiogram (ECG) format. Changes in the ECG's electrical potential represent changes in amplitude; the higher the amplitude, the higher the electrical potential. The speed of the electrical potential change represents the speed of the musical beat; the faster the musical beat changes, the faster the electrical potential changes. Alternatively, the rhythm graph can use n rhythm bars whose height changes continuously over time to represent the musical rhythm. Changes in the height of the rhythm bars represent changes in amplitude; the higher the amplitude, the higher the rhythm bar. The speed of the rhythm bar change represents the speed of the musical beat; the faster the musical beat changes, the faster the rhythm bar changes. It should be noted that this embodiment does not impose specific limitations on the display format of the rhythm graph.

[0079] This application embodiment can update the historical rhythm graph according to the current audio frame when playing music, obtain and display the current rhythm graph, so that the rhythm graph does not need to be redrawn every time, saving time and effort. It not only solves the problem of time and effort spent on multiple drawing, but also effectively saves memory expenditure. At the same time, since the rhythm graph only needs to be drawn once, it can also effectively avoid the black screen flickering phenomenon caused by repeatedly drawing the rhythm graph using SurfaceView.

[0080] In one feasible implementation, S101 may specifically include the following sub-steps:

[0081] S101-1: Determine whether the pre-constructed set object is an empty set; the set object is used to store the rhythm diagram of the music.

[0082] In this embodiment, after completing the time-frequency domain conversion of the PCM data, the resulting rhythm data is stored in a collection object. That is, while the music app is playing music, the current rhythm data is also stored in a pre-built collection object, and this rhythm data corresponds to the current rhythm graph of the music.

[0083] S101-2: When determining that a set object is an empty set, identify rhythm diagrams for which no music has been created.

[0084] In this implementation, based on a pre-built set object, it is only necessary to determine whether the set object is an empty set to determine whether a rhythm graph of the music has been created.

[0085] Specifically, when the collection object is empty, it means that no rhythm graph for the music has been created. In this case, an initial rhythm graph for the music will be created based on the current audio frame, and the initial rhythm graph will be stored in the collection object. This initial rhythm graph can then serve as the historical rhythm graph for the next audio frame after the current audio frame, and as the criterion for determining whether the collection object is non-empty.

[0086] S101-3: When determining that the set object is a non-empty set, determine the rhythm diagram of the music that has been created.

[0087] In this embodiment, when the set object is a non-empty set, it means that the rhythm diagram of the music has been drawn before. Therefore, there is no need to draw a new rhythm diagram based on the current audio frame. It is only necessary to update the historical rhythm diagram.

[0088] In one feasible implementation, a rhythmic graph can be displayed to the user on the human-computer interaction interface using several rhythm bars. Based on the rhythm bars, S103 may specifically include the following sub-steps:

[0089] S103-1: Based on the current audio frame, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph.

[0090] In this embodiment, the rhythm of music can be presented by displaying 54 rhythm bars whose height changes continuously over time. The number of rhythm bars can be set according to actual needs, and this embodiment does not impose a specific limit on the number of rhythm bars.

[0091] In this embodiment, the current audio frame is processed to obtain the rhythm data corresponding to the current audio frame; then, based on the rhythm data, the target height corresponding to each of the n rhythm bars is determined.

[0092] S103-2: Update the height of each of the n rhythm bars in the historical rhythm graph to its corresponding target height to obtain the current rhythm graph.

[0093] In this implementation, after determining the target height for each of the n rhythm bars, the target height for each rhythm bar is compared with its historical height in the historical rhythm graph. Specifically, if the target height is greater than the historical height, the rhythm bar is increased from its historical height to the target height; if the target height is less than the historical height, the rhythm bar is decreased from its historical height to the target height; if the target height is equal to the historical height, the rhythm bar remains at its historical height.

[0094] In one feasible implementation, S103-1 may specifically include the following sub-steps:

[0095] S103-1-1: Perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array includes n bytes, and different bytes correspond to different rhythm bars.

[0096] In this embodiment, an FFT (Fast Fourier Transform) can be performed on the current audio frame to obtain a byte array, which includes at least n bytes. Different bytes correspond to different rhythm bars. In other words, based on each byte of data, the target height of the corresponding rhythm bar can be determined.

[0097] S103-1-2: Based on the byte array, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph.

[0098] In this implementation, the absolute values ​​of n bytes are first transformed to obtain n numerical values; then, based on the maximum and minimum values ​​among the n numerical values ​​and the preset maximum height of the rhythm bar, the height conversion ratio is determined; finally, based on the n numerical values ​​and the height conversion ratio, the target height corresponding to each of the n rhythm bars of the current rhythm graph is determined.

[0099] Furthermore, the height conversion ratio can be determined using the following formula;

[0100]

[0101] Where P represents the height conversion ratio; H max H represents the maximum value among n values; min H0 represents the minimum value among n values; H0 represents the maximum height of the preset rhythm bar.

[0102] In this embodiment, by performing absolute value transformation on n bytes, negative values ​​in n bytes can be converted into positive values, thereby eliminating the influence of byte symbols on the height of the rhythm bar. Furthermore, by using the height conversion ratio obtained from formula (1) to perform numerical conversion on n bytes in the byte array, the target heights corresponding to each of the n rhythm bars can be limited to the maximum height, effectively preventing display errors caused by the value exceeding the maximum height.

[0103] Secondly, based on the same inventive concept, and referring to... Figure 2 This application provides a music rhythm display device 200, which includes:

[0104] The judgment module 201 is used to determine whether a music rhythm graph has been created when music playback is detected.

[0105] The acquisition module 202 is used to acquire the current audio frame and the historical rhythm graph of the music when the rhythm graph of the music that has been created is determined; the historical rhythm graph is created based on the previous audio frame of the current audio frame.

[0106] The display module 203 is used to update the historical rhythm graph based on the current audio frame, obtain the current rhythm graph, and display the current rhythm graph.

[0107] In one embodiment of this application, the determination module 201 includes:

[0108] The judgment submodule is used to determine whether a pre-built collection object is an empty collection; the collection object is used to store the rhythm diagram of the music.

[0109] The first determination submodule is used to determine the rhythm diagram of music that has not been created when the collection object is determined to be an empty collection.

[0110] The second determination submodule is used to determine the rhythm diagram of the created music when the set object is determined to be a non-empty set.

[0111] In one embodiment of this application, the rhythm diagram includes n rhythm bars, where n is a positive integer greater than or equal to 1; the display module 203 includes:

[0112] The target height determination submodule is used to determine the target height of each of the n rhythm bars in the current rhythm graph based on the current audio frame.

[0113] The height update submodule is used to update the height of n rhythm bars in the historical rhythm graph to their respective target heights in order to obtain the current rhythm graph.

[0114] In one embodiment of this application, the target height determination submodule includes:

[0115] The Fast Fourier Transform (FFT) unit is used to perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array consists of n bytes, and different bytes correspond to different rhythm bars;

[0116] The target height determination unit is used to determine the target height of each of the n rhythm bars in the current rhythm graph based on a byte array.

[0117] In one embodiment of this application, the target height determination unit includes:

[0118] The absolute value transformation subunit is used to perform absolute value transformation on n bytes to obtain n numerical values;

[0119] The proportion determination subunit is used to determine the height conversion ratio based on the maximum and minimum values ​​among n values ​​and the preset maximum height of the rhythm bar;

[0120] The target height determination subunit is used to determine the target height corresponding to each of the n rhythm bars in the current rhythm graph based on n numerical values ​​and a height conversion ratio.

[0121] In one embodiment of this application, the ratio determination subunit is specifically used to determine the height conversion ratio according to the following formula;

[0122]

[0123] Where P represents the height conversion ratio; H max H represents the maximum value among n values; min H0 represents the minimum value among n values; H0 represents the maximum height of the preset rhythm bar.

[0124] In one embodiment of this application, the music rhythm display device 200 further includes:

[0125] The initial rhythm graph creation module is used to create an initial rhythm graph for music based on the current audio frame of the music when it is determined that no rhythm graph has been created for the music, and to store the initial rhythm graph in a collection object.

[0126] Thirdly, based on the same inventive concept, embodiments of this application provide a storage medium storing a computer program / instruction thereon, which, when executed by a processor, implements the music rhythm display method proposed in the first aspect of embodiments of this application.

[0127] It should be noted that the specific implementation of the storage medium in this application embodiment refers to the specific implementation of the music rhythm display method proposed in the first aspect of the above-mentioned application embodiment, and will not be repeated here.

[0128] Fourthly, based on the same inventive concept, referring to Figure 3 This application provides an electronic device 300, including a processor 301 and a memory 302; the memory 302 stores machine-executable instructions that can be executed by the processor 301, and the processor 301 executes the machine-executable instructions to implement the music rhythm display method proposed in the first aspect.

[0129] It should be noted that the specific implementation of the electronic device 300 in this application embodiment refers to the specific implementation of the music rhythm display method proposed in the first aspect of the above-mentioned application embodiment, and will not be repeated here.

[0130] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0131] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0132] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0134] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0135] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0136] The above provides a detailed description of the music rhythm display method, apparatus, storage medium, and electronic device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for displaying music rhythm, characterized in that, The method includes: If music is detected playing, determine whether a rhythm graph of the music has been created; When it is determined that a rhythm graph of the music has been created, the current audio frame and the historical rhythm graph of the music are obtained; the historical rhythm graph is created based on the previous audio frame of the current audio frame; Based on the current audio frame, the historical rhythm graph is updated to obtain the current rhythm graph, and the current rhythm graph is displayed; the rhythm graph includes n rhythm bars, where n is a positive integer greater than or equal to 1; The step of updating the historical rhythm graph based on the current audio frame to obtain the current rhythm graph includes: Based on the current audio frame, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph; The heights of the n rhythm bars in the historical rhythm graph are updated to their respective target heights to obtain the current rhythm graph; The step of determining the target height corresponding to each of the n rhythm bars of the current rhythm graph based on the current audio frame includes: Perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array includes n bytes, and different bytes correspond to different rhythm bars; Based on the byte array, determine the target height corresponding to each of the n rhythm bars in the current rhythm graph; The step of determining the target height corresponding to each of the n rhythm bars in the current rhythm graph based on the byte array includes: Perform absolute value transformation on the n bytes to obtain n numerical values; Based on the maximum and minimum values ​​among the n values ​​and the preset maximum height of the rhythm bar, the height conversion ratio is determined; Based on the n values ​​and the height conversion ratio, the target height corresponding to each of the n rhythm bars in the current rhythm diagram is determined.

2. The music rhythm display method according to claim 1, characterized in that, Determining whether a rhythm graph for the music has been created includes: Determine whether the pre-constructed collection object is an empty collection; the collection object is used to store the rhythm diagram of the music; If the set object is determined to be an empty set, it is determined that the rhythm diagram of the music has not been created; When the set object is determined to be a non-empty set, it is determined that the rhythm graph of the music has been created.

3. The music rhythm display method according to claim 1, characterized in that, Based on the maximum and minimum values ​​among the n values ​​and the preset maximum height of the rhythm bar, the height conversion ratio is determined, including: The height conversion ratio is determined according to the following formula; ; in, Indicates the height conversion ratio; This represents the maximum value among the n values; This represents the minimum value among the n values; This indicates the maximum height of the preset rhythm bar.

4. The music rhythm display method according to claim 2, characterized in that, The method further includes: If it is determined that no rhythm graph of the music has been created, an initial rhythm graph of the music is created based on the current audio frame of the music, and the initial rhythm graph is stored in the collection object.

5. A music rhythm display device, characterized in that, The device includes: The judgment module is used to determine whether a rhythm graph of the music has been created when music playback is detected. The acquisition module is used to acquire the current audio frame and historical rhythm graph of the music when it is determined that a rhythm graph of the music has been created; the historical rhythm graph is created based on the previous audio frame of the current audio frame. The display module is used to update the historical rhythm graph based on the current audio frame to obtain the current rhythm graph, and display the current rhythm graph; the rhythm graph includes n rhythm bars, where n is a positive integer greater than or equal to 1; The display module includes: The target height determination submodule is used to determine the target height of each of the n rhythm bars in the current rhythm graph based on the current audio frame. The height update submodule is used to update the height of n rhythm bars in the historical rhythm graph to their respective target heights in order to obtain the current rhythm graph; The target height determination submodule includes: The Fast Fourier Transform (FFT) unit is used to perform a Fast Fourier Transform on the current audio frame to obtain a byte array; the byte array consists of n bytes, and different bytes correspond to different rhythm bars; The target height determination unit is used to determine the target height of each of the n rhythm bars in the current rhythm graph based on a byte array. The target height determination unit includes: The absolute value transformation subunit is used to perform absolute value transformation on n bytes to obtain n numerical values; The proportion determination subunit is used to determine the height conversion ratio based on the maximum and minimum values ​​among n values ​​and the preset maximum height of the rhythm bar; The target height determination subunit is used to determine the target height corresponding to each of the n rhythm bars in the current rhythm graph based on n numerical values ​​and a height conversion ratio.

6. A storage medium, characterized in that, The storage medium stores machine-executable instructions, which, when executed by a processor, implement the music rhythm display method as described in any one of claims 1-4.

7. An electronic device, characterized in that, It includes a processor and a memory; the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the music rhythm display method as described in any one of claims 1-4.