A method and system for making the motor of an electric toothbrush play audio.
By preprocessing audio files into a digital signal sequence readable by the electric toothbrush's main control chip, and directly driving the sonic motor to play audio, the problems of complex and costly electric toothbrush hardware are solved, achieving hardware simplification and accurate audio playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUXI QINGHE XIAOBEI TECH CO LTD
- Filing Date
- 2026-04-24
- Publication Date
- 2026-07-31
AI Technical Summary
Existing electric toothbrush hardware is complex and expensive, mainly because it requires decoding functionality to play audio.
The audio file is preprocessed into a digital signal sequence that can be directly read by the main control chip of the electric toothbrush, stored in flash memory, and then the sound wave motor is directly driven by the motor driver chip to play the audio, omitting the decoding step.
The hardware structure of the electric toothbrush has been simplified, reducing costs and ensuring accurate audio playback.
Smart Images

Figure CN122496022A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of electric toothbrush technology and relates to a method and system for making the motor of an electric toothbrush play audio. Background Technology
[0002] The sonic motors used in most electric toothbrushes have similar linear mechanical characteristics to speakers. When an audio signal (such as voice or music) is used to directly drive the sonic motor, the sonic motor will emit a corresponding sound.
[0003] Currently, there are two common methods for making the sonic motor of an electric toothbrush play audio. One of them is as follows: Figure 1 As shown, audio files are stored on a storage device (usually Flash) inside the electric toothbrush. When playback is needed, the main control chip (with decoding function) or a dedicated decoder reads the audio file from the storage device, decodes it, and then sends the decoded digital signal to the motor driver chip to convert it into a power signal to drive the sound wave motor. Another method is... Figure 2 As shown, this method also stores audio files on an internal storage device (usually Flash) within the electric toothbrush. When playback is needed, the main control chip (with decoding capabilities) or a dedicated decoder reads the audio file from the storage device, decodes it, and sends the decoded digital signal to the DAC. The DAC converts the decoded digital signal into an analog signal, which is then amplified by a power amplifier to drive the sonic motor. Regardless of the method, audio decoding is a crucial step, requiring the electric toothbrush's main control chip to have decoding capabilities or a dedicated decoding circuit. This results in relatively complex hardware for electric toothbrushes, limiting miniaturization and increasing costs.
[0004] Against this backdrop, there is an urgent need for a method to play audio on electric toothbrushes without requiring decoding functionality, in order to simplify the hardware of electric toothbrushes. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention proposes a method and system for enabling the motor of an electric toothbrush to play audio. This method eliminates the need for the electric toothbrush to have an audio decoding function, thus simplifying the hardware of the electric toothbrush and ensuring that the sonic motor of the electric toothbrush can correctly play audio.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for making the motor of an electric toothbrush play audio, characterized by comprising the following steps: S1: Preprocess the audio file to convert it into a digital signal sequence that the main control chip of the electric toothbrush can directly read and use; S2: Store the preprocessed digital signal sequence into the flash memory of the electric toothbrush; S3: The main control chip of the electric toothbrush reads the digital signal sequence from the flash memory and sends it to the motor drive chip of the electric toothbrush; S4: The motor driver chip converts the digital signal sequence into a power signal sequence, and drives the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
[0007] Preferably, step S1 specifically includes: S11: Determine the audio sampling rate; S12: Resample the audio file based on the audio sampling rate to obtain a sequence of sampled values; S13: Convert the sampled value sequence into the duty cycle sequence of the square wave required to drive the sonic motor of the electric toothbrush; S14: Adjust the duty cycle sequence according to the clock frequency of the main control chip and the driving mode of the acoustic motor to obtain the digital signal sequence.
[0008] Preferably, in step S11, the audio sampling rate is 20kHz.
[0009] Preferably, in step S13, the duty cycle sequence is obtained by dividing the sampled value sequence by the maximum sampled value and taking the percentage.
[0010] Preferably, step S14 specifically involves: for each duty cycle in the duty cycle sequence, if the duty cycle is positive, take its opposite and add 100%; if the duty cycle is negative, add 100% and take its opposite again. Then, multiply each number by a multiple of the audio sampling rate relative to the main clock cycle of the main control chip and round down to obtain a value. Furthermore, when the value is negative, within the square wave period corresponding to the value, all the digital signals input to the first input of the motor driver chip are set to 1, and the length of the digital signals input to the second input of the motor driver chip being set to 1 is the absolute value of the negative number. When the value is positive, within the square wave period corresponding to the value, all the digital signals input to the second input of the motor driver chip are set to 1, and the length of the digital signals input to the first input of the motor driver chip being set to 1 is the positive number.
[0011] Preferably, step S14 specifically involves: for each duty cycle in the duty cycle sequence, if the duty cycle is positive, taking its opposite and adding 100%; if the duty cycle is negative, adding 100% and taking its opposite; then multiplying each number by a multiple of the audio sampling rate relative to the main clock cycle of the main control chip and rounding to obtain a value; and performing this process on the entire duty cycle sequence to obtain a value sequence. Furthermore, the value sequence is divided into two sequences, wherein for each value in the value sequence, if the value is positive... If the value is negative, the first sequence takes the value, and the second sequence takes the multiple of the period of the square wave of the audio sampling rate relative to the main clock period of the main control chip. If the value is negative, the first sequence takes the multiple of the period of the square wave of the audio sampling rate relative to the main clock period of the main control chip, and the second sequence takes the absolute value of the value. Based on the value in the first sequence, the length of the first input digital signal of the motor driver chip that is set to 1 is determined, and based on the value in the second sequence, the length of the second input digital signal of the motor driver chip that is set to 1 is determined.
[0012] Preferably, in step S12, when resampling the audio file based on the audio sampling rate, a sampling rate lower than the audio sampling rate is used for downsampling.
[0013] Furthermore, the present invention also provides a system for enabling the motor of an electric toothbrush to play audio, characterized in that it comprises: An audio file preprocessing module is used to preprocess audio files to convert them into digital signal sequences that the main control chip of the electric toothbrush can directly read and use. A digital signal sequence storage module is used to store the preprocessed digital signal sequence into the flash memory of the electric toothbrush; A digital signal sequence reading and sending module is used to enable the main control chip of the electric toothbrush to read the digital signal sequence from the flash memory and send it to the motor drive chip of the electric toothbrush; A digital signal sequence conversion and driving module is used to enable the motor driver chip to convert the digital signal sequence into a power signal sequence, and drive the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
[0014] Furthermore, the present invention also provides a device for playing audio from the motor of an electric toothbrush, characterized in that it comprises: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method described above for making the motor of the electric toothbrush play audio.
[0015] Finally, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when executed by a processor, the program implements the steps of the method described above for making the motor of an electric toothbrush play audio.
[0016] Compared with the prior art, the present invention has one or more of the following beneficial technical effects: (1) In this invention, before the audio file is stored in the Flash of the electric toothbrush, it is preprocessed into a digital signal that can be directly read and used by the main control chip of the electric toothbrush. In this way, when the electric toothbrush needs to play audio, it can read the digital signal from the Flash and send it directly to the motor drive chip without any processing. Therefore, the electric toothbrush does not need a decoding function, which simplifies the hardware of the electric toothbrush.
[0017] (2) The audio file preprocessing method of the present invention enables the preprocessed digital signal to accurately reflect the content of the audio file and to accurately convert it into the input of the motor drive chip, thereby enabling accurate playback of the audio. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating a method for playing audio using the motor of an existing electric toothbrush. Figure 2 This is a flowchart illustrating another existing method for playing audio using the motor of an electric toothbrush. Figure 3 This is a flowchart illustrating the method of making the motor of an electric toothbrush play audio according to the present invention. Figure 4 This is an exemplary audio waveform diagram of the present invention; Figure 5 This is a structural block diagram of the device of the present invention that allows the motor of an electric toothbrush to play audio. Detailed Implementation
[0019] Before detailing any embodiment of the invention, it should be understood that the invention, in its application, is not limited to the details of the construction and arrangement of the components set forth in the following description or illustrated in the following figures. The invention can have other embodiments and can be practiced or carried out in various ways. Furthermore, it should be understood that the wording and terminology used herein are for descriptive purposes and should not be considered limiting. The use of “comprising” or “having” and variations thereof in this invention is intended to cover the items set forth below and their equivalents, as well as any additional items. Unless otherwise specified or limited, the terms “installation,” “connection,” “support,” and “linkage,” and variations thereof are used broadly and cover both direct and indirect installation, connection, support, and linking. Moreover, “connection” and “linkage” are not limited to physical or mechanical connections or links.
[0020] Furthermore, firstly, in the disclosure of this invention, the terms "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the above terms should not be construed as limiting this invention. Secondly, the term "a" should be understood as "at least one" or "one or more," that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple. The term "a" should not be construed as a limitation on the quantity.
[0021] Figure 3 A flowchart illustrating the method of the present invention for making the motor of an electric toothbrush play audio is shown below. Figure 1 As shown, the method of making the motor of an electric toothbrush play audio according to the present invention includes the following steps: S1: Preprocess the audio file to convert it into a digital signal sequence that the main control chip of the electric toothbrush can directly read and use.
[0022] In this invention, the audio file can be preprocessed on a computer or similar device to convert it into a digital signal sequence that the main control chip of the electric toothbrush can directly read and use. This eliminates the need for decoding functionality in the electric toothbrush, simplifying its hardware.
[0023] In this invention, the preprocessing of audio files specifically includes: 1. Determine the audio sampling rate.
[0024] Electric toothbrushes typically use digital signals to drive sonic motors. Generating audio directly with digital signals requires a high-frequency square wave sequence, where the duty cycle of each square wave equals the relative sampling value of the audio signal at that position. The frequency of this high-frequency square wave sequence is essentially the audio sampling rate for the sonic motor.
[0025] Typically, a frequency of ≥20kHz is used for this. This is because when a high-frequency square wave drives a sonic motor, the motor also generates additional noise equal to the square wave's frequency. If the square wave frequency is below 20kHz, this additional noise will be audible to the human ear. Generally, a higher sampling rate (≥20kHz) results in higher audio quality (hence, most commercially available audio samples use sampling rates like 44100Hz or 48000Hz). However, sonic motors differ from speakers; they cannot produce truly high-fidelity sound. Furthermore, a higher sampling rate means more audio samples for the same duration, requiring more storage space. Therefore, for the audio needed in an electric toothbrush, a sampling rate of 20kHz is sufficient.
[0026] 2. The audio file is resampled based on the audio sampling rate to obtain a sequence of sampled values.
[0027] Once the audio sampling rate is determined to be 20kHz, the target audio file can be resampled (common audio sampling rates are usually 44100Hz or 48000Hz, so this step is generally downsampling). After resampling to 20kHz, each sample value of the audio file is output to obtain a sequence of sample values.
[0028] For example, for Figure 4 The exemplary audio clip shown, after being resampled at an audio sampling rate of 20kHz, yields the following sequence of sampled values (sampling precision is 16 bits, i.e., -32768~32767): -15039,-10398,-9175,-7954,-3261,2223,6079,7030,4559,3102,5685,10046,13577,13727,10687,9743,13206,18021,21616,21919,18206,13441,11032,10593,9981,9271,8529,8035,8943,9555,7840,4497,628,-2695,-4055,-3632,-3502,-4013,-4796,-7072,-9369,-9350,-9158,-9590,-8761,-8735,-9883,-9487,-9077,-9656,-8921,-7124,-5421,-3007,-862,-849,-1191,-719,-123,1611,3817,4865,5356,5178,4526,5187,6388,6910,7618,7990,7472,7124,6899,6321,5952,6147,6189,6053,5686,4390,3088,2464,1916,1679,1604,1018,27,-1000,-1816,-2191,-2196,-2204,-2077,-1526,-1152,-1038,-149,27,-1530,-2998,-5373,-8900,-12627,-18856,-24915,-24702,-19745,-12881,-5561,-4101,-9828,-15624,-17998,-17343,-14309,-12240,-12384,-10388,-4956,821,5851,8342,7499,7475,10056,12878,14003,11768,7834,7430,11439,16727,21128,22494,20070,16490,14232,12350,9746,7183,4862,4045,5549,6890,6614,5054,2434,-84,-1351,-2138,-3814,-5949,-7713,-10007,-11941,-11105,-9933,-10001,-8474,-6873,-7154,-6918,-6593,-7625,-7733,-6161,-4620,-2356,325,1110,1377,2571,3521,4618,5854,5855,5141,4214,3368,3941,4966,5227,6057,7151,7147,6775,6577,5773,4957,4976,4824,4547,4449,3553,2408,1838,1532,1435,1295,702,-357,-1562,-2471,-2842,-2854,-2799,-2471,-1871,-1302,-452,462,179,-1129,-3179,-6418,-10238,-16106,-23364,-26215,-23549,-17874,-10339,-5597,-7401,-11553,-13650,-13727,-12025,-10687,-12172,-13089,-9903,-4497,1341,6450,8716,9920,12936,16399,17945,15719,10313,6451,7004,10486,14912,18371,18843,17581,17089,16363,14144,11033,6889,2915,1470,1331,818,599,202,-442,10,674,384,-1060,-4907,-9887,-12809,-13988,-13766,-11101,-8234,-6854,-5168,-3472,-3225,-3538,-4263,-5617,-5790,-4357,-3156,-2220,-873,465,2539,5680,8406,9562,8667,6334,4276,3130,2821,3551,4683,5422,6382,7693,8249,8117,7700,6548,5240,4331,2891,1064,-199,-980,-917,212,1490,2100,1813,855,-427,-1572,-2412,-3101,-3592,-3795,-3232,-2005,-722,286,-250,-2724,-6503,-13066,-21371,-25915,-25402,-21886,-16116,-11790,-11664,-12484,-11582,-9483,-6987,-6251,-8778,-11092,-10056,-7053,-3314,452,3349,7010,12706,18612,22113,21076,16236,11909,10275,10362,11517,12497,12165,11960,13346,15035,15554,14563,11745,8214,5584,3046,-228,-3157,-5512,-7020,-6317,-4072,-1943,-456,-1162,-4230,-6984,-9190,-11381,-12162,-12527,-13360,-12296,-9386,-6512,-3300,-530,583,1718,3130,3164,2284,1110,-377,-498,1273,3469,5679,7202,7306,7352,7837,7915,7677,6769,4768,3072,2581,2614,3228,4267,4862,5553,6594,6812,6017,4540,2357,322,-854,-1617,-2174,-2441,-2614,-2428,-1620,-642,137,564,486,-40,-722,-1344,-2467,-4816,-7873,-12097,-18638,-24096,-25066,-22989,-18650,-13548,-11664,-12575,-12644,-11276,-9034,-6763,-7092,-9509,-9958,-7641,-4397,-803,2383,5106,9278,14905,20011,22384,20297,16175,13574,12504,12350,12594,11839,10405,10268,11517,12786,13555,12836,10518,8318,6203,3228,45,-3254,-6509,-8250,-8215,-6737,-5064,-5071,-5549,-5620,-6366,-6847,-6476,-7203,-9031,-9805,-9604,-9138,-7775,-6037,-4345,-1789,1028,2939,4156,4439,3681,3079,3215,3859,4273,3906,3580,3755,4169,5409,7463,8605,8361,7989,7345,6142,5221,4316,3265,2871,2938,2932,2893,2600,1955,1503,1452,1474,1113,267,-752,-1744,-2526,-2779,-2546,-2219,-1715,-882,-283,-176,-950,-3021,-6333,-11956,-19133,-24119,-25609,-24311,-20698,-17532,-16858,-16223,-13627,-9678,-5385,-2955,-3759,-5412,-5585,-4784,-3365,-1611,-247,2203,7281,13767,19289,21630,20743,19146,18271,17635,16774,14957,11650,8488,7146,7163,7843,8612,8524,8192,8363,7863,6160,3498,-241,-4035,-6886,-8420,-8817,-9448,-10560,-11149,-11380,-10814,-8481,-6021,-4940,-4553,-4608,-4875,-4555,-4087,-4052,-3675,-2669,-1337,588,2535,3658,4465,5510,6811,7964,8123,7084,5282,3215,1933,2158,2935,3326,3723,4312,5076,6329,7469,7684,7349,6707,5656,4488,3059,1178,-589,-1732,-2017,-1520,-690,23,365,345,339,563,696,517,4,-895,-1913,-3320,-5487,-8328,-12910,-19026,-23240,-24050,-22745,-19849,-17362,-17131,-16871,-14691,-11173,-7014,-4202,-4322,-5354,-4941,-3480,-1838,-374,765,2627,6418,11693,16640,19194,19051,18387,18423,18452,18006,16409,13187,9775,7678,6893,6935,7143,6678,5995,6090,6187,5452,4120,1760,-1562,-4250,-6037,-7921,-9610,-10655,-11433,-11762,-10935,-9158,-7255,-5594,-4461,-4049,-3928,-3661,-3170,-2674,-2561,-2623,-2196,-1136,114,1260,2523,4146,5871,7163,7961,8237,7596,6346,5536,5240,4855,4442,4035,3612,3606,4128,4953,5835,6398,6454,6197,5630 ,4543,3030,1413,-13,-973,-1532,-1786,-1809,-1796,-1585,-957,-228,638,1436,1537,1107,-228,-2838,-6261,-11520,-18437,-23659,-25892,-25928,-23732,-21190,-20248,-18938,-15712,-11397,-6554,-2939,-2342,-2780,-2174,-1 419, -814, -355, -553, 182, 3329, 8090, 13074, 16500, 17691, 18446, 19797, 20757, 20867, 19611, 16367, 12503, 9559, 7339, 5728, 4609, 3235, 2340, 2889, 3820, 4325, 4510, 3651, 1545, -489, -2024, -4312, -7189, -9548, -11937, -14211, -14873, -14005, -12422,-10128,-7547,-5096,-2533,-143,1536,2493,2652,2063,1330,886,485,9,-173,525,2024,3587,5149,6616,7156,7030,7212,7508,7284,6532,5379,3990,2984,2701,2835,3221,3798,4349,4928,5490,5532,4872,3859,2825,1832,755.
[0029] 3. Convert the sampled value sequence into the duty cycle sequence of the square wave required to drive the sonic motor of the electric toothbrush.
[0030] In this invention, the duty cycle can be obtained by directly dividing the sampled value by the maximum sampled value (32768 in this case) and taking the percentage.
[0031] For the sampled value sequence shown above, the percentage conversion is as follows: -45.90%,-31.73%,-28.00%,-24.27%,-9.95%,6.78%,18.55%,21.45%,13.91%,9.47%,17.35%,30.66%,41.43%,41.89%,32.61%,29.73%,40.30%,55.00%,65.97%,66.89%,55.56%,41.02%,33.67%,32.33%,30.46%,28.29%,26.03%,24.52%,27.29%,29.16%,23.93%,13.72%,1.92%,-8.22%,-12.37%,-11.08%,-10.69%,-12.25%,-14.64%,-21.58%,-28.59%,-28.53%,-27.95%,-29.27%,-26.74%,-26.66%,-30.16%,-28.95%,-27.70%,-29.47%,-27.22%,-21.74%,-16.54%,-9.18%,-2.63%,-2.59%,-3.63%,-2.19%,-0.38%,4.92%,11.65%,14.85%,16.35%,15.80%,13.81%,15.83%,19.49%,21.09%,23.25%,24.38%,22.80%,21.74%,21.05%,19.29%,18.16%,18.76%,18.89%,18.47%,17.35%,13.40%,9.42%,7.52%,5.85%,5.12%,4.90%,3.11%,0.08%,-3.05%,-5.54%,-6.69%,-6.70%,-6.73%,-6.34%,-4.66%,-3.52%,-3.17%,-0.45%,0.08%,-4.67%,-9.15%,-16.40%,-27.16%,-38.53%,-57.54%,-76.03%,-75.38%,-60.26%,-39.31%,-16.97%,-12.52%,-29.99%,-47.68%,-54.93%,-52.93%,-43.67%,-37.35%,-37.79%,-31.70%,-15.12%,2.51%,17.86%,25.46%,22.89%,22.81%,30.69%,39.30%,42.73%,35.91%,23.91%,22.67%,34.91%,51.05%,64.48%,68.65%,61.25%,50.32%,43.43%,37.69%,29.74%,21.92%,14.84%,12.34%,16.93%,21.03%,20.18%,15.42%,7.43%,-0.26%,-4.12%,-6.52%,-11.64%,-18.15%,-23.54%,-30.54%,-36.44%,-33.89%,-30.31%,-30.52%,-25.86%,-20.97%,-21.83%,-21.11%,-20.12%,-23.27%,-23.60%,-18.80%,-14.10%,-7.19%,0.99%,3.39%,4.20%,7.85%,10.75%,14.09%,17.86%,17.87%,15.69%,12.86%,10.28%,12.03%,15.16%,15.95%,18.48%,21.82%,21.81%,20.68%,20.07%,17.62%,15.13%,15.19%,14.72%,13.88%,13.58%,10.84%,7.35%,5.61%,4.68%,4.38%,3.95%,2.14%,-1.09%,-4.77%,-7.54%,-8.67%,-8.71%,-8.54%,-7.54%,-5.71%,-3.97%,-1.38%,1.41%,0.55%,-3.45%,-9.70%,-19.59%,-31.24%,-49.15%,-71.30%,-80.00%,-71.87%,-54.55%,-31.55%,-17.08%,-22.59%,-35.26%,-41.66%,-41.89%,-36.70%,-32.61%,-37.15%,-39.94%,-30.22%,-13.72%,4.09%,19.68%,26.60%,30.27%,39.48%,50.05%,54.76%,47.97%,31.47%,19.69%,21.37%,32.00%,45.51%,56.06%,57.50%,53.65%,52.15%,49.94%,43.16%,33.67%,21.02%,8.90%,4.49%,4.06%,2.50%,1.83%,0.62%,-1.35%,0.03%,2.06%,1.17%,-3.23%,-14.97%,-30.17%,-39.09%,-42.69%,-42.01%,-33.88%,-25.13%,-20.92%,-15.77%,-10.60%,-9.84%,-10.80%,-13.01%,-17.14%,-17.67%,-13.30%,-9.63%,-6.77%,-2.66%,1.42%,7.75%,17.33%,25.65%,29.18%,26.45%,19.33%,13.05%,9.55%,8.61%,10.84%,14.29%,16.55%,19.48%,23.48%,25.17%,24.77%,23.50%,19.98%,15.99%,13.22%,8.82%,3.25%,-0.61%,-2.99%,-2.80%,0.65%,4.55%,6.41%,5.53%,2.61%,-1.30%,-4.80%,-7.36%,-9.46%,-10.96%,-11.58%,-9.86%,-6.12%,-2.20%,0.87%,-0.76%,-8.31%,-19.85%,-39.87%,-65.22%,-79.09%,-77.52%,-66.79%,-49.18%,-35.98%,-35.60%,-38.10%,-35.35%,-28.94%,-21.32%,-19.08%,-26.79%,-33.85%,-30.69%,-21.52%,-10.11%,1.38%,10.22%,21.39%,38.78%,56.80%,67.48%,64.32%,49.55%,36.34%,31.36%,31.62%,35.15%,38.14%,37.12%,36.50%,40.73%,45.88%,47.47%,44.44%,35.84%,25.07%,17.04%,9.30%,-0.70%,-9.63%,-16.82%,-21.42%,-19.28%,-12.43%,-5.93%,-1.39%,-3.55%,-12.91%,-21.31%,-28.05%,-34.73%,-37.12%,-38.23%,-40.77%,-37.52%,-28.64%,-19.87%,-10.07%,-1.62%,1.78%,5.24%,9.55%,9.66%,6.97%,3.39%,-1.15%,-1.52%,3.88%,10.59%,17.33%,21.98%,22.30%,22.44%,23.92%,24.15%,23.43%,20.66%,14.55%,9.38%,7.88%,7.98%,9.85%,13.02%,14.84%,16.95%,20.12%,20.79%,18.36%,13.85%,7.19%,0.98%,-2.61%,-4.93%,-6.63%,-7.45%,-7.98%,-7.41%,-4.94%,-1.96%,0.42%,1.72%,1.48%,-0.12%,-2.20%,-4.10%,-7.53%,-14.70%,-24.03%,-36.92%,-56.88%,-73.54%,-76.50%,-70.16%,-56.92%,-41.35%,-35.60%,-38.38%,-38.59%,-34.41%,-27.57%,-20.64%,-21.64%,-29.02%,-30.39%,-23.32%,-13.42%,-2.45%,7.27%,15.58%,28.31%,45.49%,61.07%,68.31%,61.94%,49.36%,41.42%,38.16%,37.69%,38.43%,36.13%,31.75%,31.34%,35.15%,39.02%,41.37%,39.17%,32.10%,25.38%,18.93%,9.85%,0.14%,-9.93%,-19.86%,-25.18%,-25.07%,-20.56%,-15.45%,-15.48%,-16.93%,-17.15%,-19.43%,-20.90%,-19.76%,-21.98%,-27.56%,-29.92%,-29.31%,-27.89%,-23.73%,-18.42%,-13.26%,-5.46%,3.14%,8.97%,12.68%,13.55%,11.23%,9.40%,9.81%,11.78%,13.04%,11.92%,10.93%,11.46%,12.72%,16.51%,22.78%,26.26%,25.52%,24.38%,22.42%,18.74%,15.93%,13.17%,9.96%,8.76%,8.97%,8.95%,8.83%,7.93%,5.97%,4.59%,4.43%,4.50%,3.40%,0.81%,-2.29%,-5.32%,-7.71%,-8.48%,-7.77%,-6.77%,-5.23%,-2.69%,-0.86%,-0.54%,-2.90%,-9.22%,-19.33%,-36.49%,-58.39%,-73.61%,-78.15%,-74.19%,-63.17%,-53.50%,-51.45%,-49.51%,-41.59%,-29.53%,-16.43%,-9.02%,-11.47%,-16.52%,-17.04%,-14.60%,-10.27%,-4.92%,-0.75%,6.72%,22.22%,42.01%,58.87%,66.01%,63.30%,58.43%,55.76%,53.82%,51.19%,45.65%,35.55%,25.90%,21.81%,21.86%,23.93%,26.28%,26.01%,25.00%,25.52%,24.00%,18.80%,10.68%,-0.74%,-12.31%,-21.01%,-25.70%,-26.91%,-28.83%,-32.23%,-34.02%,-34.73%,-33.00%,-25.88%,-18.37%,-15.08%,-13.89%,-14.06%,-14.88%,-13.90%,-12.47%,-12.37%,-11.22%,-8.15%,-4.08%,1.79%,7.74%,11.16%,13.63%,16.82%,20.79%,24.30%,24.79%,21.62%,16.12%,9.81%,5.90%,6.59%,8.96%,10.15%,11.36%,13.16%,15.49%,19.31%,22.79%,23.45%,22.43%,20.47%,17.26%,13.70%,9.34%,3.59%,-1.80%,-5.29%,-6.16%,-4.64%,-2.11%,0.07%,1.11%,1.05%,1.03%,1.72%,2.12%,1.58%,0.01%,-2.73%,-5.84%,-10.13%,-16.74%,-25.42%,-39.40%,-58.06%,-70.92%,-73.39%,-69.41%,-60.57%,-52.98%,-52.28%,-51.49%,-44.83%,-34.10%,-21.41%,-12.82%,-13.19%,-16.34%,-15.08%,-10.62%,-5.61%,-1.14%,2.33%,8.02%,19.59%,35.68%,50.78%,58.58%,58.14%,56.11%,56.22%,56.31%,54.95%,50.08%,40.24%,29.83%,23.43%,21.04%,21.16%,21.80%,20.38%,18.30%,18.59%,18.88%,16.64%,12.57%,5.37%,-4.77%,-12.97%,-18.42%,-24.17%,-29.33%,-32.52%,-34.89%,-35.89%,-33.37%,-27.95%,-22.14%,-17.07%,-13.61%,-12.36%,-11.99%,-11.17%,-9.67%,-8.16%,-7.82%,-8.00%,-6.70%,-3.47%,0.35%,3.85%,7.70%,12.65%,17.92%,21.86%,24.30%,25.14%,23.18%,19.37%,16.89%,15.99%,14.82%,13.56%,12.31%,11.02%,11.00%,12.60%,15.12%,17.81%,19.53%,19.70%,18.91%,17.18%,13.86%,9.25%,4.31%,-0.04%,-2.97%,-4.68%,-5.45%,-5.52%,-5.48%,-4.84%,-2.92%,-0.70%,1.95%,4.38%,4.69%,3.38%,-0.70%,-8.66%,-19.11%,-35.16%,-56.27%,-72.20%,-79.02%,-79.13%,-72.42%,-64.67%,-61.79%,-57.79%,-47.95%,-34.78%,-20.00%,-8.97%,-7.15%,-8.48%,-6.63%,-4.33%,-2.48%,-1.08%,-1.69%,0.56%,10.16%,24.69%,39.90%,50.35%,53.99%,56.29%,60.42%,63.35%,63.68%,59.85%,49.95%,38.16%,29.17%,22.40%,17.48%,14.07%,9.87%,7.14%,8.82%,11.66%,13.20%,13.76%,11.14%,4.71%,-1.49%,-6.18%,-13.16%,-21.94%,-29.14%,-36.43%,-43.37%,-45.39%,-42.74%,-37.91%,-30.91%,-23.03%,-15.55%,-7.73%,-0.44%,4.69%,7.61%,8.09%,6.30%,4.06%,2.70%,1.48%, 0.03%, -0.53%, 1.60%, 6.18%, 10.95%, 15.71%, 20.19%, 21.84%, 21.45%, 22.01%, 22.91%, 22.23%, 19.93%, 16.42%, 12.18%, 9.11%, 8.24%, 8.65%, 9.83%, 11.59%, 13.27%, 15.04%, 16.75%, 16.88%, 14.87%, 11.78%, 8.62%, 5.59%, 2.30%.
[0032] Driving a acoustic motor with a 20kHz square wave, where the duty cycle of each square wave satisfies the duty cycle sequence above, will produce an effect similar to the one described above. Figure 4 The audio clip shown.
[0033] 4. Adjust the duty cycle sequence according to the clock frequency of the main control chip and the driving mode of the acoustic motor to obtain the digital signal sequence.
[0034] Common motor driver chips have two inputs (denoted as A and B). The driving logic is usually as follows: A=B=0: cutoff; A=B=1: deceleration (equivalent to directly connecting the two ends of the acoustic motor to form a loop, without external power supply to the acoustic motor, the acoustic motor continues to decelerate); A=0&B=1: the acoustic motor moves towards side A; A=1&B=0: the acoustic motor moves towards side B.
[0035] Meanwhile, when the acoustic motor vibrates left and right, the input from the main control chip to the motor driver chip will only switch between three states: A=B=1, A=0&B=1, and A=1&B=0. (Usually, the acoustic motor will not switch to A=B=0 when it is working, because when there is current in the acoustic motor, it will directly switch to the cut-off state. The inductive characteristics of the acoustic motor will generate a high reverse electromotive force at the motor driver chip, which can easily damage the motor driver chip.)
[0036] Furthermore, for a master control chip with a given clock frequency, the duration of the 1 or 0 it can output must be an integer multiple of the clock cycle. Let's take a clock frequency of f=64MHz as an example. For f=64MHz, the clock cycle is T=15.625ns. The period of a 20kHz square wave is equivalent to 3200 times the clock cycle T. That is, for this master control chip, the duty cycle of generating a 20kHz square wave can only be a multiple of 1 / 3200 = 0.03125%.
[0037] Therefore, it is only necessary to convert the duty cycle sequence above into the A and B sequences that the main control chip can actually output. The positive and negative relationships of the duty cycle are defined as follows: positive indicates movement towards A, and negative indicates movement towards B. For example, -45.90% represents the time within one square wave cycle when the acoustic motor moves towards B for 45.90% of the time, and then decelerates for 54.10% of the time. 2.30% represents the time within one square wave cycle when the acoustic motor moves towards A for 2.30% of the time, and then decelerates for 97.70% of the time. Considering that when moving towards A, A=0 & B=1, when moving towards B, A=1 & B=0, and when decelerating, A=B=1, the duty cycle sequence listed above actually represents the percentage of 0 when the main control chip outputs A and B.
[0038] In the duty cycle sequence above, take the opposite of the positive numbers and add 100%, add 100% to the negative numbers and take the opposite, and finally multiply each number by 3200 (the period of a 20kHz square wave is equivalent to a multiple of the main clock period T) and take the integer part. This gives you the number of main clock cycles that A / B needs to output 1 in each square wave cycle.
[0039] For example, the first duty cycle in the above duty cycle sequence, -45.90%, is negative, so we get -(-45.90% + 100%) * 3200 = -1731. The sixth duty cycle in the same sequence, 6.78%, is positive, so we get (-6.78% + 100%) * 3200 = 2983. Applying this processing to the duty cycle series in the above example yields the following numerical sequence: -1731,-2185,-2304,-2423,-2882,2983,2606,2513,2755,2897,2645,2219,1874,1859,2156,2249,1910,1440,1089,1059,1422,1887,2123,2166,2225,2295,2367,2415,2327,2267,2434,2761,3139,-2937,-2804,-2845,-2858,-2808,-2732,-2509,-2285,-2287,-2306,-2263,-2344,-2347,-2235,-2274,-2314,-2257,-2329,-2504,-2671,-2906,-3116,-3117,-3084,-3130,-3188,3043,2827,2725,2677,2694,2758,2693,2576,2525,2456,2420,2470,2504,2526,2583,2619,2600,2596,2609,2645,2771,2898,2959,3013,3036,3043,3101,3197,-3102,-3023,-2986,-2986,-2985,-2997,-3051,-3088,-3099,-3185,3197,-3051,-2907,-2675,-2331,-1967,-1359,-767,-788,-1272,-1942,-2657,-2800,-2240,-1674,-1442,-1506,-1803,-2005,-1991,-2186,-2716,3120,2629,2385,2468,2470,2218,1942,1833,2051,2435,2474,2083,1567,1137,1003,1240,1590,1810,1994,2248,2499,2725,2805,2658,2527,2554,2706,2962,-3192,-3068,-2991,-2828,-2619,-2447,-2223,-2034,-2116,-2230,-2223,-2372,-2529,-2501,-2524,-2556,-2455,-2445,-2598,-2749,-2970,3168,3092,3066,2949,2856,2749,2628,2628,2698,2788,2871,2815,2715,2690,2608,2502,2502,2538,2558,2636,2716,2714,2729,2756,2766,2853,2965,3021,3050,3060,3074,3131,-3165,-3047,-2959,-2922,-2921,-2927,-2959,-3017,-3073,-3156,3155,3183,-3090,-2890,-2573,-2200,-1627,-918,-640,-900,-1454,-2190,-2653,-2477,-2072,-1867,-1859,-2026,-2156,-2011,-1922,-2233,-2761,3069,2570,2349,2231,1937,1599,1448,1665,2193,2570,2516,2176,1744,1406,1360,1483,1531,1602,1819,2123,2527,2915,3056,3070,3120,3142,3180,-3157,3199,3134,3163,-3096,-2721,-2234,-1949,-1834,-1856,-2116,-2396,-2531,-2695,-2861,-2885,-2854,-2784,-2651,-2635,-2775,-2892,-2983,-3115,3155,2952,2645,2379,2266,2354,2581,2782,2894,2925,2853,2743,2671,2577,2449,2394,2407,2448,2561,2688,2777,2918,3096,-3181,-3104,-3110,3179,3054,2995,3023,3117,-3158,-3046,-2964,-2897,-2849,-2829,-2884,-3004,-3129,3172,-3176,-2934,-2565,-1924,-1113,-669,-719,-1063,-1626,-2049,-2061,-1981,-2069,-2274,-2518,-2590,-2343,-2117,-2218,-2511,-2876,3156,2873,2515,1959,1382,1041,1142,1614,2037,2197,2188,2075,1980,2012,2032,1897,1732,1681,1778,2053,2398,2655,2903,-3178,-2892,-2662,-2514,-2583,-2802,-3010,-3155,-3087,-2787,-2518,-2303,-2089,-2012,-1977,-1895,-1999,-2283,-2564,-2878,-3148,3143,3032,2894,2891,2977,3092,-3163,-3151,3076,2861,2645,2497,2487,2482,2435,2427,2450,2539,2734,2900,2948,2945,2885,2783,2725,2658,2556,2535,2612,2757,2970,3169,-3117,-3042,-2988,-2962,-2945,-2963,-3042,-3137,3187,3145,3153,-3196,-3129,-3069,-2959,-2730,-2431,-2019,-1380,-847,-752,-955,-1379,-1877,-2061,-1972,-1965,-2099,-2318,-2540,-2507,-2271,-2228,-2454,-2771,-3122,2967,2701,2294,1744,1246,1014,1218,1620,1874,1979,1994,1970,2044,2184,2197,2075,1951,1876,1946,2173,2388,2594,2885,3196,-2882,-2564,-2394,-2398,-2542,-2705,-2705,-2658,-2651,-2578,-2531,-2568,-2497,-2318,-2242,-2262,-2308,-2441,-2610,-2776,-3025,3100,2913,2794,2767,2841,2899,2886,2823,2783,2819,2850,2833,2793,2672,2471,2360,2383,2420,2483,2600,2690,2779,2881,2920,2913,2914,2917,2946,3009,3053,3058,3056,3091,3174,-3127,-3030,-2953,-2929,-2951,-2983,-3033,-3114,-3172,-3183,-3107,-2905,-2582,-2032,-1332,-845,-699,-826,-1179,-1488,-1554,-1616,-1869,-2255,-2674,-2911,-2833,-2671,-2655,-2733,-2871,-3043,-3176,2985,2489,1856,1316,1088,1174,1330,1416,1478,1562,1739,2062,2371,2502,2500,2434,2359,2368,2400,2383,2432,2598,2858,-3176,-2806,-2528,-2378,-2339,-2277,-2169,-2111,-2089,-2144,-2372,-2612,-2718,-2755,-2750,-2724,-2755,-2801,-2804,-2841,-2939,-3069,3143,2952,2843,2764,2662,2535,2422,2407,2508,2684,2886,3011,2989,2913,2875,2836,2779,2704,2582,2471,2450,2482,2545,2648,2762,2901,3085,-3142,-3031,-3003,-3052,-3133,3198,3164,3166,3167,3145,3132,3150,3200,-3113,-3013,-2876,-2664,-2387,-1939,-1342,-930,-851,-979,-1262,-1504,-1527,-1552,-1765,-2109,-2515,-2790,-2778,-2677,-2717,-2860,-3021,-3163,3125,2943,2573,2058,1575,1326,1340,1404,1401,1398,1442,1598,1912,2245,2450,2527,2523,2502,2548,2615,2605,2596,2668,2798,3028,-3047,-2785,-2610,-2426,-2262,-2159,-2083,-2051,-2132,-2306,-2492,-2654,-2764,-2805,-2816,-2842,-2890,-2939,-2950,-2944,-2986,-3089,3189,3077,2954,2795,2627,2500,2423,2396,2458,2580,2659,2688,2726,2766,2806,2847,2848,2797,2716,2630,2575,2570,2595,2650,2756,2904,3062,-3199,-3105,-3050,-3026,-3023,-3025,-3045,-3107,-3178,3138,3060,3050,309 2, -3178, -2923, -2589, -2075, -1400, -890, -671, -668, -882, -1131, -1223, -1351, -1666, -2087, -2560, -2913, -2971, -2929, -2988, -3061, -3121, -3165, -3146, 3182, 2875, 2410, 1923, 1589, 1472, 1399, 1267, 1 173,1162,1285,1602,1979,2267,2483,2641,2750,2884,2971,2918,2827,2778,2760,2843,3049,-3152,-3002,-2779,-2498,-2268,-2034,-1812,-1748,-1832,-1987,-2211,-2463,-2702,-2953,-3186,305 0,2957,2941,2999,3070,3113,3153,3199,-3183,3149,3002,2850,2697,2554,2501,2513,2496,2467,2489,2562,2675,2810,2909,2936,2923,2885,2829,2775,2719,2664,2660,2724,2823,2924,3021,3126, After obtaining the above values, when the values are negative, within the square wave period corresponding to the values, all digital signals of the first input (i.e., A) of the motor driver chip are set to 1, and the length of the digital signals of the second input (i.e., B) of the motor driver chip being set to 1 is the absolute value of the negative number; when the values are positive, within the square wave period corresponding to the values, all digital signals of the second input (i.e., B) of the motor driver chip are set to 1, and the length of the digital signals of the first input (i.e., A) of the motor driver chip being set to 1 is the positive number.
[0040] As shown in the sequence above, for example, the first value -1731 is a negative number. In one square wave cycle (3200 master clock cycles), the first input (that is, A) outputs 1 throughout, the second input (that is, B) needs to output 1 for 1731 master clock cycles, and then output 0 for 3200-1731=1469 master clock cycles. The sixth value 3126 is a positive number. In one square wave cycle, the first input (that is, A) needs to output 1 for 3126 master clock cycles, and then output 0 for 3200-3126=74 master clock cycles. The second input (that is, B) outputs 1 throughout.
[0041] Besides the method of representing a sequence with positive and negative signs as described above, if storage capacity allows, two sequences, A and B, can also be used to record the data separately. When recording separately, a positive number is equivalent to A taking that number and B taking 3200 (the period of a 20kHz square wave is equivalent to a multiple of the main clock period T); a negative number is equivalent to B taking the absolute value of that number and A taking 3200 (the period of a 20kHz square wave is equivalent to a multiple of the main clock period T).
[0042] In other words, the numerical sequence is divided into two sequences. For each value in the numerical sequence, if the value is positive, the first sequence (i.e., A) takes that value, and the second sequence (i.e., B) takes the period of the square wave of the audio sampling rate as a multiple of the main clock period of the main control chip (i.e., 3200). If the value is negative, the first sequence (i.e., A) takes the period of the square wave of the audio sampling rate as a multiple of the main clock period of the main control chip (i.e., 3200), and the second sequence (i.e., B) takes the absolute value of that value.
[0043] For example, if the first value in the numerical sequence is -1731, which is negative, then the first sequence (A) takes 3200, and the second sequence (B) takes 1713; if the sixth value in the numerical sequence is 2983, which is positive, then the first sequence (A) takes 2983, and the second sequence (B) takes 3200. This process is repeated for all the numerical sequences in the above example, resulting in the following first sequence (A) and second sequence (B): A=3200,3200,3200,3200,3200,2983,2606,2513,2755,2897,2645,2219,1874,1859,2156,2249,1910,1440,1089,1059,1422,1887,2123,2166,2225,2295,2367,2415,2327,2267,2434,2761,3139,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3043,2827,2725,2677,2694,2758,2693,2576,2525,2456,2420,2470,2504,2526,2583,2619,2600,2596,2609,2645,2771,2898,2959,3013,3036,3043,3101,3197,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3197,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3120,2629,2385,2468,2470,2218,1942,1833,2051,2435,2474,2083,1567,1137,1003,1240,1590,1810,1994,2248,2499,2725,2805,2658,2527,2554,2706,2962,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3168,3092,3066,2949,2856,2749,2628,2628,2698,2788,2871,2815,2715,2690,2608,2502,2502,2538,2558,2636,2716,2714,2729,2756,2766,2853,2965,3021,3050,3060,3074,3131,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3155,3183,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3069,2570,2349,2231,1937,1599,1448,1665,2193,2570,2516,2176,1744,1406,1360,1483,1531,1602,1819,2123,2527,2915,3056,3070,3120,3142,3180,3200,3199,3134,3163,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3155,2952,2645,2379,2266,2354,2581,2782,2894,2925,2853,2743,2671,2577,2449,2394,2407,2448,2561,2688,2777,2918,3096,3200,3200,3200,3179,3054,2995,3023,3117,3200,3200,3200,3200,3200,3200,3200,3200,3200,3172,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3156,2873,2515,1959,1382,1041,1142,1614,2037,2197,2188,2075,1980,2012,2032,1897,1732,1681,1778,2053,2398,2655,2903,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3143,3032,2894,2891,2977,3092,3200,3200,3076,2861,2645,2497,2487,2482,2435,2427,2450,2539,2734,2900,2948,2945,2885,2783,2725,2658,2556,2535,2612,2757,2970,3169,3200,3200,3200,3200,3200,3200,3200,3200,3187,3145,3153,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,2967,2701,2294,1744,1246,1014,1218,1620,1874,1979,1994,1970,2044,2184,2197,2075,1951,1876,1946,2173,2388,2594,2885,3196,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3100,2913,2794,2767,2841,2899,2886,2823,2783,2819,2850,2833,2793,2672,2471,2360,2383,2420,2483,2600,2690,2779,2881,2920,2913,2914,2917,2946,3009,3053,3058,3056,3091,3174,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,2985,2489,1856,1316,1088,1174,1330,1416,1478,1562,1739,2062,2371,2502,2500,2434,2359,2368,2400,2383,2432,2598,2858,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3143,2952,2843,2764,2662,2535,2422,2407,2508,2684,2886,3011,2989,2913,2875,2836,2779,2704,2582,2471,2450,2482,2545,2648,2762,2901,3085,3200,3200,3200,3200,3200,3198,3164,3166,3167,3145,3132,3150,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3125,2943,2573,2058,1575,1326,1340,1404,1401,1398,1442,1598,1912,2245,2450,2527,2523,2502,2548,2615,2605,2596,2668,2798,3028,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3189,3077,2954,2795,2627,2500,2423,2396,2458,2580,2659,2688,2726,2766,2806,2847,2848,2797,2716,2630,2575,2570,2595,2650,2756,2904,3062,3200,3200,3200,3200,3200,3200,3200,3200,3200,3138,3060,3050,3092,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3182,2875,2410,1923,1589,1472,1399,1267,1173,1162,1285,1602,1979,2267,2483,2641,2750,2884,2971,2918,2827,2778,2760,2843,3049,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3050,2957,2941,2999,3070,3113,3153,3199,3200,3149,3002,2850,2697,2554,2501,2513,2496,2467,2489,2562,2675,2810,2909,2936,2923,2885,2829,2775,2719,2664,2660,2724,2823,2924,3021,3126。,
[0044] B=1731,2185,2304,2423,2882,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,2937,2804,2845,2858,2808,2732,2509,2285,2287,2306,2263,2344,2347,2235,2274,2314,2257,2329,2504,2671,2906,3116,3117,3084,3130,3188,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3102,3023,2986,2986,2985,2997,3051,3088,3099,3185,3200,3051,2907,2675,2331,1967,1359,767,788,1272,1942,2657,2800,2240,1674,1442,1506,1803,2005,1991,2186,2716,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3192,3068,2991,2828,2619,2447,2223,2034,2116,2230,2223,2372,2529,2501,2524,2556,2455,2445,2598,2749,2970,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3165,3047,2959,2922,2921,2927,2959,3017,3073,3156,3200,3200,3090,2890,2573,2200,1627,918,640,900,1454,2190,2653,2477,2072,1867,1859,2026,2156,2011,1922,2233,2761,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3157,3200,3200,3200,3096,2721,2234,1949,1834,1856,2116,2396,2531,2695,2861,2885,2854,2784,2651,2635,2775,2892,2983,3115,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3181,3104,3110,3200,3200,3200,3200,3200,3158,3046,2964,2897,2849,2829,2884,3004,3129,3200,3176,2934,2565,1924,1113,669,719,1063,1626,2049,2061,1981,2069,2274,2518,2590,2343,2117,2218,2511,2876,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3178,2892,2662,2514,2583,2802,3010,3155,3087,2787,2518,2303,2089,2012,1977,1895,1999,2283,2564,2878,3148,3200,3200,3200,3200,3200,3200,3163,3151,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3117,3042,2988,2962,2945,2963,3042,3137,3200,3200,3200,3196,3129,3069,2959,2730,2431,2019,1380,847,752,955,1379,1877,2061,1972,1965,2099,2318,2540,2507,2271,2228,2454,2771,3122,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,2882,2564,2394,2398,2542,2705,2705,2658,2651,2578,2531,2568,2497,2318,2242,2262,2308,2441,2610,2776,3025,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3127,3030,2953,2929,2951,2983,3033,3114,3172,3183,3107,2905,2582,2032,1332,845,699,826,1179,1488,1554,1616,1869,2255,2674,2911,2833,2671,2655,2733,2871,3043,3176,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3176,2806,2528,2378,2339,2277,2169,2111,2089,2144,2372,2612,2718,2755,2750,2724,2755,2801,2804,2841,2939,3069,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3142,3031,3003,3052,3133,3200,3200,3200,3200,3200,3200,3200,3200,3113,3013,2876,2664,2387,1939,1342,930,851,979,1262,1504,1527,1552,1765,2109,2515,2790,2778,2677,2717,2860,3021,3163,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3047,2785,2610,2426,2262,2159,2083,2051,2132,2306,2492,2654,2764,2805,2816,2842,2890,2939,2950,2944,2986,3089,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3199,3105,3050,3026,3023,3025,3045,3107,3178,3200,3200,3200,3200,3178,2923,2589,2075,1400,890,671,668,882,1131,1223,1351,1666,2087,2560,2913,2971,2929,2988,3061,3121,3165,3146,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3152,3002,2779,2498,2268,2034,1812,1748,1832,1987,2211,2463,2702,2953,3186,3200,3200,3200,3200,3200, 3200,3200,3200,3183,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200,3200.
[0045] In this case, by directly reading the two sequences and outputting the length of 1 on A and B according to the numerical values of the sequences, the square wave sequence of the desired audio signal can be obtained.
[0046] Furthermore, in this invention, if the electric toothbrush has very limited storage space, the amount of audio data can be reduced by sacrificing sound quality through downsampling. It should be noted that even with downsampling, the square wave frequency driving the acoustic motor cannot be lower than 20kHz (otherwise, additional high-frequency noise will be introduced).
[0047] While keeping the square wave frequency f=20kHz constant, downsampling can be achieved by halving the number of sampling points, but running each value twice on a 20kHz square wave. That is, the original audio is downsampled to 10kHz, resulting in 10,000 sampling points per second. Then, when running on an electric toothbrush, the acoustic motor is still driven by a 20kHz square wave, but the value corresponding to each sampling point runs for two square wave cycles. This achieves both reducing the number of sampling points (saving storage space) and not introducing additional high-frequency noise.
[0048] Similarly, the original audio can be downsampled to 6666kHz, resulting in 6666 samples per second. Then, when running on an electric toothbrush, each sample can run for 3 square wave cycles, and so on. The more downsampling, the more storage space is saved, but the audio quality deteriorates.
[0049] S2: Store the preprocessed digital signal sequence into the flash memory of the electric toothbrush.
[0050] After preprocessing, if the electric toothbrush needs to play the audio file, the preprocessed digital signal sequence can be stored in the flash memory of the electric toothbrush.
[0051] S3: The main control chip of the electric toothbrush reads the digital signal sequence from the flash memory and sends it to the motor drive chip of the electric toothbrush.
[0052] When audio needs to be played, the main control chip of the electric toothbrush reads the digital signal sequence from the flash memory and sends it to the motor drive chip of the electric toothbrush.
[0053] S4: The motor driver chip converts the digital signal sequence into a power signal sequence, and drives the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
[0054] Similar to existing technologies, after receiving the digital signal sequence, the motor drive chip converts the digital signal sequence into a power signal sequence, and drives the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
[0055] Therefore, in this invention, the audio file is preprocessed into a digital signal that the toothbrush's main control chip can directly read and use before being stored in the electric toothbrush's Flash memory. This way, when the electric toothbrush needs to play audio, it can read the data from the Flash memory and send it directly to the electric drive chip without any further processing. Consequently, the electric toothbrush does not require a decoding function, simplifying its hardware.
[0056] Furthermore, the present invention also provides a system for enabling the motor of an electric toothbrush to play audio, comprising: 1. Audio file preprocessing module.
[0057] The audio file preprocessing module is used to preprocess the audio file to convert it into a digital signal sequence that the main control chip of the electric toothbrush can directly read and use.
[0058] 2. Digital signal sequence storage module.
[0059] The digital signal sequence storage module is used to store the preprocessed digital signal sequence into the flash memory of the electric toothbrush.
[0060] 3. Digital signal sequence reading and sending module.
[0061] The digital signal sequence reading and sending module is used to enable the main control chip of the electric toothbrush to read the digital signal sequence from the flash memory and send it to the motor drive chip of the electric toothbrush.
[0062] 4. Digital signal sequence conversion and driving module.
[0063] The digital signal sequence conversion and driving module is used to enable the motor drive chip to convert the digital signal sequence into a power signal sequence, and drive the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
[0064] Furthermore, the present invention also provides a device for allowing the motor of an electric toothbrush to play audio. For example... Figure 5 As shown, the device for making the motor of an electric toothbrush play audio according to the present invention includes: a memory 11 for storing one or more programs; one or more processors 12; when the one or more programs are executed by the one or more processors 12, the one or more processors 12 implement the method of making the motor of the electric toothbrush play audio according to the present invention.
[0065] Finally, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for making the motor of an electric toothbrush play audio according to the present invention.
[0066] The computer-readable storage medium includes both permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined in this invention, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0067] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0068] The steps of the methods or algorithms described in conjunction with the embodiments disclosed in this invention can be implemented in hardware, software modules executed by a processor, or a combination of both. The software modules can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Those skilled in the art can modify or make equivalent substitutions to the technical solutions of the present invention based on the concept of the present invention, without departing from the essence and scope of the technical solutions of the present invention.
Claims
1. A method for playing audio from a motor of an electric toothbrush, the method comprising: Includes the following steps: S1: Preprocess the audio file to convert it into a digital signal sequence that the main control chip of the electric toothbrush can directly read and use; S2: Store the preprocessed digital signal sequence into the flash memory of the electric toothbrush; S3: The main control chip of the electric toothbrush reads the digital signal sequence from the flash memory and sends it to the motor drive chip of the electric toothbrush; S4: The motor driver chip converts the digital signal sequence into a power signal sequence, and drives the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
2. The method for making the motor of an electric toothbrush play audio according to claim 1, characterized in that, Step S1 specifically includes: S11: Determine the audio sampling rate; S12: Resample the audio file based on the audio sampling rate to obtain a sequence of sampled values; S13: Convert the sampled value sequence into the duty cycle sequence of the square wave required to drive the sonic motor of the electric toothbrush; S14: Adjust the duty cycle sequence according to the clock frequency of the main control chip and the driving mode of the acoustic motor to obtain the digital signal sequence.
3. The method for making the motor of an electric toothbrush play audio according to claim 2, characterized in that, In step S11, the audio sampling rate is 20kHz.
4. The method for making the motor of an electric toothbrush play audio according to claim 2, characterized in that, In step S13, the duty cycle sequence is obtained by dividing the sampled value sequence by the maximum sampled value and taking the percentage.
5. The method for making the motor of an electric toothbrush play audio according to claim 2, characterized in that, Step S14 specifically involves: for each duty cycle in the duty cycle sequence, if the duty cycle is positive, take its opposite and add 100%; if the duty cycle is negative, add 100% and take its opposite again. Then, multiply each number by a multiple of the audio sampling rate relative to the main clock cycle of the main control chip and round it to obtain a value. When the value is negative, within the square wave period corresponding to the value, all the digital signals input to the first channel of the motor driver chip are set to 1, and the length of the digital signals input to the second channel of the motor driver chip being set to 1 is the absolute value of the negative number. When the value is positive, within the square wave period corresponding to the value, all the digital signals input to the second channel of the motor driver chip are set to 1, and the length of the digital signals input to the first channel of the motor driver chip being set to 1 is the positive number.
6. The method for making the motor of an electric toothbrush play audio according to claim 2, characterized in that, Step S14 specifically involves: for each duty cycle in the duty cycle sequence, if the duty cycle is positive, take its opposite and add 100%; if the duty cycle is negative, add 100% and take its opposite. Then, multiply each number by a multiple of the audio sampling rate relative to the main clock cycle of the main control chip and round down to obtain a value. This process is repeated for the entire duty cycle sequence to obtain a value sequence. The value sequence is then divided into two sequences, wherein for each value in the value sequence, if the value is positive, then... The first sequence takes the value, and the second sequence takes the multiple of the period of the square wave of the audio sampling rate relative to the main clock period of the main control chip. If the value is negative, the first sequence takes the multiple of the period of the square wave of the audio sampling rate relative to the main clock period of the main control chip, and the second sequence takes the absolute value of the value. Furthermore, the length of the first input digital signal to the motor driver chip that is set to 1 is determined based on the value in the first sequence, and the length of the second input digital signal to the motor driver chip that is set to 1 is determined based on the value in the second sequence.
7. The method for making the motor of an electric toothbrush play audio according to any one of claims 2-6, characterized in that, In step S12, when resampling the audio file based on the audio sampling rate, a sampling rate lower than the audio sampling rate is used for downsampling.
8. A system for making the motor of an electric toothbrush play audio, characterized in that, include: An audio file preprocessing module is used to preprocess audio files to convert them into digital signal sequences that the main control chip of the electric toothbrush can directly read and use. A digital signal sequence storage module is used to store the preprocessed digital signal sequence into the flash memory of the electric toothbrush; A digital signal sequence reading and sending module is used to enable the main control chip of the electric toothbrush to read the digital signal sequence from the flash memory and send it to the motor drive chip of the electric toothbrush; A digital signal sequence conversion and driving module is used to enable the motor driver chip to convert the digital signal sequence into a power signal sequence, and drive the sonic motor of the electric toothbrush to emit a corresponding sound through the power signal sequence.
9. A device for enabling the motor of an electric toothbrush to play audio, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method of making the motor of the electric toothbrush play audio as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method for making the motor of the electric toothbrush play audio as described in any one of claims 1-7.