Summary of the invention
The invention provides a kind of method and system of Real-time Obtaining musical tempo information, to realize the real-time follow-up of music signal and prediction, for various beat operation real time implementations provide accurate information.
For this reason, the invention provides following technical scheme:
A method for Real-time Obtaining musical tempo information, comprising:
Real-time follow-up receives music signal, and described music signal is carried out to discrete sampling, obtains sample sequence;
According to described sample sequence, determine the historical set of paths of the beat starting point of the music signal section of estimating;
The new beat cycle that receives music signal of prediction;
According to the beat cycle of the historical set of paths of described beat starting point and prediction, determine the beat starting point of subsequent sound music signal.
Preferably, describedly according to described sample sequence, determine that the historical set of paths of the beat starting point of the music signal section of estimating comprises:
After receiving the music signal of the first duration, according to described sample sequence, obtain each effective peak point in current demand signal waveform envelope;
Selection has a plurality of effective peak points of amplitude peak as initial beat starting point;
After receiving the music signal of the second duration, the follow-up beat point of each initial beat starting point is predicted, and obtained the historical set of paths of beat starting point.
Preferably, described each effective peak point obtaining in current demand signal waveform envelope according to described sample sequence comprises:
To described sample sequence rarefaction, obtain the sequence that resamples;
The high-frequency signal resampling described in filtering in sequence, and utilize to fill soon and put slowly the envelope signal that envelope detector obtains the resampling sequence after filtering high-frequency signal;
According to described envelope signal, obtain each effective peak point in current demand signal waveform envelope.
Preferably, described described sample sequence rarefaction is comprised:
The sampled point of selecting successively to have amplitude peak from the sampled point of predetermined number is new sampled point; Or
Successively the sampled point amplitude of predetermined number is weighted average rear as new sampled point.
Preferably, described each effective peak point obtaining in current demand signal waveform envelope according to described envelope signal comprises:
Described envelope signal is carried out to first order difference and half-wave rectification, and signal is strengthened;
Described envelope signal and described reinforcement signal are weighted on average, are compensated signal;
According to described compensating signal, obtain each effective peak point.
Preferably, the described follow-up beat point to each initial beat starting point is predicted and is comprised:
To each initial beat starting point, in the time range of setting thereafter, search has a plurality of effective peak points of amplitude peak, and the new beat point using described a plurality of effective peak points as described initial beat starting point successively;
Each new beat point is continued to expansion, obtain follow-up new beat point.
Preferably, the beat cycle that described prediction newly receives music signal comprises:
According to the effective peak point sequence in the 3rd duration, generate candidate peak point sequence;
According to described candidate peak point sequence, calculate respectively the accumulation amplitude of the candidate peak point sequence of each possible beat under the cycle;
Determine described possible beat chronon region number and time subregion that in the cycle, the optimum beat cycle occurs;
According to chronon region number and the time subregion that the accumulation amplitude obtaining, optimum beat cycle occur, determine the new beat cycle that receives music signal.
Preferably, described according to the beat cycle of the historical set of paths of described beat starting point and prediction, determine that the beat starting point of subsequent sound music signal comprises:
The integrate score that calculates the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, described beat starting point history path;
Determine the beat starting point in subsequent sound music signal according to the beat cycle of last beat starting point and prediction on the historical path of the beat starting point with maximum integrate score.
Preferably, described method also comprises:
The beat cycle to the current music signal of determining is optimized;
Described according to the beat cycle of the historical set of paths of described beat starting point and prediction, determine that the beat starting point of subsequent sound music signal comprises:
According to the beat cycle after the historical set of paths of described beat starting point and optimization, determine the beat starting point of subsequent sound music signal.
Preferably, the described beat cycle to the current music signal of determining is optimized and comprises:
The integrate score that calculates the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, described beat starting point history path;
According to the preferred follow-up investigation of the integrate score path in each historical path of preferred beat starting point;
Determine the beat cycle that described investigation path is corresponding according to the beat cycle of described current music signal and average tempo cycle corresponding to described investigation path.
A system for Real-time Obtaining musical tempo information, comprising:
Sampling module, receives music signal for real-time follow-up, and described music signal is carried out to discrete sampling, obtains sample sequence;
Historical path determination module, for determining the historical set of paths of the beat starting point of the music signal section of estimating according to described sample sequence;
Beat period forecasting module, for predicting the beat cycle of new reception music signal;
Beat starting point determination module, for according to the beat cycle of the historical set of paths of described beat starting point and prediction, determines the beat starting point of subsequent sound music signal.
Preferably, described historical path determination module comprises:
Effective peak point acquisition module, for receiving at described sampling module after the music signal of the first duration, obtains each effective peak point in current demand signal waveform envelope according to described sample sequence;
Select module, for selecting a plurality of effective peak points with amplitude peak as initial beat starting point;
Beat point prediction module, for receiving at described sampling module after the music signal of the second duration, predicts the follow-up beat point of each initial beat starting point, and obtains the historical set of paths of beat starting point.
Preferably, described effective peak point acquisition module comprises:
Resampling unit, has in to described sample sequence rarefaction, obtains the sequence that resamples;
Filter unit, for the high-frequency signal of the sequence that resamples described in filtering;
Envelope signal acquiring unit, puts for utilizing to fill soon the envelope signal that envelope detector obtains the resampling sequence after filtering high-frequency signal slowly;
Effective peak point acquiring unit, for obtaining each effective peak point of current demand signal waveform envelope according to described envelope signal.
Preferably, described resampling unit, is new sampled point specifically for select successively to have the sampled point of amplitude peak from the sampled point of predetermined number; Or successively the sampled point amplitude of predetermined number is weighted average rear as new sampled point.
Preferably, described effective peak point acquiring unit comprises:
Signal processing unit, for described envelope signal is carried out to first order difference and half-wave rectification, signal is strengthened;
Compensating unit, for described envelope signal and described reinforcement signal are weighted on average, is compensated signal, and obtains each effective peak point according to described compensating signal.
Preferably, described beat point prediction module, specifically for successively, to each initial beat starting point, in the time range of setting thereafter, search has a plurality of effective peak points of amplitude peak, and the new beat point using described a plurality of effective peak points as described initial beat starting point; Each new beat point is continued to expansion, obtain follow-up new beat point.
Preferably, described beat period forecasting module comprises:
Candidate peak point sequence generation module, for according to the effective peak point sequence in the 3rd duration, generates candidate peak point sequence;
Computing module, for calculating respectively the accumulation amplitude of the candidate peak point sequence of each possible beat under the cycle according to described candidate peak point sequence;
The first determination module, for chronon region number and the time subregion of determining that the described possible optimum beat cycle in beat cycle occurs;
The second determination module, for chronon region number and the time subregion occurring according to the accumulation amplitude obtaining, optimum beat cycle, determines the new beat cycle that receives music signal.
Preferably, described beat starting point determination module, specifically for calculating the integrate score in the historical path of every beat starting point, described integrate score comprises: in the historical path of described beat starting point and the accumulation range value of beat point, the variance of mistiming on the historical path of described beat starting point between each adjacent beat starting point, and mean value and the difference in described beat cycle of mistiming between each beat, and determine the beat starting point in subsequent sound music signal according to the beat cycle of last beat starting point and prediction on the historical path of the beat starting point with maximum integrate score.
Preferably, described system also comprises:
Optimize module, for the beat cycle of the current music signal of determining is optimized;
Described beat starting point determination module, specifically for the beat cycle according to the historical set of paths of described beat starting point and after optimizing, determines the beat starting point of subsequent sound music signal.
Preferably, described optimization module comprises:
Integrate score computing unit, for calculating the integrate score in the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, described beat starting point history path;
Investigate unit, for according to the preferred follow-up investigation of the integrate score path in each historical path of preferred beat starting point;
Beat cycle determining unit, for determining according to the beat cycle of described current music signal and average tempo cycle corresponding to described investigation path the beat cycle that described investigation path is corresponding.
The method and system of the Real-time Obtaining musical tempo information that the embodiment of the present invention provides, by real-time follow-up, receive music signal, and described music signal is carried out to discrete sampling, obtain sample sequence, then according to described sample sequence, determine the historical set of paths of the beat starting point of the music signal section of estimating, in the new beat cycle that receives music signal of prediction, according to the beat cycle of the historical set of paths of described beat starting point and prediction, determine the beat starting point of subsequent sound music signal.Thereby in music, can immediately determine next beat starting point, realize the look-ahead to follow-up beat starting point, for the real time implementation of various beat operation responses provides condition.
Embodiment
In order to make those skilled in the art person understand better the scheme of the embodiment of the present invention, below in conjunction with drawings and embodiments, the embodiment of the present invention is described in further detail.
The method and system of the Real-time Obtaining musical tempo information that the embodiment of the present invention provides, by real-time follow-up, receive music signal, and described music signal is carried out to discrete sampling, obtain sample sequence, then according to described sample sequence, obtain useful signal peak point sequence, and utilize described useful signal peak point sequence to determine follow-up beat starting point.Thereby in music, can immediately determine next beat starting point, realize the look-ahead to follow-up beat starting point, for the real time implementation of various beat operation responses provides condition.
As shown in Figure 1, be the process flow diagram of the method for embodiment of the present invention Real-time Obtaining musical tempo information, comprise the following steps:
Step 101, real-time follow-up receives music signal, and described music signal is carried out to discrete sampling, obtains sample sequence.
Music beat is the number of per minute music beat, music beat value bpm and music beat cycle T
bpmthere is following relation:
bpm=60/T
bpm (1)
In sampling rate, be f
stime,
bpm=60*f
s/T
n (2)
Wherein, T
n=T
bpm* f
s=60*f
s/ bpm;
Generally, the value of bpm is between 45~180, and music beat frequency is between 0.75Hz~3Hz, and the music beat cycle, bpm was the feature showing in the long period between 0.33s~1.33s.
Undetected for fear of bpm, to guarantee that bpm each bpm value in 45~180 scopes is distinguishable, needs to adopt higher sampling rate, such as, f
scan value be f
s>537.
Step 102, determines the historical set of paths of the beat starting point of the music signal section of estimating according to described sample sequence.
Particularly, (for convenience, the first duration is designated as to T receiving the first duration
0) music signal after, according to described sample sequence, obtain each effective peak point in current demand signal waveform envelope, and select a plurality of effective peak points wherein with amplitude peak as initial beat starting point, then after receiving the music signal of the second duration, follow-up beat point to each initial beat starting point is predicted, thereby the historical set of paths of obtaining beat starting point, detailed process will be described hereinafter.
Step 103, the new beat cycle that receives music signal of prediction.
Concrete forecasting process will be described in detail later.
Step 104, according to the beat cycle of the historical set of paths of described beat starting point and prediction, determines the beat starting point of subsequent sound music signal.
Particularly, the integrate score that can first calculate the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, described beat starting point history path; Then according to the beat cycle of last beat starting point and prediction on the historical path of the beat starting point with maximum integrate score, determine the beat starting point in subsequent sound music signal.
In order to reduce operand, can from the historical path of described beat starting point, select (the preferably selection in the historical path of beat of the historical path of some preferred beats, integrate score with the every paths of subsequent calculations, if score is on the low side, this path is by deleted), then calculate respectively the accumulation range value of each beat starting point in the historical path of every preferred beat starting point, the preferred mean value of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat on the historical path of beat starting point
and estimate the difference between beat cycle T.
Then, consider each parameter obtained above, average such as being weighted, weighting system can need to be set according to practical application, and meeting coefficient summation is 1, obtains the integrate score in every historical path of preferred beat.
Further, in order to improve counting yield and validity, also can adopt the mode of forgetting factor only to calculate up-to-date M(on historical path such as selecting M=5 etc.) integrate score of the new route that forms of individual beat starting point.
The beat starting point in subsequent sound music signal can be calculated by following formula:
Wherein,
for thering is the beat of maximum score, put the moment position of last beat point on historical path,
for the beat cycle.
Visible, the method of the Real-time Obtaining musical tempo information that the embodiment of the present invention provides, by real-time follow-up, receive music signal, and described music signal is carried out to discrete sampling, obtain sample sequence, then according to described sample sequence, determine the historical set of paths of the beat starting point of the music signal section of estimating, the new beat cycle that receives music signal of prediction, according to the beat cycle of the historical set of paths of described beat starting point and prediction, determine the beat starting point of subsequent sound music signal.Thereby in music, can immediately determine next beat starting point, realize the look-ahead to follow-up beat starting point, for the real time implementation of various beat operation responses provides condition.
As shown in Figure 2, be in the embodiment of the present invention, according to sample sequence, to determine to comprise the following steps the process flow diagram of historical set of paths of the beat starting point of the music signal section of estimating:
Step 201, after receiving the music signal of the first duration, obtains each effective peak point in current demand signal waveform envelope according to described sample sequence.
Due in preceding step 101 in order to guarantee the resolvability of each bpm value, need to adopt higher sampling rate to sample to the music signal of input, thereby need sampled point quantity meeting to be processed a lot, this not only can consume a large amount of calculation resources, and can increase operation time, be unfavorable for real-time detection.
For this reason, in the embodiment of the present invention, during each effective peak point in obtaining current demand signal waveform envelope, can first to described sample sequence, carry out rarefaction, down-sampled, obtain the sequence that resamples.Then, then according to the resampling retrieval useful signal peak point sequence that obtains.
To the actual audiometry of music signal and time-frequency characteristic analysis, can find out, when music beat occurs, its signal amplitude is larger than signal amplitude At All Other Times, therefore, can from N sampled point, determine the new sampled point that is sampled as of an amplitude peak, that is to say, the first duration receiving (is designated as to T by the first duration for convenience,
0) music signal, every N continuous sampled point is one group, selects a new sampled point in every group, forms described resampling sequence, thereby reach down-sampled object by these new sampled points.
Particularly, the sampled point that can directly choose amplitude maximum from N sampled point is as new sampled point, also the amplitude of a described N sampled point can be weighted to the sampled point that obtains after average as new sampled point.Certainly, other down-sampled method of also can sampling obtains described resampling sequence, and this embodiment of the present invention is not limited.
It should be noted that, above-mentioned parameter N can be according to the concrete running environment of system, and balanced consideration sample frequency and system treatment effeciency are determined.Such as, in sample rate f
sin situation for 8kHz, N=10 can be set.
Further, utilize the high-frequency signal resampling in sequence described in low pass filter filters out, such as, adopt butterworth filter, Chebyshev filter etc., and utilize to fill soon and put slowly the envelope signal that envelope detector obtains the resampling sequence after filtering high-frequency signal, thereby obtain each effective peak point in current demand signal waveform envelope according to described envelope signal.Fill soon that to put slowly the charging rate of envelope detector very little, even very narrow pulse also very charging quickly to stationary value, after intermediate frequency blackout, because the discharge time constant of circuit is very large, the output voltage of detection can remain on peak value within a very long time, thereby can detect preferably its peak point.
In actual applications, can be after obtaining described envelope signal, directly select local peak in described envelope signal as candidate peak point, by these candidate peak points, form useful signal peak point sequence.
Further, consider that signal is easily subject to noise jamming and causes part (such as the signal of a frame signal or certain time length) to have a plurality of peak points, can affect the validity that peak point is selected, for this reason, can also obtain in the following ways useful signal peak point sequence, first described envelope signal is carried out to first order difference and half-wave rectification, signal is strengthened; Then described envelope signal and described reinforcement signal are weighted on average, realize the compensation to differential signal, be compensated signal; Last in the waveform envelope of described compensating signal by selecting local peak to obtain each effective peak point, these effective peak points have formed useful signal peak point sequence.Wherein described envelope signal and described reinforcement signal being weighted to average weighting coefficient can be preset by system.
Step 202 selects a plurality of effective peak points with amplitude peak as initial beat starting point from described effective peak point.
In actual applications, can from above-mentioned useful signal peak point sequence, select K the peak point with amplitude peak as initial beat starting point.
It should be noted that above-mentioned parameter T
0can preset with the value of K.T
0for controlling the data volume of estimating initial beat starting point, need to comprise at least one beat, thereby it can be set is one to be greater than the numerical value (the normal beat cycle is conventionally in 0.3s~1.3s) of 0.3s, such as T is set
0=0.5s.Parameter K, for accuracy rate and the operation efficiency of the follow-up beat starting point prediction of balance, can be set to a less integer, such as K=3 is set.
Step 203, after receiving the music signal of the second duration, predicts the follow-up beat point of each initial beat starting point, obtains the historical set of paths of beat starting point.
That is to say, can (for convenience, the second duration be designated as to T receiving the second duration
1) music signal after, complete the prediction of the follow-up beat starting point of the beat starting point in the current demand signal to estimating.When prediction, need to be successively to each initial beat starting point, in the time range of setting thereafter, search has a plurality of effective peak points of amplitude peak, and the new beat point using described a plurality of effective peak points as described initial beat starting point; Each new beat point is continued to expansion, obtain follow-up new beat point.
Such as, to each the candidate's beat starting point in K definite in step 202 candidate's beat starting point, at certain hour territory (T thereafter
min, T
max) in utilize useful signal peak point sequence that should the period continued to K the peak point that search has amplitude peak, as the candidate collection of the follow-up beat starting point of current candidate's beat starting point.The rest may be inferred, to each new search to beat starting point can continue to obtain the candidate collection of its follow-up beat starting point.
Wherein, parameter T
1, T
min, T
maxby system, set in advance respectively.T wherein
1for determining the expansion depth in the historical path of initial beat starting point, T
min, T
maxthe time range occurring for controlling next beat.Such as, T can be set
1=2s, T
min=0.3s, T
max=1.3s.
By said process, for each beat starting point, all a corresponding historical path, the i.e. historical path of beat starting point.
As shown in Figure 3, be the new process flow diagram that receives the beat cycle of music signal of prediction in the embodiment of the present invention, comprise the following steps:
Step 301, obtains the effective peak point sequence in the 3rd duration.
Particularly, supposing the system estimates the beat cycle at moment t, system first since moment t forward backstepping the 3rd duration (for convenience, the 3rd duration is designated as to T
2), utilize T
2useful signal peak point sequence corresponding to sample sequence in period determined beat cycle T
y.Wherein, parameter T
2for controlling the data volume of estimating the beat cycle, can be by systemic presupposition, such as T is set
2=2s.
Step 302, obtains the candidate peak point in described effective peak point sequence, generates candidate peak point sequence.
First, according to the useful signal peak point sequence in described the 3rd duration, calculate the average amplitude of each effective peak point amplitude
with amplitude peak M
max, determine subsequently the selection decision threshold M of candidate peak point
t, finally select all amplitudes to be greater than described decision threshold M
teffective peak point as candidate peak point.
Calculating decision threshold M
ttime, can adopt average weighted method, using the weighted mean value of described average amplitude and amplitude peak as described decision threshold M
t,
wherein, parameter a, b can be preset by system, for controlling the size of decision threshold, and meets a+b=1.Such as, a=0.5 can be set, b=0.5.
Step 303, calculates respectively the accumulation amplitude of the candidate peak point sequence of each possible beat under the cycle according to described candidate peak point sequence.
Particularly, can calculate as follows:
Wherein, the implication of each parameter is as follows:
PeakNo is total number of the candidate peak point in described candidate peak point sequence;
Be used for describing candidate peak point P
iin beat cycle T
junder the accumulation amplitude in the historical path of peak value;
Parameter K
i=(2f
s-P
i)/T
j,
T
jthe beat cycle,
T
j∈{60*f
s/bpm
max,60*f
s/bpm
max+1,...,60*f
s/bpm
max+j,...,60*f
s/bpm
min};
F
sit is sampling rate;
Bpm
min, bpm
maxbe respectively minimum value and the maximal value of the bpm of common music beat, be made as 45 and 180.
Step 304, determines described possible beat chronon region number and time subregion that in the cycle, the optimum beat cycle occurs.
Particularly, the number in chronon region is
The sampled point number comprising in each chronon region is
Chronon region is as follows respectively:
Step 305, according to chronon region number and the time subregion that the accumulation amplitude obtaining, optimum beat cycle occur, determines the beat cycle of current music signal.
First, in described chronon region, select beat cycle corresponding to cumulative maximum amplitude as candidate's beat cycle.Then, determine 2 times of chronon regions that fall in candidate's beat cycle of very first time subregion, and determine whether candidate's beat cycle in this chronon region is the integral multiple in candidate's beat cycle of very first time subregion; If so, candidate's beat cycle of selecting very first time subregion is the optimum beat cycle, otherwise candidate's beat cycle of selecting this chronon region is the optimum beat cycle.The beat cycle using the optimum beat cycle of determining as current music signal.
For the beat cycle that makes to utilize above-mentioned flow process to obtain more accurate, in embodiments of the present invention, also can further to the described beat cycle, be optimized.Correspondingly, when determining the beat starting point of subsequent sound music signal, just can determine in the beat cycle according to the historical set of paths of described beat starting point and after optimizing.
As shown in Figure 4, be the process flow diagram in the embodiment of the present invention, the beat cycle being optimized, comprise the following steps:
Step 401, calculates the integrate score in each historical path of preferred beat starting point.
First, calculate respectively the accumulation range value of each beat starting point in the historical path of every preferred beat starting point, the preferred mean value of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat on the historical path of beat starting point
and estimate the difference between beat cycle T (the beat cycle that namely flow process shown in above-mentioned Fig. 3 obtains).
Then, consider each parameter obtained above, average such as being weighted, weighting system can need to be set according to practical application, and meeting coefficient summation is 1, obtains integrate score.
Further, in order to improve counting yield and validity, also can adopt the mode of forgetting factor only to calculate up-to-date M(on historical path such as selecting M=5 etc.) integrate score of the new route that forms of individual beat starting point.
Step 402, according to the preferred follow-up investigation of the integrate score path in each historical path of preferred beat starting point.
Particularly, the integrate score in each historical path of preferred beat starting point that can obtain according to step 401 sorts to the historical path of described preferred beat starting point, selects the historical path of K bar wherein with top score as follow-up investigation path.Wherein, parameter K can set in advance, such as, select K=3.
Step 403, calculates respectively every investigation beat cycle corresponding to path in described follow-up investigation path.
Particularly, can calculate as follows every and investigate new beat cycle corresponding to path, and the beat cycle after the corresponding optimization using the new beat cycle calculating as this investigation path.
Wherein,
be that i bar is investigated average tempo cycle corresponding to path, T is the beat cycle of estimating.
Parameter a, b are weighting coefficient, meet a+b=1, specifically can determine according to practical application, such as selecting a=b=0.5.
Based on the above-mentioned optimization to the beat cycle of estimating, during beat starting point in determining subsequent sound music signal, just can determine the beat starting point in subsequent sound music signal according to the beat cycle after optimizing and the historical path of described beat starting point, particularly, the beat starting point in subsequent sound music signal can be come to determine as follows:
Wherein,
for thering is the moment of last beat point on the historical path of beat starting point of maximum integrate score,
for the beat cycle after optimization corresponding to this history path.
Correspondingly, the embodiment of the present invention also provides a kind of system of Real-time Obtaining musical tempo information, as shown in Figure 5, is a kind of structural representation of this system.
In this embodiment, described system comprises:
Sampling module 501, receives music signal for real-time follow-up, and described music signal is carried out to discrete sampling, obtains sample sequence;
Historical path determination module 502, for determining the historical set of paths of the beat starting point of the music signal section of estimating according to described sample sequence;
Beat period forecasting module 503, for predicting the beat cycle of new reception music signal;
Beat starting point determination module 504, for according to the beat cycle of the historical set of paths of described beat starting point and prediction, determines the beat starting point of subsequent sound music signal.Specifically can calculate the integrate score in the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, the historical path of described beat starting point, and determine the beat starting point in subsequent sound music signal according to thering is the beat cycle of last beat starting point and prediction on the beat starting point history path of maximum integrate score.
Visible, the system of the Real-time Obtaining musical tempo information that the embodiment of the present invention provides, by real-time follow-up, receive music signal, and described music signal is carried out to discrete sampling, obtain sample sequence, then according to described sample sequence, determine the historical set of paths of the beat starting point of the music signal section of estimating, the new beat cycle that receives music signal of prediction, according to the beat cycle of the historical set of paths of described beat starting point and prediction, determine the beat starting point of subsequent sound music signal.Thereby in music, can immediately determine next beat starting point, realize the look-ahead to follow-up beat starting point, for the real time implementation of various beat operation responses provides condition.
As shown in Figure 6, be a kind of specific implementation structure of historical path determination module in the embodiment of the present invention.
This history path determination module comprises:
Effective peak point acquisition module 601, for receiving after the music signal of the first duration at above-mentioned sampling module 501, obtains each effective peak point in current demand signal waveform envelope according to described sample sequence;
Select module 602, for selecting a plurality of effective peak points with amplitude peak as initial beat starting point;
Beat point prediction module 603, for receiving at sampling module 501 after the music signal of the second duration, predicts the follow-up beat point of each initial beat starting point, and obtains the historical set of paths of beat starting point.When prediction, need to be successively to each initial beat starting point, in the time range of setting thereafter, search has a plurality of effective peak points of amplitude peak, and the new beat point using described a plurality of effective peak points as described initial beat starting point; Each new beat point is continued to expansion, obtain follow-up new beat point.
Above-mentioned effective peak point acquisition module 601 specifically can comprise following unit:
Resampling unit, for to described sample sequence rarefaction, obtains the sequence that resamples.The sampled point of specifically can be successively selecting to have amplitude peak from the sampled point of predetermined number is new sampled point; Or successively the sampled point amplitude of predetermined number is weighted average rear as new sampled point.
Filter unit, for the high-frequency signal of the sequence that resamples described in filtering.
Envelope signal acquiring unit, puts for utilizing to fill soon the envelope signal that envelope detector obtains the resampling sequence after filtering high-frequency signal slowly.
Effective peak point acquiring unit, for obtaining each effective peak point of current demand signal waveform envelope according to described envelope signal.
It should be noted that, in actual applications, above-mentioned effective peak point acquiring unit can directly select local peak in described envelope signal as candidate peak point, by these candidate peak points, forms useful signal peak point sequence.
Further, consider that signal is easily subject to noise jamming and causes part (such as the signal of a frame signal or certain time length) to have a plurality of peak points, can affect the validity that peak point is selected, for this reason, a kind of specific implementation structure of above-mentioned effective peak point acquiring unit can also comprise following unit:
Signal processing unit, for described envelope signal is carried out to first order difference and half-wave rectification, signal is strengthened;
Compensating unit, for described envelope signal and described reinforcement signal are weighted on average, is compensated signal, and obtains each effective peak point according to described compensating signal.
As shown in Figure 7, be a kind of specific implementation structure of beat period forecasting module in the embodiment of the present invention.
Candidate peak point sequence generation module 701, for according to the effective peak point sequence in the 3rd duration, generates candidate peak point sequence.Particularly, can, according to the useful signal peak point sequence in described the 3rd duration, calculate the average amplitude of each effective peak point amplitude
with amplitude peak M
max, determine subsequently the selection decision threshold M of candidate peak point
t, finally select all amplitudes to be greater than described decision threshold M
teffective peak point as candidate peak point.
Computing module 702, for calculate respectively the accumulation amplitude of the candidate peak point sequence of each possible beat under the cycle according to described candidate peak point sequence, concrete computation process can, with reference to the description in the inventive method embodiment above, not repeat them here.
The first determination module 703, for chronon region number and the time subregion of determining that the optimum beat cycle in described possible beat cycle occurs, determining of chronon region number and time subregion can, with reference to the description in the inventive method embodiment above, not repeat them here.
The second determination module 704, for chronon region number and the time subregion occurring according to the accumulation amplitude obtaining, optimum beat cycle, determines the new beat cycle that receives music signal.Particularly, can first in described chronon region, select beat cycle corresponding to cumulative maximum amplitude as candidate's beat cycle.Then, determine 2 times of chronon regions that fall in candidate's beat cycle of very first time subregion, and determine whether candidate's beat cycle in this chronon region is the integral multiple in candidate's beat cycle of very first time subregion; If so, candidate's beat cycle of selecting very first time subregion is the optimum beat cycle, otherwise candidate's beat cycle of selecting this chronon region is the optimum beat cycle.The beat cycle using the optimum beat cycle of determining as current music signal.
As shown in Figure 8, be the another kind of structural representation of the system of Real-time Obtaining musical tempo information of the present invention.
Be with difference embodiment illustrated in fig. 5, in this embodiment, described system also further comprises: optimize module 801, for the beat cycle of the current music signal of determining is optimized.
Correspondingly, in this embodiment, beat starting point determination module 504, according to the beat cycle after the historical set of paths of described beat starting point and optimization, is determined the beat starting point of subsequent sound music signal.
A kind of specific implementation structure of above-mentioned optimization module 801 can comprise:
Integrate score computing unit, for calculating the integrate score in the historical path of every beat starting point, described integrate score comprises: mean value and the difference in described beat cycle of mistiming between the variance of the mistiming between each adjacent beat starting point and each beat in the historical path of described beat starting point and on the accumulation range value of beat point, described beat starting point history path;
Investigate unit, for according to the preferred follow-up investigation of the integrate score path in each historical path of preferred beat starting point;
Beat cycle determining unit, for determining according to the beat cycle of described current music signal and average tempo cycle corresponding to described investigation path the beat cycle that described investigation path is corresponding.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually referring to, each embodiment stresses is the difference with other embodiment.Especially, for system embodiment, because it is substantially similar in appearance to embodiment of the method, so describe fairly simplely, relevant part is referring to the part explanation of embodiment of the method.System embodiment described above is only schematic, the wherein said unit as separating component explanation can or can not be also physically to separate, the parts that show as unit can be or can not be also physical locations, can be positioned at a place, or also can be distributed in a plurality of network element.Can select according to the actual needs some or all of module wherein to realize the object of the present embodiment scheme.Those of ordinary skills, in the situation that not paying creative work, are appreciated that and implement.
Above the embodiment of the present invention is described in detail, has applied embodiment herein the present invention is set forth, the explanation of above embodiment is just for helping to understand method and apparatus of the present invention; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.