This application claims the benefit of priority to Taiwan Patent Application No. 112138193, filed on Oct. 5, 2023. The entire content of the above identified application is incorporated herein by reference.
Some references, which may include patents, patent applications and various publications, may be cited and discussed in the description of this disclosure. The citation and/or discussion of such references is provided merely to clarify the description of the present disclosure and is not an admission that any such reference is “prior art” to the disclosure described herein. All references cited and discussed in this specification are incorporated herein by reference in their entireties and to the same extent as if each reference was individually incorporated by reference.
The present disclosure relates to a technology of adding a beat-prompting note into music, and more particularly to a method and a system for analyzing music rhythm in real time for determining if the beat-prompting note can be added to the music with a stable rhythm.
When a person is listening to music or watching a music video, he/she may want to sing along with the music. However, for an inexperienced person or a young person, catching the beats of the music is not easy. Hence, it is conventional to add beat-prompting notes to the music, so that the person can sing with the music more easily.
Conventionally, a player is capable of providing the beat-prompting notes when playing the music. However, an algorithm for speculating a rhythm is generally an offline model, and the offline model needs to analyze an entire piece of the music before obtaining the rhythm. Therefore, the beat-prompting notes need to be prepared before the music is played. In the conventional technology, it is impossible to obtain real-time beat information when the music is being played on demand.
In response to the above-referenced technical inadequacy, the present disclosure provides a method and a system for analyzing music rhythm in real time, so as to be capable of providing rhythm information when playing music on demand. The system is operated in a device through a circuitry or a software method. In addition to providing an audio-processing circuit in the device, the device includes an audio analysis module connected with the audio-processing circuit. The audio-processing circuit is used to perform real-time music rhythm analysis.
In the method, the system receives an audio via an input interface, and uses the audio-processing circuit to decode the audio for retrieving frame information of the audio. The frame information includes a sampling rate. Next, a hop size can be obtained according to a frame size and an overlapped frame size. A frame rate can be calculated according to the sampling rate and the hop size. An initial value of a beat period is calculated according to the sampling rate and an initial BPM (beats per minute) value, so as to obtain a beat location according to a quantity of sampling points in one beat.
Afterwards, a next beat location can be speculated by a recursive algorithm. The frame rate is referred to for calculating a quantity of audio frames in a past period of time, and a new beat period is calculated according to beats per minute, so as to speculate the next beat location according to the new beat period.
Thus, the system can be configured to re-calculate the new beat period at intervals based on data of the audio frames in the past period of time, so as to re-speculate the next beat location.
Preferably, when the audio is a pulse-code modulated multi-channel audio, an averaging operation is performed on digital signals of multiple audio frames at a same time for forming a mono-channel audio that is provided for real-time music rhythm analysis.
Preferably, the frame rate indicates a quantity of proxy audio frames in one second, and the proxy audio frame is obtained based on the frame size of an original audio frame and the overlapped frame size set by the system.
In an aspect of the present disclosure, in the process of calculating the new beat period, an auto-correlation function is used for finding out a repeating pattern based on a correlation of the frame information of the audio at different time points, and the new beat period can be re-calculated based on a period having a maximum of the auto-correlation function.
Further, the auto-correlation function introduces an onset value, and the onset value of each one of the proxy audio frames in a time period is calculated. After that, a maximum of the onset values or values calculated from the onset values in the time period is determined for speculating the new beat period.
Further, a beat detection value is incorporated. A maximum beat characteristic value of the sampling points around the onset values of the proxy audio frames in the time period is calculated. The maximum beat characteristic value can be regarded as the beat detection value of the proxy audio frame. Beat detection values in a next beat period can be speculated according to all of the beat detection values in a past beat period. A maximum of the beat detection values in the next beat period can be regarded as a beat location of the next beat period.
Further, after the next beat location of the new beat period is obtained, multiple time differences of multiple adjacent beat locations are calculated by retracing multiple beat locations, and the system is able to determine whether or not the audio has a stable rhythm. When the system determines that the audio has the stable rhythm, a beat-prompting note can be added at each beat location. After that, when the audio-processing circuit outputs the processed audio via an output interface, the audio is synthesized with the beat-prompting note that is added at each beat location.
These and other aspects of the present disclosure will become apparent from the following description of the embodiment taken in conjunction with the following drawings and their captions, although variations and modifications therein may be affected without departing from the spirit and scope of the novel concepts of the disclosure.
The described embodiments may be better understood by reference to the following description and the accompanying drawings, in which:
The present disclosure is more particularly described in the following examples that are intended as illustrative only since numerous modifications and variations therein will be apparent to those skilled in the art. Like numbers in the drawings indicate like components throughout the views. As used in the description herein and throughout the claims that follow, unless the context clearly dictates otherwise, the meaning of “a,” “an” and “the” includes plural reference, and the meaning of “in” includes “in” and “on.” Titles or subtitles can be used herein for the convenience of a reader, which shall have no influence on the scope of the present disclosure.
The terms used herein generally have their ordinary meanings in the art. In the case of conflict, the present document, including any definitions given herein, will prevail. The same thing can be expressed in more than one way. Alternative language and synonyms can be used for any term(s) discussed herein, and no special significance is to be placed upon whether a term is elaborated or discussed herein. A recital of one or more synonyms does not exclude the use of other synonyms. The use of examples anywhere in this specification including examples of any terms is illustrative only, and in no way limits the scope and meaning of the present disclosure or of any exemplified term. Likewise, the present disclosure is not limited to various embodiments given herein. Numbering terms such as “first,” “second” or “third” can be used to describe various components, signals or the like, which are for distinguishing one component/signal from another one only, and are not intended to, nor should be construed to impose any substantive limitations on the components, signals or the like.
The present disclosure relates to a method for analyzing music rhythm in real time and a system for analyzing music rhythm in real time. The system is applied to a device. When the device receives audiovisual data, a video and an audio can be decoded, decompressed, and processed respectively by software and hardware that are used to process the video and the audio. Afterwards, the video and the audio can be appropriately encoded as playable images and sounds. In particular, when a content inputted to the device is an audiovisual content (e.g., a music video, MV) relating to music or only the audio (without images), the music can be added with one or more beat-prompting notes through the method and the system provided by the present disclosure. The beat-prompting notes can be beeps or other sounds that are configured to be added at one or more locations of accents within every bar of the music, at locations of both accent and secondary accent within every bar of the music, or at every beat within every bar of the music. In this way, a user can easily follow the beat-prompting notes to sing a song.
According to one of the embodiments of the present disclosure,
The method for analyzing music rhythm in real time is operated in the device that is, for example, a set-top box (STB), a smart TV, or a computer device. In
According to the embodiment shown in the diagram of the present disclosure, main circuit components of the device 100 include an input/output interface (which includes an input interface 105 and an output interface 107) and a data-processing circuit. As known to those skilled in the related art, the audio and the video can be respectively processed by an audio-processing circuit 101 and a video-processing circuit 103 and outputted to the device 100 that connects with a display 113 and a speaker 115. In one embodiment of the system of the present disclosure, input/output ends of the audio-processing circuit 101 connect with an audio analysis module 120 that uses circuits, firmware, or software to implement a music rhythm analysis unit 121 and a beat-prompting-sound adding unit 123. The music rhythm analysis unit 121 is mainly used to analyze beat periods of the audio, so as to acquire beat locations. The beat-prompting-sound adding unit 123 relies on the beat locations that are obtained through a real-time analysis to add beat-prompting notes in the audio.
The audio analysis module 120 performs the method for analyzing music rhythm in real time. In the method, the audio analysis module 120 receives audiovisual data 111 including audio and video via the input interface 105 of the device 100. The video is processed by the video-processing circuit 103 (details thereof will not be reiterated herein), and the processed video is outputted to the display 113 for displaying the video via the output interface 107. The audio is processed by the audio-processing circuit 101, and sounds decoded from the audio are outputted to the speaker 115 for playing the sounds via the output interface 107. In particular, the music rhythm analysis unit 121 of the audio analysis module 120 obtains the beat locations from the audio. Afterwards, the beat-prompting-sound adding unit 123 can synthesize the beat-prompting notes and the audio in the beat locations, and then the audio-processing circuit 101 outputs the audio in a specific encoding format.
The system operated in the device 100 can be an embedded system that is used to perform the method for analyzing music rhythm in real time. Reference can be made to
In the flowchart, in the beginning, the system operated in the device receives an audio via an input interface of the device (step S201). The audio-processing circuit is used to decode the audio, so as to extract frame information of the audio. The frame information of the audio is, for example, a sampling rate indicating a quantity of sampling points over one second (step S203). The sampling rate is audio-related information, and the sampling rate varies with different audios.
Next, according to one embodiment of the present disclosure, when the audio is a multi-channel audio, a software method can be applied to the audio. For example, an averaging operation is performed on digital signals of multiple audio frames at the same time for forming a mono-channel audio that is provided for real-time music rhythm analysis (step S205).
Next, a pre-processing procedure is performed on the audio. For example, step S207 is the first step of the pre-processing procedure that includes system settings such as a frame size, an overlapped frame size, and beats per minute (BPM). Thus, in step S209 (which is the second step of the pre-processing procedure), a hop size can be obtained according to the frame size and the overlapped frame size. A frame rate (frames per second) can be calculated according to the sampling rate and the hop size. It should be noted that, referring to
It should be noted that, in the technical field of digital audio, adjacent audio frames of the audio in a specific encoding format may be overlapped when sampling. This is caused by a slight change occurring in the adjacent audio frames if the audio signals are relatively unstable. In order to suppress the slight change, the system allows the adjacent audio frames to have an overlapped region. For example, an overlapped frame occupies about a half or one third of the original audio frame in size. Since the overlapped audio frame can effectively conceal an error in the audio, a hop size needs to be calculated according to a frame size and an overlapped frame size set by the system when the audio is decoded. The hop size is referred to for calculating the subsequent beat periods. The hop size indicates distance points (e.g., the sampling points) between a starting point of an audio frame and a next starting point of a next audio frame. The hop size is equal to subtracting the overlapped frame size (e.g., a quantity of sampling points within an overlapped audio) from the frame size (e.g., a quantity of sampling points within an audio frame). The frame rate indicates a quantity of the audio frames per one second. The beat period indicates a quantity of the audio frames between two beats. The beat period is used to speculate a next beat.
In particular, according to one embodiment of the present disclosure, after step S211, a recursive algorithm is adopted in the method for speculating a next beat location. The frame rate can be referred to for calculating a quantity of audio frames in a past period of time, and a new beat period can be calculated according to beats per minute. The new beat period can be used to speculate the next beat location (step S213). When the recursive algorithm is performed, the system can re-calculate the new beat period according to the quantity of audio frames for the past period of time at intervals, so as to re-speculate the next beat location.
The system re-calculates the new beat period at intervals and speculates the next beat location, and accordingly the system can determine whether or not the rhythm of the audio is stable. For example, in step S215 of
Reference is made to
In one embodiment of adding the beat-prompting notes, after the next beat location is determined and the audio is determined to have a stable rhythm, the audio can automatically add beeps as the beat-prompting notes. Therefore, when the user randomly chooses one of the streaming videos, a function of enabling the beat-prompting notes is controlled to be activated in the device. The beat-prompting notes act as assistance for body rhythm or assistance for performance practice. After the function of enabling the beat-prompting notes is activated, the beat-prompting notes with a normal speed (e.g., adding the beat-prompting notes based on beats per minute (BPM)), the allegro beat-prompting notes (e.g., adding the beat-prompting note with double BPM), or the adagio beat-prompting notes (e.g., adding the beat-prompting notes with half BPM) are used as beats for an auxiliary sound effect.
Conversely, if it is determined that the rhythm of the audio is unstable in step S215 of
One of the embodiments of the above-described pre-processing procedure in step S207 of
The diagram shows that the output of an audio decoder is in units of audio frames on a time axis. Each time point on the time axis includes audio frames with one or more channels. Each of the audio frames is a digital audio in a form of pulse-code-modulation (PCM). The digital audio can be expressed by the audio frames having f(0)ch(0), f(1)ch(0), . . . f(t)ch(0) in a channel 0 (ch(0)); f(0)ch(1), f(1)ch(1), . . . f(t)ch(1) in a channel 1 (ch(1)); and f(0)ch(m), f(1)ch(m), . . . f(t)ch(m) in a channel m (ch(m)).
Next, the multi-channel audio is converted to a mono-channel. In an aspect of the present disclosure, an averaging operation is performed on the digital signals of the audio frames at the same time, so as to form the mono-channel audio (f(0), f(1), . . . f(t)) used for real-time music rhythm analysis (step S307).
The second step of the pre-processing procedure described in step S209 of
The flowchart shown in the diagram can refer to Equation 1. The system firstly extracts mono-channel audio frames from an audio (step S401). If the sampling rate of the audio is 44,100, the audio is composed of 44,100 sampling points per second (step S403).
The system settings include a frame size that indicates a quantity of sampling points in one audio frame. For example, the frame size is 1,024, which means that an original audio frame includes 1024 sampling points (step S405). The system settings also include an overlapped frame size that indicates an overlapped audio frame between two adjacent audio frames. For example, the overlapped audio frame includes 512 sampling points.
Thus, a hop size can be obtained according to the frame size (e.g., 1024) and the overlapped frame size (e.g., 512). That is, the hop size is equal to subtracting the overlapped frame size from the frame size. The present example shows that the hop size is 512 sampling points, which is equal to subtracting the overlapped frame size (i.e., 512) from the frame size (i.e., 1024) (step S407).
Next, the frame rate can be obtained by dividing the sampling rate by the hop size. An exemplary example in Equation 1 shows that the frame rate is 86.13, which is equal to 44100 divided by 512. This means that the audio frame has 86.13 sampling points (i.e., the frame rate=the sampling rate/the hop size) (step S409).
According to the schematic diagram shown in
The present example shows that the hop size 521 is a quantity of sampling points in a distance between a starting point of the first audio frame 501 and a starting point of the second audio frame 502. The hop size 521 equals to subtracting an overlapped frame size (i.e., a quantity of sampling points covered by an overlapped audio frame) from a frame size (i.e., a quantity of sampling points covered by an audio frame). Therefore, the proxy audio frame is obtained based on the frame size of an original audio frame and the overlapped frame size set by the system. The frame rate that can be calculated according to the sampling rate and the hop size indicates a quantity of the proxy audio frames (f′(t)) in one second.
After the above-mentioned pre-processing procedure is completed, a beat period can be calculated according to the sampling rate obtained by the above steps and an initial value of beats per minute (i.e., an initial BPM value). The beat period is an initial value of the quantity of samples in a beat τ. The quantity of samples in a beat can be referred to for obtaining the beat locations (step S211). As shown in step (f) of Equation 1, when the beats per minute are given to be 120, the beat period calculated in step (g) is 43.06 audio frames.
That is, a beat location is present for every 43.06 audio frames.
Equation 1 is expressed by steps of:
According to the flowchart illustrating the method for analyzing music rhythm in real time in
Generally, the initial beat period can be referred to for speculating the next beat location of the next beat. The beat-prompting notes can be added in the music when it has a stable music rhythm. However, for various types of music, there is no guarantee that the rhythm of the music is always the same. As such, in the method for analyzing music rhythm in real time, the beat location is continuously detected for determining whether or not the beat-prompting notes can be stably outputted when the music is being played. Reference is made to
The flowchart shown in the diagram adopts a dynamic programming method. In the method for analyzing music rhythm in real time, a recursive algorithm is used to speculate the beat locations. According to one embodiment of the present disclosure, an initial BPM (beats per minute) value is firstly decided (step S601). In addition to deciding the initial BPM value according to the system settings, the initial BPM value can also be obtained from an original audio when starting to play the music. Next, the initial value of the beat period (i) can be calculated according to the sampling rate obtained from the audio and the hop size set by the system (step S603). In this regard, reference can be made to Equation 1.
For example, a common initial BPM value is between 60 and 160, the sampling points obtained in the beat period (r) are generally between 44100 and 16537.5, and the quantity of the audio frames in accordance with the frame rate is between 86.13 and 32.
After that, the beat locations can be detected at intervals (e.g., “u” seconds) that are preset by the system. Therefore, the beat period (τ) can be speculated based on the data for a past period of time (e.g., “u” seconds). According to one embodiment of the present disclosure, in the step for re-speculating the beat period, the frame rate (i.e., a quantity of audio frames per second) can also be calculated according to a sampling rate and a hop size. Next, a quantity of the proxy audio frames (f′(t)) for the past period of time (e.g., “u” seconds) can be calculated (step S605). The quantity of the proxy audio frames can be calculated by Equation 2.
When the system obtains the quantity of the proxy audio frames for a period of time, the system re-speculates a new beat period according to beats per minute (BPM) (step S607), and then speculates the next beat location (step S609).
When “u” is exemplified to be six seconds, the quantity of the proxy audio frames included in “u” seconds is represented by the proxy audio frame (f′(t)) that is “6*(44100/512)=516.79.” BPM of music is generally between 60 and 160. By Equation 2, the beat period (τ) falls between 86.13 proxy audio frames and 32 proxy audio frames. This means that the quantity of beats in 6 seconds is between 6 (e.g., 516.79/86.13 is about 6) beats and 16 (e.g., 516.79/32 is about 16) beats. The above-mentioned data can be referred to for determining whether or not the music has a stable rhythm, and for speculating the next beat.
According to an embodiment of the speculated new beat period (step S607), the system will consume a great amount of computing power to constantly calculate the new beat period when continuously receiving audios. However, the computing power can be reduced. According to one of the embodiments, in the method for analyzing music rhythm in real time, instead of calculating every proxy audio frame, the beat period can be re-speculated only if a specific proxy audio frame is speculated as one of the beat locations.
In one further embodiment of the present disclosure, in order to reduce the amount of computation, when the quantity of the proxy audio frames included in a past period of time (e.g., “u” seconds) is calculated, an auto-correlation function (ACF) is incorporated for acquiring a repeating pattern based on correlations of frame information of the audio at different time points, and the beat period is re-speculated by referring to a period having a maximum of the auto-correlation function.
One of the objectives of the method for analyzing music rhythm in real time is to speculate the next beat location. Reference is made to
In the beginning, such as in step S605 of
In the process of speculating the new beat period, reference is made to
Taking past “u” seconds as an example, the data in the “u” seconds includes the quantity “u′” of the proxy audio frames (f′(t)) that can be represented by “u′=u*(sample rate/hop size).” The auto-correlation function (ACF) is exemplarily expressed by Equation 3. The auto-correlation function in Equation 3 introduces an onset value (O(t)) that refers to Equation 4.
The function “f′k(t)” denotes a k-th sampling point of f(t). For example, if each f(t) includes 1024 sampling points, O(t) is a sum of values of all of the sampling points of f(t).
For example, if the beat period τ=30, it means that one beat appears in every 30 proxy audio frames (f′(t)), and the number “z” is between “τ−20” and “τ+20”. If τ=30, τ−20, . . . , τ+20=10, 11, . . . , 50. The numeral “u” ′ is an amount of data in “u” seconds.
Thus, when the new beat period is speculated, the onset value (O(t)) of the proxy audio frame (f′(t)) is calculated. The onset value (O(t)) is a concept of an energy envelope. It is expected that every beat has a stronger or a strongest energy. Therefore, when speculating the beat period, a maximum of the onset value or a value that is calculated from the onset values is obtained. That is, the beat period can be speculated from the onset values of the proxy audio frames within a period of time. If the period “z” having the maximum of the auto-correlation function (ACF) is a correct beat period, the value (e.g., as O(t)O(t−z), O(t−1)O((t−1)−z), 0(t−(u′−1))O((t−(u′−1))−z)) multiplied by the onset values at the beats separated by “z” of the first group data 81 of
It should be noted that, in addition to the method using the auto-correlation function, the following methods can also be used (but are not limited thereto). For example, in a method of energy difference, a difference of an energy envelope between every two adjacent audio frames or proxy audio frames (f′(t)) can be calculated. The larger the difference of the energy envelope is, the greater the change of energy between two audio frames is. In this way, the onset value can be determined.
Furthermore, a spectral difference method can be incorporated to obtain an energy difference of a specific frequency band by performing the Fourier transform on the audio frames or the proxy audio frames. A larger energy difference means that there is a greater energy change in the frequency band, and an onset value can thus be determined. For example, the energy change can be determined according to a spectral distribution of drum beats acting as the rhythm in music, and the beat locations can be found according to the onset values.
Further, a phase deviation method can be incorporated to inspect the onset values in the audio based on phases of the audio. Still further, a complex spectral difference method can be used to detect the onset values that are used for tracing the beat locations of the music.
When a sum of the energy values of all of the sampling points in a specific proxy audio frame (f′(t)) is calculated, the onset values (O(t)) in the audio can be obtained. The larger the sum of the energy values is, the more characteristic the onset value is. Accordingly, the beat locations of the music can be determined. However, in order to more accurately determine the beat locations of the music, a beat detection value (C(t)) can be further calculated (step S705).
According to the above embodiments of the present disclosure, the auto-correlation function (ACF) uses the onset value of each of the audio frames as the characteristics for auto correlation, so as to obtain the beat period (T). Furthermore, the beat locations should be more precisely confirmed due to a normal person's sensitivity to rhythm. Therefore, in order to ensure that the beat periods can be correctly outputted, apart from speculating the beat period based on the onset values, the beat period for a past period of time is also referred to for determining whether or not to have the same characteristics for auto correlation. According to one embodiment of the present disclosure, the beat detection value (C(t)) is incorporated for acquiring the sampling points around the onset value (O(t)) through defined beat detection values.
The beat detection value (C(t)) is defined as Equation 5.
Here, “T” denotes the beat period, and the numerical value “u” denotes a weight value. In an embodiment of the present disclosure, the numerical value “u” is given by the system as a fixed initial value, and the numerical value “u” is used to determine a specific weight for weighting the calculation between the onset value and the beat detection value (C(t+v)) in the past period of time. For example, the earlier beat detection value is given a lower weight value, and the log-Gaussian transition weighting function “W” acts as a coefficient for the equation. The related citation is “Real-Time Beat-Synchronous Analysis of Musical Audio” published by A. M. Stark, M. E. P. Davies, and M. D. Plumbley in Proceedings of the 12th International Conference on Digital Audio Effects (DAFx-09) Como, Italy, Sep. 1-4, 2009. Furthermore, the variable “v” is used to define how long ago the beat detection value needs to be taken into consideration. In the present example, v=−(2τ), . . . , −(τ/2).
According to Equation 5, when 0<=t<=2τ, it may occur that the beat detection value C(t) lacks the beat detection value C(t+v), and the value “0” is then introduced. Taking the beat detection value C(0) as an example, since both beat detection values “C(−2τ)” and “C(−τ/2)” do not exist, the value “Max(C(t+v))” is actually “0”, and can be expressed by “C(0)=(1−α)O(t).” In this condition, only the onset value of the proxy audio frame (f′(0)) with “t=0” is referred to.
As shown in Equation 5, the maximum (MAX) of the beat detection values in the multiple past beat periods (i) can be obtained. In the present example shown in the diagram, the maximum of the beat detection values of the two reference beats 903 and 905 is multiplied by the coefficient “W(v)”, and the product can be used as the beat detection value (C(t)) of the current beat 901 (step S705).
Through the above-described steps in accordance with Equation 5, the onset value (O(t)) for each of the proxy audio frames can be obtained, and the maximum beat detection value (Max(C(t+v)*W(v))) of the sampling points around the onset value can be calculated. The above two values can then be added with the weight value “α”, and can be used as the beat detection value of the proxy audio frame. Accordingly, the larger the beat detection value is, the more likely the audio frame is determined as a beat of the music.
Next, step S707 of
When speculating the next beat location, the beat detection values of all of the beats in the past period of time are used to speculate the beat detection values of the beats in the next beat period. Equation 6 is referred to for calculating the beat detection values C(t+x).
Here, the beat detection value (C(t+x)) denotes the beat detection value of the proxy audio frame (f′(t+x)) at each time point “t+x” to be speculated within a next beat period (x=1, . . . ,τ) after the time point “t.” After that, the beat period (x′, t′) with the maximum beat detection value (C(t+x)) can be obtained, and can be used as the beat location for the next beat period. This means that the next beat is speculated to appear in a specific proxy audio frame (f′(t′)).
Reference is made to
During computation, the maximum beat detection value (MAX) in the reference beat periods 1005 and 1007 is multiplied by the coefficient “W(v)”, and the product is used as the beat detection value of the next beat period 1003. In the present example shown in the diagram, the audio frame having the maximum beat detection value in the next beat period 1003 is speculated to be the location of the next beat. For example, in the diagram, if the maximum value of the beat detection values (C(t+τ−3), C(t+1), . . . , C,(t+τ)) in the next beat period 1003 is “C(t′)=C(t+τ−3)”, the corresponding proxy audio frame (f′(t+τ−3)) is speculated to be the audio frame having the next beat. At this time, the steps (e.g., step S213 of
However, in the system for analyzing music rhythm in real time, the beat-prompting notes added in the music may disturb the person who listens to the music due to the change of the music rhythm at any time, and this problem still needs to be addressed. Therefore, a determination of beat stability is incorporated in the method for analyzing music rhythm in real time (step S215 of
Firstly, the system should define what the beat stability is. Reference is made to
Based on the frame information shown in the diagram, if a current audio frame (f(t)) is determined as a beat, an auto-correlation function is used to re-speculate a new beat period according to an onset energy record for past “n” seconds. A mechanism of determining whether or not the rhythm is stable is introduced. If the audio rhythm is determined as stable, the current audio frame (f(t)) is regarded as a beat location, and is referred to as a beat frame (i.e., where the beat-prompting note is added). Equation 7 is used to determine whether or not the beat is stable.
In the diagram, an audio frame (f(t)) 1101 and another audio frame (f(t+1)) 1102 that are at two consecutive time points are shown. After a hop size (h(n)) 1105 and a hop size (h(n+1)) 1106 are calculated, a proxy audio frame (f′(n)) 1103 and a proxy audio frame (f′(n+1)) 1104 can be obtained. If the audio frames (f(t0′), f′(t1′), f(t2′), . . . , f(tn′)) are speculated as the beat frames, after a next beat location in the new beat period is obtained, whether or not the rhythm of the audio is stable can be determined by retracing multiple beat locations and calculating multiple time differences (“d”) between every two adjacent beat locations.
If the “d” values (dn−0, dn−1, . . . , dn−i, i.e., the time differences shown in Equation 7) to be calculated by retracing “i” times are the same, it means that the beat periods are the same, and the audio is determined to have a stable rhythm. Afterwards, the beat-prompting notes are configured to be added at the beat locations.
When the method for analyzing music rhythm in real time of the present disclosure is applied to a specific device, the function of beat-prompting notes can be activated if the received data is determined to be an audio having a stable rhythm. The beat-prompting notes can be added to the audio in a normal, an allegro, or an adagio speed. For example, in Equation 7, the beat-prompting notes can be selectively added to the audio frames that are determined as the beat locations. The beat-prompting notes can be added to the audio frames (f(tn′), f(tn′+d)) at a speed of one time BPM (beats per minute) in a normal mode; the beat-prompting notes can be added to the audio frames (f(tn′), f(tn′+d/2)) at a speed of double BPM in an allegro mode; or the beat-prompting notes can be added to the audio frames (f(tn′), f(tn′+2d)) at a speed of half BPM in an adagio mode.
Further, the system introduces an intelligent model that has learned various rhythms, and the system having this intelligent model can accurately speculate the beat period. Accordingly, the system can achieve real-time music rhythm analysis for accurately adding the beat-prompting notes.
In conclusion, in the method and the system for analyzing music rhythm in real time provided by the present disclosure, the beat period is firstly determined by analyzing the frame information of the audio, so as to determine the beat locations. In this way, the beat-prompting notes can be added when the music has a stable rhythm. The rhythm in the music can be analyzed in real time, and the purpose of adding the beat-prompting noted into the audio on demand can be achieved.
The foregoing description of the exemplary embodiments of the disclosure has been presented only for the purposes of illustration and description and is not intended to be exhaustive or to limit the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teaching.
The embodiments were chosen and described in order to explain the principles of the disclosure and their practical application so as to enable others skilled in the art to utilize the disclosure and various embodiments and with various modifications as are suited to the particular use contemplated. Alternative embodiments will become apparent to those skilled in the art to which the present disclosure pertains without departing from its spirit and scope.
Number | Date | Country | Kind |
---|---|---|---|
112138193 | Oct 2023 | TW | national |