The present invention pertains generally to music tempo, and more particularly to a system for calculating music tempo in beats per minute. In a second embodiment the system also synchronizes the motion of a motor to the tempo of the music.
Live musical performances require drummers to set the song tempo by counting off the correct beats per minute (BPM). Metronomes are often used to initiate the correct tempo, but band and metronome quickly become out of sync as tempo begins to drift. It is not uncommon for songs to speed up or slow down during a performance—the most common problem is the song being played too fast. There are a number of products that detect BPM but require an operator tap on a key/button. This is inconvenient as it typically takes two hands to play a musical instrument. Some products sense BPM by detecting drum head strikes but these have had limited success.
Dancing (animated) toys have been around for many years. Many are driven by DC motors and have motion defined by the mechanics of their internal gear system. Synchronization of motion to sound must be provided by ‘canned’ music that is played from an internal speaker. Motion can be synchronized to sound, but it must be specified at design time since the animated toy is unable to adapt to audio input. Because of this limitation, animated toys are perceived as ‘cute’ at first, but customers quickly tire of the same repeated motion and songs.
Other current products claim to react to music beats by moving or flashing a light, but failure to do so is a common complaint from customers: blinking LEDs are hit and miss at best, and ‘dance’ is usually reduced to a repeated motion that has no correlation to tempo. Algorithms for beat detection developed over the years require complex mathematics and electronics. To date, most of this work has been performed by academics with few practical applications making it to the consumer market of animated toys.
U.S. Pat. No. 7,923,621 (Shiraishi)—“Tempo Analysis Device and Tempo Analysis Method” discloses a system for beat extraction which is built into a stereo appliance. Shiraishi describes a method that requires frequency analysis and data collection using at least one analog to digital (A/D) converter. A frame, representing a time slice of music, is analyzed in software and reduced to weighting factors of peak intervals. Analysis requires collection of a number of frames with calculations being performed by a relatively high performance microcontroller to keep pace with music in real time. While tempo is used to produce changes in video output, Shiraishi does not disclose a means of synchronizing music beat with video content or external motion.
U.S. Pat. No. 8,210,894 (Chan)—“Toy with Sound Activated Motion” is an example of a mechanized toy using sound as stimulus. However, Chan does not disclose how motion can be synchronized with music tempo.
Thus, there is a need for a low cost tempo-calculating system which provides feedback to musicians indicating music tempo, and which can also serve as a synchronization mechanism for synchronizing mechanical movements and with music tempo.
The present invention is directed to a system which uses off-the-shelf electronic components to calculate music tempo. Signal processing is performed in both hardware and software, in contrast to prior art devices which primarily place the processing burden on software. The system provides tempo feedback to musicians as BPM. In addition, tempo analysis leads to beat prediction. That is, knowing the time between beats and knowing when the last beat occurred, the occurrence of the next beat is predicted for controlling a motor which is used to animate toys. For example, dance is the synchronization of movement and beat. With any dance move, motion stops on the beat and resumes shortly thereafter. For example, when clapping one's hands, the hands are in motion until the moment of the next beat. It's the pause in motion that makes it appear movement is synchronized with music beat. Therefore, it is another aspect of the system to predict the occurrence of an upcoming beat and pause motion at that moment—resuming motion in the opposite direction shortly thereafter.
In an embodiment, the system uses a condenser microphone, signal amplifier, potentiometer, and a detector to process ambient music. A computer (microcontroller) is used to monitor output events from the detector. All of the components of the system are inexpensive and readily available. No conventional hardware A/D conversions or cross-correlation between peaks are required.
The system provides improvements to tempo detection which include:
In accordance with an embodiment, a system for calculating the tempo of music includes (1) a microphone which receives the music and converts the music into an electrical signal, (2) an amplitude adjuster which receives the electrical signal and outputs an amplitude adjusted electrical signal, (3) a detector which receives the amplitude-adjusted electrical signal and outputs a beat signal when the amplitude of the amplitude-adjusted electrical signal exceeds a threshold value, and (4) a computer which receives the beat signal and calculates the tempo of the music.
In accordance with another embodiment, the system includes a tempo display which receives and displays the calculated tempo from the computer.
In accordance with another embodiment, the amplitude-adjuster includes an amplifier which receives the electrical signal and outputs an amplified electrical signal, and an attenuator which receives and selectively attenuates the amplified electrical signal, and outputs the amplitude-adjusted electrical signal.
In accordance with another embodiment, the attenuator is a digitally controlled potentiometer.
In accordance with another embodiment, the detector is a dot/bar display driver.
In accordance with another embodiment, the computer includes a counter which starts counting each time a beat signal is received, and stops counting when a next beat signal is received, the counter having a counter value when the counter stops counting. The computer also includes a memory which receives and stores a plurality of counter values.
In accordance with another embodiment, the computer includes a tempo calculator which uses the plurality of counter values to calculate the tempo of the music.
In accordance with another embodiment, the tempo calculator disregards counter values which would result in a tempo of less than about 60 beats per minute or greater than about 180 beats per minute in the calculation of tempo.
In accordance with another embodiment, the tempo calculator analyzes the plurality of counter values and selects a most probable counter value which is used to calculate the tempo.
In accordance with another embodiment, the tempo is calculated according to the following equation:
tempo in beats per minute=(60/most probable counter value)×C, where C is the number of counts provided by the counter per second.
In accordance with another embodiment, the amplitude-adjuster includes an amplifier which receives the electrical signal and outputs an amplified electrical signal, and an attenuator which receives and selectively attenuates the amplified electrical signal and outputs the amplitude-adjusted electrical signal. The computer includes an amplitude control which sends an amplitude control signal to the attenuator.
In accordance with another embodiment, the amplitude control signal increases attenuation of the amplified electrical signal when a number of beat signals exceeds three in one second, and the amplitude control signal decreases attenuation of the amplified electrical signal when a number of beat signals is less than one in one second.
In accordance with another embodiment, the amplitude control signal changes attenuation of the amplified electrical signal in one of (1) single steps, and (2) multiple steps.
In accordance with another embodiment, the detector is a dot/bar display driver which provides a plurality of output signals ranging from a most sensitive output signal to a least sensitive output signal. If only the most sensitive output signal is present, the amplitude control signal changes attenuation of the amplified electrical signal in multiple steps.
In accordance with another embodiment, the system also includes (1) a motor which has clockwise direction of rotation and an opposite counterclockwise direction of rotation, (2) a motor driver which controls the motor, (3) a direction control signal which is sent from the computer to the motor driver, the direction control signal controlling the direction of rotation of the motor, the direction control signal having a clockwise state and a counterclockwise state, and (4) an enable signal which is sent from the computer to the motor driver, the enable signal turning the motor on or off.
In accordance with another embodiment, the computer includes a tempo calculator which outputs a beat interval, the computer also includes a motor timer which uses the beat interval to repeatedly count to an upcoming change in the direction of rotation of the motor.
In accordance with another embodiment, whenever a time between two successive beat signals is equal to the beat interval, the motor timer is reset.
In accordance with another embodiment, the system includes a beat event generator which generates a beat event signal whenever the interval between two successive beat signals equals the beat interval.
In accordance with another embodiment, the resetting of the motor timer ensures that the motor timer is synchronized with the music.
In accordance with another embodiment, the motor timer causes the enable signal to turn off before the beat interval ends, and to turn back on after the beat interval ends.
In accordance with another embodiment, the direction control signal changes state each time the enable signal is off.
Other embodiments, in addition to the embodiments enumerated above, will become apparent from the following detailed description, taken in conjunction with the accompanying drawings, which illustrate, by way of example, the principles of the system.
Referring initially to
Amplitude adjuster 26 also includes an attenuator 34 which receives and selectively attenuates amplified electrical signal 32, and outputs amplitude-adjusted electrical signal 28. Attenuator 34 provides amplitude (volume) control, and in one embodiment consists of a digital potentiometer such as a CA T5113. This is a digitally controlled potentiometer that has 100 possible values. If the maximum resistance is 10K ohms, CAT5113 can be set to provide values between 0 and 10K ohms in 100 ohm increments (steps). Thus, if amplitude-adjusted signal 28 is too high, attenuator 34 is adjusted to provide more resistance. Likewise, if amplitude-adjusted signal 28 is too low, attenuator 34 is adjusted to provide less resistance. This is similar to the volume control on any stereo appliance or TV. The adjustment of attenuator 34 is made automatically by an amplitude control signal 36 (see discussion below).
System 20 further includes a detector 40 which receives amplitude-adjusted electrical signal 28 and outputs a beat signal 42 (refer also to
Detector 40 creates a digital output of amplitude-adjusted electrical signal 28 which is used to drive a series of LED indicators 44. LED indicators 44 are not a critical part of system 20, but are provided mainly to provide visual feedback regarding the adjustment of attenuator 34. Optimum performance occurs when all LEDs are fluctuating. When ambient music is loud, amplitude-adjusted electrical signal 28 can saturate detector 40 causing all LED indicators 44 to be illuminated all the time. Therefore, it becomes necessary to downwardly adjust the amplitude of amplitude-adjusted electrical signal 28 (by increasing the attenuation of attenuator 34) so that it will not saturate detector 40 (i.e until fluctuations in all LED indicators 44 are detected). Likewise, the opposite is true if ambient music is too quiet, and an upward adjustment of the amplitude of amplitude-adjusted electrical signal 28 is required (by decreasing the attenuation of attenuator 34). Amplitude control signal 36 from computer 46 (see discussion below) automatically adjusts the resistance of attenuator 34 up or down.
System 20 assumes a music beat is associated with a momentary increase in the output of detector 40. The onset of music beat is detected the moment all LED indicators 44 turn. One can visually correlate fluctuations in LED indicator 44 with beat onset. In other words, if one taps their toe along with music beat, it will become obvious that maximum output from LED indicators 44 will occur at the moment of a toe tap.
It is appropriate at this point, to discuss the relationship of audio signals and beat.
In the example of
Tempo=60 sec/min÷interval between beats (sec/beat)=60/0.45=133 BPM Equation (1)
Similarly the calculation for the false positive is:
Tempo=60/0.22=272 BPM
Therefore, the 0.45 interval represents a more likely BPM result. This is within the range of 60 to 180. Therefore, pulses at D and I are determined to be false beats and it is deduced that 133 is the correct BPM value.
Referring again to
Computer 46 further includes an amplitude control 60 which sends amplitude control signal 36 to attenuator 34 (also refer to
System 20 is designed to sense tempo 50 in the range of 60 to 180 BPM. That translates to a minimum of one (60 BPM) to three (180 BPM) beat signals 42 per second. This means, if there is less than one beat signal 42 in a one second period, the sensitivity of system 20 needs to increase. Likewise, if there are more than three beat signals 42 in a one second period, the sensitivity needs to decrease. That is, amplitude control signal 36 increases attenuation of amplified electrical signal 28 when a number of beat signals 42 exceeds three in one second, and amplitude control signal 36 decreases attenuation of amplified electrical signal 28 when a number of beat signals 42 is less than one in one second (refer also to
Computer 46 further includes a tempo calculator 64 which uses plurality of counter values 56 to calculate the tempo 50 of the music. Tempo calculator 64 is a software module which scans memory 58 for the most common counter value 56 which equates to the most common interval between beats signals 42. Referring back to
counter value (counts)=60 counts/sec×interval between beats (sec) counter value=60 counts/sec×0.45 sec=27 counts Equation (2)
That is, 27 counts corresponds to an interval between beats of 0.45 sec. However the interval between beats I and J is 0.22 seconds. Therefore, the associated counter value 56 is:
counter value=60 counts/sec×0.22 sec=13
In the case of
From Equation (1)
Tempo (BPM)=60 sec/min÷interval between beats (sec)
From Equation (2)
counter value (counts)=60 counts/sec×interval between beats (sec), or rewriting interval between beats (sec)=counter value·(counts)÷60 counts/sec Equation (3)
Plugging Equation (3) into Equation (1)
Tempo=60 sec/min÷counter value (counts)÷60 counts/sec, or rearranging Tempo=[60 sec/min×60 counts/sec]÷counter value (counts), or simplifying, Tempo=3600 counts/min÷counter value (counts) Equation (4)
For the example of
Tempo=3600÷27=133 BPM
After tempo calculator 64 calculates tempo 50, the tempo value 50 is routed to I/O port 68 and thence to tempo display 48 (refer to
Counter values 56 can be filtered based on some simple rules of music as follows:
a) Music will not be played slower than 60 BPM; therefore, a counter value 56 greater than 60 (interval between beats greater than one second) is not valid and should not be used in BPM calculations.
b) Music will not be played faster than 180 BPM; therefore, a counter value 56 less than 0.33 seconds (interval between beats less than 0.33 seconds) is not valid and should not be used in BPM calculations.
Putting a) and b) another way, tempo calculator 64 disregards counter values 56 which would result in a tempo 50 of less than about 60 beats per minute (BPM) or greater than about 180 beats per minute (BPM) in the calculation of tempo 50.
c) Music will typically not make sudden changes in tempo 50. Therefore, large changes in BPM can be filtered out.
However, to account for a drifting tempo 50 during a live performance, memory 58 is a circular buffer in which the oldest data is over written with the newest. As tempo 50 drifts, so will the most common counter value 56.
Tempo=3600÷43=83 BPM
However, it is noted that their also exists a significant peak for a counter value 56 of 42. This indicates the actual tempo is slightly faster than 83 BPM. One can average the two peaks to create a more accurate most probable counter value 56 of 42.5. The tempo calculation then becomes:
Tempo=3600÷42.5=84 BPM
Putting this process another way, tempo calculator 64 analyzes a plurality of counter values 56 and selects a most probable counter value which is used to calculate tempo 50.
Typically, there exists a secondary peak 70 which occurs when looking at a music sample. This is because music can have notes/percussion that occur on ⅛ notes (as well as ¼ notes). In music theory, a ¼ note typically represents a note played for the duration of 1 beat and, thus, an ⅛ note would be played twice per beat. This means there is usually a secondary peak 70 at half the primary peak. In this example, the secondary peak 70 occurs at a counter value 56 of approximately 22. This secondary peak 70, along with the remaining counter values 56 which are scattered across the spectrum can be ignored in the determination of the most probable counter value 56.
It is noted that the foregoing discussion of tempo calculation is exemplary in nature. Adjustments can be made by one skilled in the art. For example, counter 54 can be set to count from 0 to 120 every second (instead of 0 to 60) in order to increase resolution.
As such, a more general version of the equation for calculating tempo 50 becomes:
Tempo=60×C (counts/min)÷counter value (counts) where C=the number of counter 54 counts per second. Equation (5)
That is, tempo 50 in beats per minute (BPM)=(60/most probable counter value)×C, where C is the number of counts provided by counter 54 per second.
Almost all animated toys are driven by DC motors that spin in one direction. Through a series of gears and actuators, rotational motion of the DC motor is translated into back and forth motion of various aspects of the toy. For example, a doll's head might move back and forth, the hips might move accordingly, a foot, etc. It then becomes possible to turn motor 72 in the clockwise (CW) direction, pause, turn motor 72 in the counterclockwise (CCW) direction, pause, turn motor 72 in the CW direction, etc. to create a “dancing” motion. If the pause is synchronized with a predicted next beat, the illusion is created the toy is “dancing” in time to music.
In the shown embodiment, all components of computer 46 are the same as those shown in
beat interval=42.5 counts/60 counts/sec=0.71 seconds
Motor timer 86 counts down from the calculated beat interval 88, automatically resets, counts down again, resets, etc. That is, motor timer 86 uses beat interval 88 to repeatedly count to an upcoming change in direction of rotation of motor 72. The cyclic action of motor timer 86 forms the heartbeat of embodiment 120, and as will be discussed below, controls the generation of direction control signal 76 and enable signal 78 by dance routine 82.
Motor timer 86 generates a motor time signal 94 (shown in
Enable signal 78 (shown in
Again referring to
Some of the salient features of system 20 are:
The embodiments of the system described herein are exemplary and numerous modifications, combinations, variations, and rearrangements can be readily envisioned to achieve an equivalent result, all of which are intended to be embraced within the scope of the appended claims. Further, nothing in the above-provided discussions of the system should be construed as limiting the invention to a particular embodiment or combination of embodiments. The scope of the invention is defined by the appended claims.
This is a continuation of co-pending U.S. patent application Ser. No. 13/945,977, filed Jul. 19, 2013, which claims the filing benefit under 35 U.S.C. §119(e) of U.S. Provisional Application No. 61/683,937, filed Aug. 16, 2012, which is hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
61683937 | Aug 2012 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13945977 | Jul 2013 | US |
Child | 14612132 | US |