CN107945778B - Electronic musical instrument - Google Patents

Electronic musical instrument Download PDF

Info

Publication number
CN107945778B
CN107945778B CN201711480700.5A CN201711480700A CN107945778B CN 107945778 B CN107945778 B CN 107945778B CN 201711480700 A CN201711480700 A CN 201711480700A CN 107945778 B CN107945778 B CN 107945778B
Authority
CN
China
Prior art keywords
sensor group
signal
sensor
processor
ultrasonic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201711480700.5A
Other languages
Chinese (zh)
Other versions
CN107945778A (en
Inventor
瞿妤冰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN201711480700.5A priority Critical patent/CN107945778B/en
Publication of CN107945778A publication Critical patent/CN107945778A/en
Application granted granted Critical
Publication of CN107945778B publication Critical patent/CN107945778B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H3/00Instruments in which the tones are generated by electromechanical means
    • G10H3/12Instruments in which the tones are generated by electromechanical means using mechanical resonant generators, e.g. strings or percussive instruments, the tones of which are picked up by electromechanical transducers, the electrical signals being further manipulated or amplified and subsequently converted to sound by a loudspeaker or equivalent instrument
    • G10H3/14Instruments in which the tones are generated by electromechanical means using mechanical resonant generators, e.g. strings or percussive instruments, the tones of which are picked up by electromechanical transducers, the electrical signals being further manipulated or amplified and subsequently converted to sound by a loudspeaker or equivalent instrument using mechanically actuated vibrators with pick-up means
    • G10H3/146Instruments in which the tones are generated by electromechanical means using mechanical resonant generators, e.g. strings or percussive instruments, the tones of which are picked up by electromechanical transducers, the electrical signals being further manipulated or amplified and subsequently converted to sound by a loudspeaker or equivalent instrument using mechanically actuated vibrators with pick-up means using a membrane, e.g. a drum; Pick-up means for vibrating surfaces, e.g. housing of an instrument
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H1/00Details of electrophonic musical instruments
    • G10H1/32Constructional details
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10HELECTROPHONIC MUSICAL INSTRUMENTS; INSTRUMENTS IN WHICH THE TONES ARE GENERATED BY ELECTROMECHANICAL MEANS OR ELECTRONIC GENERATORS, OR IN WHICH THE TONES ARE SYNTHESISED FROM A DATA STORE
    • G10H1/00Details of electrophonic musical instruments
    • G10H1/46Volume control
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Electrophonic Musical Instruments (AREA)

Abstract

本申请涉及一种电子乐器,触发各传感器组中当前传感器组工作并发射第一信号,在接收到对应的第一返回信号时,根据第一返回信号的接收时间以及发射第一信号的发射时间获知第一击打距离,然后再根据第二返回信号的接收时间以及第二信号的发射时间获取第二击打距离,通过第一击打距离、第二击打距离以及预设阈值时长获知击打速度,进而可发出与击打速度对应音量大小的以及与接收第一返回信号的非接触式传感器的身份标识对应音色的声音。在计时时长达到预设时长时,将各传感器组中下一个传感器组作为当前传感器组,返回执行触发当前传感器组工作,即轮流触发各传感器组,如此可避免所有传感器同时工作易产生干扰的问题,提高感应准确性。

Figure 201711480700

This application relates to an electronic musical instrument, which triggers the current sensor group in each sensor group to work and emit the first signal. Know the first striking distance, and then obtain the second striking distance according to the receiving time of the second return signal and the transmitting time of the second signal, and know the striking distance through the first striking distance, the second striking distance and the preset threshold duration. Hit the speed, and then can emit a sound with a volume corresponding to the hitting speed and a tone corresponding to the identity of the non-contact sensor that receives the first return signal. When the timing time reaches the preset time, the next sensor group in each sensor group will be used as the current sensor group, and the current sensor group will be returned to trigger the work, that is, each sensor group will be triggered in turn, so as to avoid the problem that all sensors work at the same time and easily cause interference , to improve the sensing accuracy.

Figure 201711480700

Description

电子乐器electronic musical instrument

技术领域technical field

本发明涉及电子设备技术领域,特别涉及一种电子乐器。The invention relates to the technical field of electronic equipment, in particular to an electronic musical instrument.

背景技术Background technique

近年来,乐器的电子化技术逐渐成为电子研究领域的重点内容,从而产生了各种各样的电子乐器,电子鼓是常见的电子乐器之一。电子鼓是乐手通过击打鼓面触发电子信号,再利用电子合成技术或是采样技术对电子新信号进行处理,通过电声设备发出声音的乐器。常见的有橡胶电子板型的电子乐器以及网状模拟(又称网状鼓皮,mesh drum head)的电子乐器,橡胶电子板型的电子乐器是用橡胶材质作面板,外接感应器型,例如,可在鼓的边缘装上感应器,网状鼓皮是目前高科技的新式主战场,网状鼓皮结合了鼓皮及传感器的双重质感,打击网状鼓皮时声量不但比传统橡胶鼓皮还低,鼓手更可以随自己的偏好去调教它的张力,其内部是一快面板里面安装上多个传感器,所以还可以做鼓框的效果。In recent years, the electronic technology of musical instruments has gradually become the key content in the field of electronic research, resulting in a variety of electronic musical instruments, and electronic drums are one of the common electronic musical instruments. The electronic drum is a musical instrument in which the musician triggers an electronic signal by hitting the drum surface, and then uses electronic synthesis technology or sampling technology to process the new electronic signal, and then emits sound through the electro-acoustic equipment. Common electronic musical instruments with rubber electronic board and mesh simulation (also known as mesh drum head) electronic musical instruments, electronic musical instruments with rubber electronic board use rubber material as the panel, and external sensor type, such as , sensors can be installed on the edge of the drum. The mesh drumhead is the new high-tech main battlefield. The mesh drumhead combines the double texture of the drumhead and the sensor. When hitting the mesh drumhead, the sound volume is not only higher than that of the traditional rubber drum The skin is still low, and drummers can adjust its tension according to their own preferences. Inside is a fast panel with multiple sensors installed in it, so it can also be used as a drum frame effect.

目前,一般的电子乐器具有重量轻、体积小而且易拆装、携带方便以及便于快速组装调试等特点。但是,在对电子乐器进行击打过程中,容易造成击打面的损坏。为了解决击打鼓面易造成电子乐器损坏的问题,后续通过非接触式击打的电子乐器,通过电子乐器上安装的传感器进行非接触式感应,然而各传感器之间容易产生干扰,即一个传感器发出的探测波束被另外一个传感器当作自己的探测波束接收到,这导致传感器感应准确度差,进而造成电子乐器发声不准确。At present, general electronic musical instruments have the characteristics of light weight, small size, easy disassembly, easy portability, and quick assembly and debugging. However, in the process of striking the electronic musical instrument, it is easy to cause damage to the striking surface. In order to solve the problem that the electronic musical instrument is easily damaged by hitting the drum surface, the electronic musical instrument that is hit by non-contact will be sensed by the sensor installed on the electronic musical instrument. However, interference between the sensors is easy to occur, that is, a sensor sends out The detection beam of the sensor is received by another sensor as its own detection beam, which leads to poor sensing accuracy of the sensor, which in turn causes inaccurate sounding of electronic musical instruments.

发明内容Contents of the invention

基于此,有必要针对现有电子乐器易受干扰导致发声不准确的问题,提供一种电子乐器。Based on this, it is necessary to provide an electronic musical instrument to solve the problem that the existing electronic musical instrument is susceptible to interference and causes inaccurate sounding.

一种电子乐器,,包括主体、处理器以及至少两个传感器组,各所述传感器组分别设置于所述主体,任意一个所述传感器组中包括至少两个非接触式传感器,各所述传感器组中各所述非接触式传感器分别与所述处理器连接;其中,各所述非接触式传感器分别对应身份标识;An electronic musical instrument, comprising a main body, a processor and at least two sensor groups, each of the sensor groups is respectively arranged on the main body, any one of the sensor groups includes at least two non-contact sensors, and each of the sensor groups Each of the non-contact sensors in the group is respectively connected to the processor; wherein, each of the non-contact sensors corresponds to an identity mark;

所述处理器在接收到工作指令时,开始计时,并将各所述传感器组中的任意一个传感器组作为当前传感器组,触发所述当前传感器组工作,发射第一信号,所述当前传感器组中所述非接触式传感器在开始计时后的预设时长范围内接收到发射的所述第一信号对应的第一返回信号时,所述处理器根据所述第一返回信号的接收时间以及所述第一信号的发射时间获取第一击打距离,并在接收到所述第一返回信号的预设阈值时长后触发所述非接触式传感器发射第二信号,在所述预设时长范围内接收到发射的所述第二信号对应的第二返回信号时,所述处理器根据所述第二返回信号的接收时间以及所述第二信号的发射时间获取第二击打距离,根据所述第一击打距离、第二击打距离以及所述预设阈值时长获取击打速度,所述处理器根据所述非接触式传感器的身份标识以及所述击打速度,发出与所述身份标识对应音色的、且与所述击打速度对应音量的声音,当计时时长达到所述预设时长时,停止所述当前传感器组发射信号,计时清零,重新开始计时,并将各所述传感器组中除所述当前传感器组之外的任意一个所述传感器组作为所述当前传感器组,返回执行所述触发所述当前传感器组发射信号。When the processor receives the work instruction, it starts timing, and uses any sensor group in each of the sensor groups as the current sensor group, triggers the current sensor group to work, and emits a first signal, and the current sensor group When the non-contact sensor receives the first return signal corresponding to the transmitted first signal within the preset time period after starting the timing, the processor according to the receiving time of the first return signal and the Acquire the first striking distance according to the emission time of the first signal, and trigger the non-contact sensor to emit the second signal after receiving the preset threshold duration of the first return signal, within the preset duration range When receiving the second return signal corresponding to the transmitted second signal, the processor acquires the second striking distance according to the receiving time of the second return signal and the transmitting time of the second signal, according to the The first striking distance, the second striking distance and the preset threshold duration obtain the striking speed, and the processor sends out a For the sound corresponding to the timbre and the volume corresponding to the hitting speed, when the timing time reaches the preset time length, stop the current sensor group from emitting signals, reset the timing, restart the timing, and turn each of the sensors Any one of the sensor groups in the group except the current sensor group is used as the current sensor group, and the triggering of the current sensor group to emit a signal is performed back.

在其中一个实施例中,任意一个所述传感器组中各所述非接触式传感器之间的距离大于预设防干扰距离。In one of the embodiments, the distance between the non-contact sensors in any one of the sensor groups is greater than the preset anti-interference distance.

在其中一个实施例中,在所述停止所述当前传感器组工作的预设触发间隔时间后,计时清零。In one of the embodiments, after the preset trigger interval time of stopping the operation of the current sensor group, the timer is reset to zero.

在其中一个实施例中,所述处理器预先设置计数器,所述计数器的计数值初始为零,所述处理器在接收到所述工作指令时,每隔预设间隔时间,产生一次中断指令,每接收到一次中断指令,将所述计数值增1,在所述计数值达到预设次数时,所述计时时长达到所述预设时长,将所述计数器清零。In one of the embodiments, the processor presets a counter, the count value of the counter is initially zero, and the processor generates an interrupt command at a preset interval when receiving the work command, Each time an interrupt command is received, the count value is increased by 1, and when the count value reaches a preset number of times, the timing duration reaches the preset duration, and the counter is cleared.

在其中一个实施例中,所述非接触式传感器为超声波传感器。In one of the embodiments, the non-contact sensor is an ultrasonic sensor.

在其中一个实施例中,所述非接触式传感器包括超声波发射器以及超声波接收器,所述处理器分别与所述超声波发生器以及所述超声波接收器连接;In one of the embodiments, the non-contact sensor includes an ultrasonic transmitter and an ultrasonic receiver, and the processor is connected to the ultrasonic generator and the ultrasonic receiver respectively;

在所述触发所述当前传感器组工作,发射第一信号中,通过分别触发所述当前传感器组中各非接触式传感器的超声波发送器发射超声波信号;In the process of triggering the current sensor group to work and transmitting the first signal, the ultrasonic transmitters of the non-contact sensors in the current sensor group are respectively triggered to emit ultrasonic signals;

通过所述超声波接收器接收所述第一信号对应的第一返回信号,所述第一返回信号为所述第一超声波信号对应的返回信号。A first return signal corresponding to the first signal is received by the ultrasonic receiver, and the first return signal is a return signal corresponding to the first ultrasonic signal.

在其中一个实施例中,上述电子乐器,还包括滤波电路,所述超声波接收器通过所述滤波电路与所述处理器连接。In one of the embodiments, the above-mentioned electronic musical instrument further includes a filter circuit, and the ultrasonic receiver is connected to the processor through the filter circuit.

在其中一个实施例中,所述处理器在接收到停止指令时,停止各所述传感器组工作。In one of the embodiments, when the processor receives a stop instruction, it stops the operation of each of the sensor groups.

在其中一个实施例中,所述传感器组的数量为三个,包括第一传感器组、第二传感器组以及第三传感器组,所述第一传感器组中所述非接触式传感器的数量为三个,所述第二传感器组以及所述第三传感器组中所述非接触式传感器的数量分别为两个。In one of the embodiments, the number of the sensor groups is three, including the first sensor group, the second sensor group and the third sensor group, and the number of the non-contact sensors in the first sensor group is three The number of the non-contact sensors in the second sensor group and the third sensor group is two respectively.

在其中一个实施例中,上述电子乐器,还包括分别与所述处理器连接的第一发声装置以及第二发声装置,所述第一发声装置以及所述第二发声装置相对设置于所述主体,在所述处理器发出对应声音中,所述处理器分别通过第一发声装置以及所述第二发声装置发出对应声音。In one of the embodiments, the above-mentioned electronic musical instrument further includes a first sound-generating device and a second sound-generating device respectively connected to the processor, and the first sound-generating device and the second sound-generating device are relatively arranged on the main body , when the processor emits the corresponding sound, the processor emits the corresponding sound through the first sound generating device and the second sound generating device respectively.

上述电子乐器,在进行感应击打发声的过程中,首先将各传感器组中的任意一个传感器组作为当前传感器组,并触发其进行工作,即发射第一信号,在接收到发射的第一信号对应的第一返回信号时,根据第一返回信号的接收时间以及发射第一信号的发射时间,可获知第一击打距离,然后在根据第二返回信号的接收时间以及第二信号的发射时间获取第二击打距离,通过第一击打距离、第二击打距离以及预设阈值时长获知击打速度,进而可发出与击打速度对应音量大小的以及与接收第一返回信号的非接触式传感器的身份标识对应音色的声音。在计时时长达到预设时长时,停止当前传感器组发射信号,计时清零,重新开始计时,并将各传感器组中除当前传感器组之外的任意一个传感器组作为当前传感器组,返回执行触发当前传感器组发射信号,即轮流触发各传感器组,如此可避免所有传感器同时工作引起感应失误导致感应影响发生的问题,提高感应准确性,进而使发声更加准确。The above-mentioned electronic musical instrument, in the process of inductive percussion and sounding, first uses any sensor group in each sensor group as the current sensor group, and triggers it to work, that is, to emit the first signal, and when the first signal is received When corresponding to the first return signal, according to the reception time of the first return signal and the transmission time of the first signal, the first striking distance can be known, and then according to the reception time of the second return signal and the transmission time of the second signal Obtain the second striking distance, and know the striking speed through the first striking distance, the second striking distance and the preset threshold duration, and then send out the non-contact with the volume corresponding to the striking speed and receive the first return signal The identity of the type sensor corresponds to the sound of the timbre. When the timing reaches the preset duration, stop the current sensor group from transmitting signals, reset the timing, restart timing, and use any sensor group in each sensor group except the current sensor group as the current sensor group, return to execute the trigger current The sensor group emits signals, that is, each sensor group is triggered in turn, which can avoid the problem of induction error caused by all sensors working at the same time, which will lead to the occurrence of sensing influence, improve the accuracy of sensing, and make the sound more accurate.

附图说明Description of drawings

图1为一种实施例的电子乐器的结构图;Fig. 1 is a structural diagram of an electronic musical instrument of an embodiment;

图2为一个实施例的电子乐器中滤波电路的结构图;Fig. 2 is the structural diagram of filter circuit in the electronic musical instrument of an embodiment;

图3为本实施例中触发超声波传感器进行感应过程中的时序图;FIG. 3 is a timing diagram during the sensing process of triggering the ultrasonic sensor in this embodiment;

图4为本实施例中采样值与距离值的关系图。FIG. 4 is a relationship diagram between sampling values and distance values in this embodiment.

具体实施方式Detailed ways

请参阅图1,本发明的一个实施例提供一种电子乐器,包括主体100、处理器(图未示)以及至少两个传感器组,各传感器组分别设置于主体100,任意一个传感器组中包括至少两个非接触式传感器,各传感器组中各非接触式传感器分别与处理器连接;其中,各非接触式传感器分别对应身份标识。Referring to Fig. 1, an embodiment of the present invention provides an electronic musical instrument, including a main body 100, a processor (not shown) and at least two sensor groups, each sensor group is respectively arranged on the main body 100, and any sensor group includes There are at least two non-contact sensors, and each non-contact sensor in each sensor group is respectively connected to the processor; wherein, each non-contact sensor corresponds to an identity mark.

处理器在接收到工作指令时,开始计时,并将各传感器组中的任意一个传感器组作为当前传感器组,触发当前传感器组发射第一信号,当前传感器组中非接触式传感器在开始计时后的预设时长范围内接收到发射的第一信号对应的第一返回信号时,处理器根据第一返回信号的接收时间以及第一信号的发射时间获取第一击打距离,并在接收到第一返回信号的预设阈值时长后触发非接触式传感器发射第二信号,在预设时长范围内接收到发射的第二信号对应的第二返回信号时,处理器根据第二返回信号的接收时间以及第二信号的发射时间获取第二击打距离,根据第一击打距离、第二击打距离以及预设阈值时长获取击打速度,处理器根据非接触式传感器的身份标识以及击打速度,发出与身份标识对应音色的、且与击打速度对应音量的声音,当计时时长达到预设时长时,停止当前传感器组发射信号,计时清零,重新开始计时,并将各传感器组中除当前传感器组之外的任意一个传感器组作为当前传感器组,返回执行触发当前传感器组发射信号。When the processor receives the work order, it starts timing, and uses any sensor group in each sensor group as the current sensor group to trigger the current sensor group to emit the first signal. When the first return signal corresponding to the transmitted first signal is received within the preset duration range, the processor obtains the first striking distance according to the receiving time of the first return signal and the transmitting time of the first signal, and upon receiving the first After the preset threshold duration of the return signal, the non-contact sensor is triggered to transmit the second signal. When the second return signal corresponding to the transmitted second signal is received within the preset duration, the processor will The emission time of the second signal obtains the second striking distance, obtains the striking speed according to the first striking distance, the second striking distance and the preset threshold duration, and the processor according to the identification and striking speed of the non-contact sensor, Make a sound corresponding to the timbre of the identity and the volume corresponding to the hitting speed. When the timing reaches the preset duration, the current sensor group will stop emitting signals, the timing will be reset, and the timing will be restarted. Any sensor group other than the sensor group is used as the current sensor group, and the return execution triggers the current sensor group to emit a signal.

每个非接触式传感器有其对应的唯一的身份标识例如编号,每个身份标识分别对应不同音色,即各非接触式传感器的身份标识分别与音色对应,例如,各传感器组中的非接触式传感器的总数为7个,身份标识分别为1、2、3、4、5、6和7,若身份标识1对应的音色对应鼓的音色,在触发当前传感器组工作进行信号发射时,若其中的非接触式传感器接收到返回信号时,表示在该非接触式传感器的感应范围内有感应到对发生电子器件的击打,若身份标识为1的非接触式传感器工作,接收到与发射的第一信号对应的第一返回信号时,处理器发出与身份标识1对应的音色,即可发出鼓声。又比如,身份标识2对应的音色为钢琴的音色,若身份标识为2的非接触式传感器接收到与发射的第一信号对应的第一返回信号时,处理器发出与身份标识2对应的音色,即可发出钢琴声。Each non-contact sensor has its corresponding unique identity, such as a number, and each identity corresponds to a different timbre, that is, the identity of each non-contact sensor corresponds to the timbre, for example, the non-contact sensor in each sensor group The total number of sensors is 7, and the IDs are 1, 2, 3, 4, 5, 6, and 7 respectively. If the timbre corresponding to ID 1 corresponds to the timbre of the drum, when triggering the current sensor group to work for signal transmission, if one of them When the non-contact sensor of the non-contact sensor receives the return signal, it means that within the sensing range of the non-contact sensor, the impact on the electronic device is sensed. When the first return signal corresponds to the first signal, the processor emits the timbre corresponding to the ID 1, that is, the drum sound. For another example, the timbre corresponding to the ID 2 is the timbre of a piano. If the non-contact sensor with the ID 2 receives the first return signal corresponding to the first signal transmitted, the processor sends out the timbre corresponding to the ID 2. to play the piano sound.

另外,发出的声音的音量大小是和击打力度有关,在本实施例中,通过击打速度来表征击打力度,即击打速度越快表示击打力度越大,发出的声音的音量越大,例如,在击打速度小于或等于1时,处理器控制发出与击打速度对应的较小的音量的声音,在击打速度大于1且小于或等于2时,处理器控制发出比击打速度小于或等于1时的音量大的声音,在击打速度大于2且小于或等于5时,处理器控制发出比击打速度大于1且小于或等于2时的音量大的声音,在击打速度大于5且小于或等于10时,处理器控制发出比击打速度大于2且小于或等于5时的音量大的声音,在击打速度大于10且小于或等于15时,处理器控制发出比击打速度大于5且小于或等于10时的音量大的声音,在击打速度大于15时,处理器控制发出比击打速度大于5且小于或等于10时的音量大的声音。在获取击打速度的过程中,击打物在击打过程中会移动,通过发送信号感应击打物在不同时间点的击打距离,即可知在这段时间内击打物移动的距离,进而可获知击打速度。具体地,首先需要获知击打距离差,通过距离差以及预设阈值时长获取击打速度,其中,距离差即为第一击打距离与第二击打距离之间的距离差。其中,预设阈值时长小于预设时长。在一个示例中,预设阈值时长为10微秒,预设时长为200毫秒。In addition, the volume of the sound is related to the hitting force. In this embodiment, the hitting speed is used to characterize the hitting force, that is, the faster the hitting speed, the greater the hitting force, and the higher the volume of the sound. Large, for example, when the hitting speed is less than or equal to 1, the processor controls to emit a sound with a lower volume corresponding to the hitting speed; When the hitting speed is less than or equal to 1, the volume is louder. When the hitting speed is greater than 2 and less than or equal to 5, the processor controls the sound to be louder than when the hitting speed is greater than 1 and less than or equal to 2. When hitting When the hitting speed is greater than 5 and less than or equal to 10, the processor controls to emit a louder sound than when the hitting speed is greater than 2 and less than or equal to 5; when the hitting speed is greater than 10 and less than or equal to 15, the processor controls to emit The sound is louder than the volume when the hitting speed is greater than 5 and less than or equal to 10. When the hitting speed is greater than 15, the processor controls the sound to be louder than the volume when the hitting speed is greater than 5 and less than or equal to 10. In the process of obtaining the hitting speed, the hitting object will move during the hitting process. By sending signals to sense the hitting distance of the hitting object at different time points, the moving distance of the hitting object during this period can be known. Then the hitting speed can be known. Specifically, it is first necessary to know the striking distance difference, and obtain the striking speed through the distance difference and the preset threshold duration, wherein the distance difference is the distance difference between the first striking distance and the second striking distance. Wherein, the preset threshold duration is shorter than the preset duration. In an example, the preset threshold duration is 10 microseconds, and the preset duration is 200 milliseconds.

上述电子乐器,在进行感应击打发声的过程中,首先将各传感器组中的任意一个传感器组作为当前传感器组,并触发其进行工作,即发射第一信号,在接收到发射的第一信号对应的第一返回信号时,根据第一返回信号的接收时间以及发射第一信号的发射时间,可获知第一击打距离,然后在根据第二返回信号的接收时间以及第二信号的发射时间获取第二击打距离,通过第一击打距离、第二击打距离以及预设阈值时长获知击打速度,进而可发出与击打速度对应音量大小的以及与接收第一返回信号的非接触式传感器的身份标识对应音色的声音。在计时时长达到预设时长时,停止当前传感器组发射信号,计时清零,重新开始计时,并将各传感器组中除当前传感器组之外的任意一个传感器组作为当前传感器组,返回执行触发当前传感器组发射信号,即轮流触发各传感器组,如此可避免所有传感器同时工作引起感应失误导致感应影响发生的问题,提高感应准确性,进而使发声更加准确。The above-mentioned electronic musical instrument, in the process of inductive percussion and sounding, first uses any sensor group in each sensor group as the current sensor group, and triggers it to work, that is, to emit the first signal, and when the first signal is received When corresponding to the first return signal, according to the reception time of the first return signal and the transmission time of the first signal, the first striking distance can be known, and then according to the reception time of the second return signal and the transmission time of the second signal Obtain the second striking distance, and know the striking speed through the first striking distance, the second striking distance and the preset threshold duration, and then send out the non-contact with the volume corresponding to the striking speed and receive the first return signal The identity of the type sensor corresponds to the sound of the timbre. When the timing reaches the preset duration, stop the current sensor group from transmitting signals, reset the timing, restart timing, and use any sensor group in each sensor group except the current sensor group as the current sensor group, return to execute the trigger current The sensor group emits signals, that is, each sensor group is triggered in turn, which can avoid the problem of induction error caused by all sensors working at the same time, which will lead to the occurrence of sensing influence, improve the accuracy of sensing, and make the sound more accurate.

另外,各非接触式传感器分别对应音色,在非接触式传感器感应到返回信号后,处理器进行发声时,发出与该接触式传感器的身份标识对应音色的声音。在本实施例中,获得第一距离的公式为:第一距离=(第一返回信号的接收时间与第一信号的发射时间的时间差)*声速/2,声速为340M/S。获取第二距离的公式为:第二距离=(第二返回信号的接收时间与第二信号的发射时间的时间差)*声速/2。In addition, each of the non-contact sensors corresponds to the timbre, and after the non-contact sensor senses the return signal, when the processor emits a sound, it emits a sound corresponding to the timbre of the identity of the contact sensor. In this embodiment, the formula for obtaining the first distance is: first distance=(the time difference between the receiving time of the first return signal and the transmitting time of the first signal)*sound velocity/2, and the sound velocity is 340M/S. The formula for obtaining the second distance is: second distance=(time difference between the receiving time of the second return signal and the transmitting time of the second signal)*sound speed/2.

在其中一个实施例中,任意一个传感器组中各非接触式传感器之间的距离大于预设防干扰距离。In one of the embodiments, the distance between the non-contact sensors in any sensor group is greater than the preset anti-interference distance.

同一个传感器组中的非接触式传感器之间的距离若太近,可能会产生交叉干扰,即一个非接触式传感器发射的探测波束可能比另一个非接触式的传感器当作自己的探测波束接收到,为了避免同一个传感器组中的非接触式传感器之间发生干扰,将非接触式传感器设置于主体100时,任意一个传感器组中各非接触式传感器之间的距离大于预设防干扰距离,即各非接触式传感器之间的距离大于预设防干扰距离,如此,可在降低各非接触式传感器之间发生干扰的情况发生。If the distance between the non-contact sensors in the same sensor group is too close, cross-interference may occur, that is, the detection beam emitted by one non-contact sensor may be more than the other non-contact sensor as its own detection beam. In order to avoid interference between the non-contact sensors in the same sensor group, when the non-contact sensors are arranged on the main body 100, the distance between the non-contact sensors in any one sensor group is greater than the preset anti-interference distance , that is, the distance between the non-contact sensors is greater than the preset anti-interference distance, so that the occurrence of interference between the non-contact sensors can be reduced.

在其中一个实施例中,在停止当前传感器组工作的预设触发间隔时间后,计时清零。In one of the embodiments, after the preset triggering interval time when the current sensor group stops working, the timer is reset to zero.

即在轮流触发各传感器组进行工作时,传感器组之间间隔预设触发间隔时间进行触发,即触发间隔为预设触发间隔时间,在当前传感器组触发感应完毕后,需要等待预设触发间隔时间,再触发下一组传感器组工作进行感应。如此,可避免各传感器组之间的余波干扰。在一个示例中,预设触发间隔时间可以为20毫秒。That is, when each sensor group is triggered in turn to work, the sensor groups are triggered at a preset trigger interval time, that is, the trigger interval is the preset trigger interval time. After the current sensor group is triggered and sensed, it is necessary to wait for the preset trigger interval time , and then trigger the next group of sensor groups to work for sensing. In this way, aftermath interference between sensor groups can be avoided. In an example, the preset trigger interval may be 20 milliseconds.

在其中一个实施例中,处理器预先设置计数器,计数器的计数值初始为零,处理器在接收到工作指令时,每隔预设间隔时间,产生一次中断指令,每接收到一次中断指令,将计数值增1,在计数值达到预设次数时,计时时长达到预设时长,将计数器清零。In one of the embodiments, the processor presets the counter, and the count value of the counter is initially zero. When the processor receives the work instruction, it generates an interrupt instruction at a preset interval time, and each time it receives an interrupt instruction, it will The counting value is increased by 1, and when the counting value reaches the preset number of times, the timing duration reaches the preset duration, and the counter is cleared.

可以理解预设间隔时长与预设次数的乘积即为预设时长,在计数值达到预设次数时,表示计时时长达到了预设时长,此时可将计数器清零,以便为后续为下一各传感器组工作进行计时。在一个示例中,预设间隔时间为10毫秒,预设次数为20。It can be understood that the product of the preset interval length and the preset number of times is the preset time length. When the count value reaches the preset number of times, it means that the timing duration has reached the preset time length. At this time, the counter can be reset to zero for the next The work of each sensor group is timed. In one example, the preset interval time is 10 milliseconds, and the preset number of times is 20.

在其中一个实施例中,非接触式传感器为超声波传感器。In one embodiment, the non-contact sensor is an ultrasonic sensor.

超声波传感器是利用超声波的特性研制而成的传感器。超声波是一种振动频率高于声波的机械波,由换能晶片在电压的激励下发生振动产生的,它具有频率高、波长短、绕射现象小,特别是方向性好、能够成为射线而定向传播等特点。超声波对液体、固体的穿透本领很大,尤其是在阳光不透明的固体中,它可穿透几十米的深度。超声波碰到杂质或分界面会产生显著反射形成反射成回波。在本实施例中,触发超声波传感器工作时,超声波传感器发射超声波,在对发生电子器件进行非接触式击打时,超声波会碰到击打物反射,超声波传感器从而可接收到返回信号,实现对击打物的感应。Ultrasonic sensors are sensors developed using the characteristics of ultrasonic waves. Ultrasound is a mechanical wave with a vibration frequency higher than that of sound waves, which is generated by the vibration of the transducer chip under the excitation of voltage. It has high frequency, short wavelength, small diffraction phenomenon, especially good directionality, and can be oriented as rays dissemination characteristics. Ultrasound has a great penetrating ability to liquids and solids, especially in solids that are opaque to sunlight, it can penetrate to a depth of tens of meters. When the ultrasonic wave hits the impurity or the interface, it will produce a significant reflection to form an echo. In this embodiment, when the ultrasonic sensor is triggered to work, the ultrasonic sensor emits ultrasonic waves. When the electronic device is hit in a non-contact manner, the ultrasonic waves will be reflected by the hitting object, and the ultrasonic sensor can receive the return signal to realize the Induction of hitting objects.

在其中一个实施例中,非接触式传感器包括超声波发射器以及超声波接收器,处理器分别与超声波发生器以及超声波接收器连接;在触发当前传感器组工作,发射第一信号中,通过分别触发当前传感器组中各非接触式传感器的超声波发送器发射第一超声波信号;通过超声波接收器接收第一信号对应的第一返回信号,第一返回信号为第一超声波信号对应的返回信号。In one of the embodiments, the non-contact sensor includes an ultrasonic transmitter and an ultrasonic receiver, and the processor is connected to the ultrasonic generator and the ultrasonic receiver respectively; The ultrasonic transmitter of each non-contact sensor in the sensor group transmits the first ultrasonic signal; the first return signal corresponding to the first signal is received by the ultrasonic receiver, and the first return signal is the return signal corresponding to the first ultrasonic signal.

可以理解,在本实施例中,第一信号为第一超声波信号,第一返回信号为第一超声波返回信号,第一超声波信号对应的返回信号即为第一超声波返回信号。It can be understood that, in this embodiment, the first signal is the first ultrasonic signal, the first return signal is the first ultrasonic return signal, and the return signal corresponding to the first ultrasonic signal is the first ultrasonic return signal.

在其中一个实施例中,还包括滤波电路,超声波接收器通过滤波电路与处理器连接。In one of the embodiments, a filter circuit is also included, and the ultrasonic receiver is connected with the processor through the filter circuit.

为排除第一返回信号中的干扰,确保信号的精准,可在超声宝接收器与处理器之间连接滤波电路,通过滤波电路对第一返回信号进行滤波,消除干扰,提高第一返回信号的准确性。In order to eliminate the interference in the first return signal and ensure the accuracy of the signal, a filter circuit can be connected between the ultrasonic receiver and the processor, and the first return signal can be filtered through the filter circuit to eliminate interference and improve the accuracy of the first return signal. accuracy.

在一个示例中,滤波电路包括第一二极管D1、第二二极管D2、电容C以及电阻R,即RC滤波电路,超声波接收器分别与滤波电路中的电容C的一端、第一二极管D1的正极、第二二极管D2的负极以及电阻R的一端连接,电容C的另一端以及第二二极管D2的正极分别接地,第一二极管D1的负极连接电源(一个示例中,可以为3.3V的电源),电阻R的另一端连接处理器。具体地,电容C的容量可以为0.01微法。In one example, the filter circuit includes a first diode D1, a second diode D2, a capacitor C and a resistor R, that is, an RC filter circuit, and the ultrasonic receiver is respectively connected to one end of the capacitor C, the first two The positive pole of the diode D1, the negative pole of the second diode D2 and one end of the resistor R are connected, the other end of the capacitor C and the positive pole of the second diode D2 are respectively grounded, and the negative pole of the first diode D1 is connected to the power supply (one In an example, it can be a 3.3V power supply), and the other end of the resistor R is connected to the processor. Specifically, the capacity of the capacitor C may be 0.01 microfarads.

在其中一个实施例中,处理器在接收到停止指令时,停止各传感器组工作。In one of the embodiments, when the processor receives the stop instruction, it stops the work of each sensor group.

在无需利用电子乐器进行感应发声时,可控制电子乐器停止工作,具体地,可通过对电子乐器的主体100上的停止按键进行操作,例如可进行对停止按键按压,即可产生停止指令,处理器在接收到停止指令时,控制各传感器组停止工作,如此,可避免各传感器组一直不停的工作导致易损坏以及使用寿命缩短的情况。When there is no need to use the electronic musical instrument for inductive sounding, the electronic musical instrument can be controlled to stop working. Specifically, the stop button on the main body 100 of the electronic musical instrument can be operated, for example, the stop button can be pressed to generate a stop command. When the controller receives the stop instruction, it controls each sensor group to stop working, so that the situation that each sensor group has been working non-stop, resulting in easy damage and shortened service life can be avoided.

在其中一个实施例中,传感器组的数量为三个,包括第一传感器组、第二传感器组以及第三传感器组,第一传感器组中非接触式传感器的数量为三个,第二传感器组以及第三传感器组中非接触式传感器的数量分别为两个。In one of the embodiments, the number of sensor groups is three, including the first sensor group, the second sensor group and the third sensor group, the number of non-contact sensors in the first sensor group is three, and the second sensor group And the number of non-contact sensors in the third sensor group is two respectively.

即在发生电子器件的主体100上设有7个非接触式传感器,各非接触式传感器在对应的工作时间段内进行障碍物感应,即用户在进行非接触式击打时,击打物对传感器发出的信号进行反射,以实现对击打物即障碍物的距离检测。在本实施中,7个非接触式传感器分别对应的音色可部分相同,也可均不相同,还可全部相同。That is, there are seven non-contact sensors on the main body 100 of the electronic device, and each non-contact sensor performs obstacle sensing during the corresponding working time period, that is, when the user performs non-contact hitting, the hitting object will The signal sent by the sensor is reflected to realize the distance detection of the hitting object, that is, the obstacle. In this implementation, the timbres corresponding to the seven non-contact sensors may be partly the same, or all may be different, or all may be the same.

具体地,请继续参阅图1,第一传感器组中包括第一非接触式传感器201、第二非接触式传感器202以及第三非接触式传感器203,第二传感器组中包括第四非接触式传感器204以及第五非接触式传感器205,第三传感器组中包括第六非接触式传感器206和第七非接触式传感器207。每组传感器之间间隔预设触发间隔时间触发,例如,可以间隔20毫秒触发,每组之间的余波干扰可以忽略不计。Specifically, please continue to refer to FIG. 1, the first sensor group includes the first non-contact sensor 201, the second non-contact sensor 202 and the third non-contact sensor 203, the second sensor group includes the fourth non-contact sensor The sensor 204 and the fifth non-contact sensor 205, the third sensor group includes the sixth non-contact sensor 206 and the seventh non-contact sensor 207. Each group of sensors is triggered at a preset trigger interval, for example, it can be triggered at an interval of 20 milliseconds, and the aftermath interference between each group can be ignored.

在其中一个实施例中,第一传感器组中三个非接触式传感器之间的连线呈等腰三角形,第二传感器组中的两个非接触式传感器分别与第三传感器组中的两个非接触式传感器之间的连线围绕第一传感器组中的一个非接触式传感器,且连线呈等腰梯形。In one of the embodiments, the connecting line between the three non-contact sensors in the first sensor group is an isosceles triangle, and the two non-contact sensors in the second sensor group are connected with the two non-contact sensors in the third sensor group respectively. The connection line between the non-contact sensors surrounds one non-contact sensor in the first sensor group, and the connection line is an isosceles trapezoid.

第一传感器组中三个非接触式传感器中的两个非接触式传感器分别与剩余的另一个非接触式传感器之间的距离相同,可以理解,第一传感器组中三个非接触式传感器之间的连线呈等腰三角形。另外,第二传感器组中的两个非接触式传感器分别与第三传感器组中的两个非接触式传感器之间的连线围绕第一传感器组中的一个非接触式传感器,且连线呈等腰梯形。如此,可确保主体100上的各非接触式传感器之间的位置关系更加规整,外观更美观,且可降低各非接触式传感器之间产生干扰的风险。The distance between two of the three non-contact sensors in the first sensor group and the remaining other non-contact sensors is the same. It can be understood that the distance between the three non-contact sensors in the first sensor group is the same. The connecting line is an isosceles triangle. In addition, the connection lines between the two non-contact sensors in the second sensor group and the two non-contact sensors in the third sensor group respectively surround one non-contact sensor in the first sensor group, and the connection lines are in the form of Isosceles trapezoid. In this way, a more regular positional relationship between the non-contact sensors on the main body 100 can be ensured, the appearance is more beautiful, and the risk of interference between the non-contact sensors can be reduced.

在其中一个实施例中,上述电子乐器还包括分别与处理器连接的第一发声装置208以及第二发声装置209,第一发声装置208以及第二发声装置209相对设置于主体100,在处理器发出对应声音中,处理器分别通过第一发声装置208以及第二发声装置209发出对应声音。在本实施例中,第一发声装置208以及第二发声装置209可分别为扬声器。In one of the embodiments, the above-mentioned electronic musical instrument also includes a first sound generating device 208 and a second sound generating device 209 respectively connected to the processor. In emitting the corresponding sound, the processor emits the corresponding sound through the first sound generating device 208 and the second sound generating device 209 respectively. In this embodiment, the first sound generating device 208 and the second sound generating device 209 may be speakers respectively.

下面以一具体实施例对上述电子乐器的工作过程加以说明,具体以HC-SR04型号的超声波传感器进行感应为例。The working process of the above-mentioned electronic musical instrument will be described below with a specific embodiment, specifically taking the sensing of the ultrasonic sensor of the HC-SR04 model as an example.

HC-SR04型号的超声波传感器可提供2厘米到400厘米的非接触式距离感测功能,测距精度可达高到3毫米。超声波传感器被处理器触发工作时,先发射超声波,同时打开计时器,当收到回波时关闭计时器,计算超声波的渡越时间(即接受回波的时间与发射超声波的时间之间的时间差),根据渡越时间的长短,输出一个电压与渡越时间线性相关的电平。超声波传感器具有测距精度高、价格低等特点,从而可提高感应准确性。The HC-SR04 model ultrasonic sensor can provide non-contact distance sensing function from 2cm to 400cm, and the ranging accuracy can be as high as 3mm. When the ultrasonic sensor is triggered by the processor, it first emits the ultrasonic wave, and at the same time opens the timer. When the echo is received, the timer is closed, and the transit time of the ultrasonic wave is calculated (that is, the time difference between the time of receiving the echo and the time of emitting the ultrasonic wave) ), according to the length of the transit time, output a level whose voltage is linearly related to the transit time. Ultrasonic sensors have the characteristics of high ranging accuracy and low price, which can improve the sensing accuracy.

HC-SR04型号的超声波传感器进行感应测距的原理具体如下:The principle of the HC-SR04 ultrasonic sensor for inductive distance measurement is as follows:

其中,主要涉及的技术参数如下:Among them, the main technical parameters involved are as follows:

1、使用电压:DC5V;1. Working voltage: DC5V;

2、静态电流:小于2mA;2. Static current: less than 2mA;

3、电平输出:高5V;3. Level output: high 5V;

4、电平输出:底0V;4. Level output: bottom 0V;

5、感应角度:不大于15度;5. Induction angle: no more than 15 degrees;

6、探测距离:2cm-450cm 7:高精度可达0.2cm;6. Detection distance: 2cm-450cm 7: High precision can reach 0.2cm;

7、接线方式,VCC、trig(控制端)、echo(接收端)、GND。7. Wiring mode, VCC, trig (control terminal), echo (receiving terminal), GND.

工作原理如下:It works as follows:

1、采用IO触发测距,给至少10us的高电平信号;1. Use IO to trigger ranging, and give a high-level signal of at least 10us;

2、触发后发送8个40khz的方波,自动检测是否有信号返回;2. Send 8 square waves of 40khz after triggering, and automatically detect whether there is a signal return;

3、有信号返回,通过IO输出一高电平,高电平时间就是超声波从发射到返回的时间。测试距离=(高电平时间*声速(340M/S))/2。3. When there is a signal return, a high level is output through the IO, and the high level time is the time from the ultrasonic wave to its return. Test distance = (high level time * speed of sound (340M/S))/2.

超声波传感器主要利用多普勒原理,通过晶振向外发射超过人体能感知的高频超声波,一般典型的选用25~40kHz波,然后检测反射回来波的频率,如果区域内有物体运动,反射波频率就会有轻微的波动,即多普勒效应,以此来判断照明区域的物体移动,从而达到控制开关的目的。Ultrasonic sensors mainly use the Doppler principle to emit high-frequency ultrasonic waves beyond the perception of the human body through the crystal oscillator. Generally, 25-40kHz waves are typically used, and then the frequency of the reflected wave is detected. If there is an object moving in the area, the frequency of the reflected wave There will be slight fluctuations, that is, the Doppler effect, to judge the movement of objects in the lighting area, so as to achieve the purpose of controlling the switch.

超声波的纵向振荡特性,可以在气体、液体及固体中传播且其传播速度不同;它还有折射和反射现象,在空气中传播其频率较低,衰减较快,而在固体、液体中则衰减较小,传播较远。超声波传感器正是利用超声波的这些特性。超声波传感器有敏感范围大,无视觉盲区,不受障碍物干扰等特点,是检测小物体运动最有效的方法。The longitudinal oscillation characteristics of ultrasonic waves can propagate in gas, liquid and solid with different propagation speeds; it also has refraction and reflection phenomena, and its frequency is lower when propagating in air, and the attenuation is faster, while it is attenuated in solid and liquid Smaller and spread farther. Ultrasonic sensors utilize these characteristics of ultrasonic waves. Ultrasonic sensors have the characteristics of large sensitive range, no visual blind zone, and no interference from obstacles. It is the most effective way to detect the movement of small objects.

ULTD5N-350型超声波传感器,可提供3cm--3.5m的非接触式距离感测功能,其包括了超声波发射器、接收器与控制电路。其基本工作原理为给予此超声波传感器一触发信号后发射超声波,当超声波投射到物体而反射回来时,模块输出一回响信号,以触发信号和回响信号间的时间差,来判定物体的距离。ULTD5N-350 ultrasonic sensor can provide 3cm--3.5m non-contact distance sensing function, which includes ultrasonic transmitter, receiver and control circuit. Its basic working principle is to give the ultrasonic sensor a trigger signal and then emit ultrasonic waves. When the ultrasonic waves are projected to the object and reflected back, the module outputs an echo signal to determine the distance of the object based on the time difference between the trigger signal and the echo signal.

通过时序图对上述超声波传感器进行感应的原理进行说明,请参阅图3的时序图可知,从上面的模块时序图可以看出,只需要提供一个短期的10uS脉冲触发信号,超声波传感器即可进行距离测量工作。超声波传感器被触发后,超声波传感器发射头将发出8个40kHz周期电平,同时检测回波。一旦检测到有回波信号则输出回响信号。回响信号是一个脉冲的宽度成正比的距离对象。可通过发射信号到收到的回响信号时间间隔可以计算得到距离。在本实施例中,测量周期为60ms或大于60ms,以防止发射信号对回响信号的影响。The principle of the above-mentioned ultrasonic sensor sensing is described through the timing diagram. Please refer to the timing diagram in Figure 3. From the timing diagram of the above module, it can be seen that only a short-term 10uS pulse trigger signal is provided, and the ultrasonic sensor can perform distance detection. Measure work. After the ultrasonic sensor is triggered, the ultrasonic sensor transmitter will send out 8 40kHz cycle levels and detect the echo at the same time. Once an echo signal is detected, an echo signal is output. An echo signal is a pulse whose width is proportional to the distance from the object. The distance can be calculated from the time interval between the transmitted signal and the received echo signal. In this embodiment, the measurement period is 60 ms or greater than 60 ms to prevent the influence of the transmitted signal on the echo signal.

另外,开发模块采用Arduino ProMini,为Arduino Mini(为Arduino的最简洁微型版本,Arduino一款便捷灵活、方便上手的开源电子原型平台)的半定制版本,所有外部引脚通孔没有焊接,与Mini版本管脚兼容。Arduino ProMini的处理器核心是ATmega168,同时具有14路数字输入/输出口(其中6路可作为PWM输出),工作电压5V,输入电压5-12V,IO脚(输入输出脚)直流电流40mA,Flash Memory(闪存)的存储大小为16KB(其中2KB用于bootloader,即启动装载),SRAM(静态随机存储器)的存储为1KB(ATmega328),EEPROM(带电可擦可编程只读存储器)的存储为0.5KB(ATmega328),工作时钟16MHz。为了保证信号的精准,在超声波接收器与处理器之间设计一个RC滤波电路,用于过滤除干扰信号,有效的抑制尖峰噪声。RC滤波电路具体如图2所示。图中两个二极管起到限幅作用,把引脚电压限制在0V和5V之间保护ATmega168处理器。In addition, the development module uses Arduino ProMini, which is a semi-customized version of Arduino Mini (the most concise miniature version of Arduino, a convenient, flexible, and easy-to-use open source electronic prototype platform for Arduino). All external pin through holes are not soldered. Versions are pin compatible. The processor core of Arduino ProMini is ATmega168, and it has 14 digital input/output ports (6 of which can be used as PWM output), working voltage 5V, input voltage 5-12V, IO pin (input and output pin) DC current 40mA, Flash The storage size of Memory (flash memory) is 16KB (of which 2KB is used for bootloader, that is, boot loading), the storage of SRAM (static random access memory) is 1KB (ATmega328), and the storage of EEPROM (electrically erasable programmable read-only memory) is 0.5 KB (ATmega328), working clock 16MHz. In order to ensure the accuracy of the signal, an RC filter circuit is designed between the ultrasonic receiver and the processor to filter out the interference signal and effectively suppress the spike noise. The RC filter circuit is shown in Figure 2 in detail. The two diodes in the figure play the role of limiting, limiting the pin voltage between 0V and 5V to protect the ATmega168 processor.

本实施例中的电子乐器进行感应击打物的过程具体如下:The electronic musical instrument in this embodiment senses the process of striking objects as follows:

首先将整个电子乐器上电,即处理器(本实施例中为ATMEGA168处理器)以及各非接触式传感器分别上电,ATMEGA168处理器的复位管脚被拉低,ATMEGA168处理器进行系统上电复位工作,复位时间为20ms。复位完成之后,进行系统的初始化引导,它完成控制系统内核、全局参数以及各个外设的初始化。系统初始化引导模块完成如下功能:初始化ATMEGA168处理器内部寄存器、处理器、存储器等硬件资源的自测试功能、IO引脚和各个外设(AD,SCI,EVM)硬件资源的初始化以及系统变量的初始化以及中断初始化。系统初始化完成后,系统进入待机工作模式,一旦收到上位机发送的指令,即处理器接收到工作指令时,可触发传感器迅速进入工作模式。工作模式中,ATmega168处理器对超声波传感器的控制分为三部分:多传感器分组触发、A/D采样和数据处理。具体过程如下:First, the entire electronic musical instrument is powered on, that is, the processor (ATMEGA168 processor in this embodiment) and each non-contact sensor are powered on respectively, the reset pin of the ATMEGA168 processor is pulled low, and the ATMEGA168 processor performs a system power-on reset work, the reset time is 20ms. After the reset is completed, the system is initialized and guided, which completes the initialization of the control system kernel, global parameters and various peripherals. The system initialization guide module completes the following functions: initialization of ATMEGA168 processor internal registers, self-test function of hardware resources such as processor and memory, initialization of IO pins and hardware resources of various peripherals (AD, SCI, EVM), and initialization of system variables and interrupt initialization. After the system initialization is completed, the system enters the standby working mode. Once the command sent by the host computer is received, that is, when the processor receives the working command, it can trigger the sensor to quickly enter the working mode. In the working mode, the ATmega168 processor divides the control of the ultrasonic sensor into three parts: multi-sensor group trigger, A/D sampling and data processing. The specific process is as follows:

处理器在接收到工作指令时,开定时器中断,定时器每隔10ms产生一次中断指令,在中断指令中,设计一个计数值PT2,初始值为0,每当进入一次中断便对自己进行一次自增运算。同时触发一组超声波传感器,每当PT2的值自增到20时,重新初始为0,并对下一组的超声波传感器进行触发。通过这种方式实现每200ms轮流触发一组超声波传感器。在本实施例中,超声波传感器总共分为三组,因此实现所有传感器触发一个周期的时间是600ms。实现传感器的触发后,便是对传感器返回数据进行A/D采样。ATMEGA168处理器片内自带14路10位模数转换器,最小转换时间为500ns。When the processor receives the work instruction, it starts the timer interrupt, and the timer generates an interrupt instruction every 10ms. In the interrupt instruction, design a count value PT2, the initial value is 0, every time it enters an interrupt, it will perform an interrupt on itself once. Auto-increment operation. Trigger a group of ultrasonic sensors at the same time. Whenever the value of PT2 increases to 20, it is reset to 0 and triggers the next group of ultrasonic sensors. In this way, a group of ultrasonic sensors are triggered in turn every 200ms. In this embodiment, the ultrasonic sensors are divided into three groups, so the time for all the sensors to trigger one cycle is 600 ms. After the triggering of the sensor is realized, A/D sampling is performed on the data returned by the sensor. The ATMEGA168 processor comes with 14 channels of 10-bit analog-to-digital converters on-chip, and the minimum conversion time is 500ns.

具体地,本实施采用7路A/D采样,所以将A/D模块配置为级联模式,同时寄存器MAXCONV=9(寄存器最大转换通道为9),A/D模块的触发模式为中断触发。由于超声波发射和返回之间需要一定时间,时间计算如下:测量最大距离为4m,假设超声波的速度为340m/s,考虑到往返,时间需要再乘以2,最终结果是19ms,留一定的余量,将触发与A/D采样之间的间隔确定为20ms。所以当PT2的值为4时,即中间间隔为50ms的时候,打开A/D采样模块,实现采样功能。超声波传感器返回的是模拟电压量,经过A/D转换后得到的值是一个和距离成正线性关系的数值,而不是传感器与周围物体的距离值,然后将A/D转换后的数值再转换成真正的距离值。此算法过程如下:由于A/D采样值与距离成正线性关系,且采样值的最大值和最小值与距离的最大值最小值一一对应,所以通过最大值和最小值两点坐标可以求出直线的方程,将本次A/D转换值带入方程,即可得出与此值相对应的距离值。采样值与距离值的函数关系如图4所示。Specifically, this implementation uses 7-way A/D sampling, so the A/D module is configured as a cascade mode, and the register MAXCONV=9 (the maximum conversion channel of the register is 9), and the trigger mode of the A/D module is interrupt trigger. Since it takes a certain amount of time between ultrasonic emission and return, the time calculation is as follows: the maximum measurement distance is 4m, assuming that the ultrasonic speed is 340m/s, considering the round trip, the time needs to be multiplied by 2, and the final result is 19ms, leaving a certain margin The amount, the interval between trigger and A/D sampling is determined as 20ms. Therefore, when the value of PT2 is 4, that is, when the intermediate interval is 50ms, the A/D sampling module is turned on to realize the sampling function. The ultrasonic sensor returns an analog voltage, and the value obtained after A/D conversion is a value that has a positive linear relationship with the distance, rather than the distance value between the sensor and the surrounding objects, and then converts the value after A/D conversion into The real distance value. The process of this algorithm is as follows: Since the A/D sampling value has a positive linear relationship with the distance, and the maximum and minimum values of the sampling value correspond to the maximum and minimum values of the distance, so the coordinates of the maximum and minimum values can be calculated For the equation of a straight line, bring the A/D conversion value into the equation to obtain the corresponding distance value. The functional relationship between the sampling value and the distance value is shown in Figure 4.

另外,由于超声波传感器测距中必然会有误差造成精度的不准而且还可能会有一些偏离真实距离较大的异常值出现。由于机器人周围的环境是不确定并且是动态的,所以传感器测量值有可能因为环境的突变而产生突变。为了区别出此值是异常值还是正常的突变值,本实施例中采用算术平均滤波法,记录下来之前N次数值,求取平均值,当本次数值与平均值在一定的差额之内被视为有效,如果在差额之外则视为无效值,予以剔除。算术平均滤波法有如下特性:N值较大时,信号平滑度较高,但灵敏度较低,N值较小时,信号平滑度较低,但灵敏度较高。在本实施例中,对系统的灵敏度要求比较高。而干扰信号是随机出现的极大的值,所以对信号平滑度要求较低,因此在这里选择一个较小的N值,本论文中N的值为3,可以很好的满足系统的要求。In addition, due to the inevitable error in the distance measurement of the ultrasonic sensor, the accuracy is not accurate, and there may be some outliers that deviate from the real distance. Since the environment around the robot is uncertain and dynamic, the sensor measurement values may have sudden changes due to sudden changes in the environment. In order to distinguish whether this value is an abnormal value or a normal mutation value, the arithmetic mean filter method is used in this embodiment to record the previous N times of values and calculate the average value. When the current value and the average value are within a certain difference It is regarded as valid, and if it is outside the difference, it is regarded as an invalid value and will be eliminated. The arithmetic mean filtering method has the following characteristics: when the N value is large, the signal smoothness is high, but the sensitivity is low; when the N value is small, the signal smoothness is low, but the sensitivity is high. In this embodiment, the requirement for the sensitivity of the system is relatively high. The interference signal is a very large value that appears randomly, so the requirement for smoothness of the signal is low, so a small N value is selected here. The value of N in this paper is 3, which can well meet the requirements of the system.

上述电子乐器,在主体的不同位置上安装多个超声波传感器,使用ATMEGA168处理器控制这些传感器的分组轮流触发、数据采集、数据处理,从而构建一个多超声波传感器触发的系统。本系统具有成本低、精度高、实时性好的优点。可以应用于电子乐器领域,为丰富多彩的电子器件设计提供可靠的依据。For the electronic musical instruments mentioned above, multiple ultrasonic sensors are installed on different positions of the main body, and the ATMEGA168 processor is used to control the grouping triggering, data collection, and data processing of these sensors in turn, thereby constructing a multi-ultrasonic sensor triggering system. The system has the advantages of low cost, high precision and good real-time performance. It can be applied to the field of electronic musical instruments, and provides a reliable basis for the design of colorful electronic devices.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.

以上实施例仅表达了本发明的几种实施例,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above embodiments only express several embodiments of the present invention, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the patent scope of the invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.

Claims (10)

1.一种电子乐器,其特征在于,包括主体、处理器以及至少两个传感器组,各所述传感器组分别设置于所述主体,任意一个所述传感器组中包括至少两个非接触式传感器,各所述传感器组中各所述非接触式传感器分别与所述处理器连接;其中,各所述非接触式传感器分别对应身份标识;1. An electronic musical instrument, characterized in that it comprises a main body, a processor and at least two sensor groups, each of the sensor groups is respectively arranged on the main body, and any one of the sensor groups includes at least two non-contact sensors , each of the non-contact sensors in each of the sensor groups is respectively connected to the processor; wherein each of the non-contact sensors corresponds to an identity mark; 所述处理器在接收到工作指令时,开始计时,并将各所述传感器组中的任意一个传感器组作为当前传感器组,触发所述当前传感器组工作,发射第一信号,所述当前传感器组中所述非接触式传感器在开始计时后的预设时长范围内接收到发射的所述第一信号对应的第一返回信号时,所述处理器根据所述第一返回信号的接收时间以及所述第一信号的发射时间获取第一击打距离,并在接收到所述第一返回信号的预设阈值时长后触发所述非接触式传感器发射第二信号,在所述预设时长范围内接收到发射的所述第二信号对应的第二返回信号时,所述处理器根据所述第二返回信号的接收时间以及所述第二信号的发射时间获取第二击打距离,根据所述第一击打距离、第二击打距离以及所述预设阈值时长获取击打速度,所述处理器根据所述非接触式传感器的身份标识以及所述击打速度,发出与所述身份标识对应音色的、且与所述击打速度对应音量的声音,当所述处理器预先设置的计数器的计数值达到预设次数时,所述计时时长达到所述预设时长,停止所述当前传感器组发射信号,所述计数器的计数值清零,重新开始计时,并将各所述传感器组中除所述当前传感器组之外的任意一个所述传感器组作为所述当前传感器组,返回执行所述触发所述当前传感器组发射信号;When the processor receives the work instruction, it starts timing, and uses any sensor group in each of the sensor groups as the current sensor group, triggers the current sensor group to work, and emits a first signal, and the current sensor group When the non-contact sensor receives the first return signal corresponding to the transmitted first signal within the preset time period after starting the timing, the processor according to the receiving time of the first return signal and the Acquire the first striking distance according to the emission time of the first signal, and trigger the non-contact sensor to emit the second signal after receiving the preset threshold duration of the first return signal, within the preset duration range When receiving the second return signal corresponding to the transmitted second signal, the processor acquires the second striking distance according to the receiving time of the second return signal and the transmitting time of the second signal, according to the The first striking distance, the second striking distance and the preset threshold duration obtain the striking speed, and the processor sends out a When the count value of the counter preset by the processor reaches the preset number of times corresponding to the sound of the timbre and the volume corresponding to the hitting speed, the timing duration reaches the preset duration, and the current sensor is stopped. The group emits a signal, the count value of the counter is cleared, and the timing is restarted, and any one of the sensor groups except the current sensor group in each of the sensor groups is used as the current sensor group, and the execution process is returned. triggering the current sensor group to transmit a signal; 其中,所述计数器的计数值初始为零,所述处理器在接收到所述工作指令时,每隔预设间隔时间,产生一次中断指令,每接收到一次中断指令,将所述计数值增1。Wherein, the count value of the counter is initially zero, and when the processor receives the work command, it generates an interrupt command every preset interval time, and increments the count value every time an interrupt command is received. 1. 2.根据权利要求1所述的电子乐器,其特征在于,任意一个所述传感器组中各所述非接触式传感器之间的距离大于预设防干扰距离。2. The electronic musical instrument according to claim 1, characterized in that, the distance between the non-contact sensors in any one of the sensor groups is greater than the preset anti-interference distance. 3.根据权利要求1所述的电子乐器,其特征在于,在所述停止所述当前传感器组工作的预设触发间隔时间后,计时清零。3. The electronic musical instrument according to claim 1, characterized in that, after the preset trigger interval time for stopping the operation of the current sensor group, the timer is reset. 4.根据权利要求1所述的电子乐器,其特征在于,所述预设阈值时长小于所述预设时长。4. The electronic musical instrument according to claim 1, wherein the preset threshold duration is shorter than the preset duration. 5.根据权利要求1所述的电子乐器,其特征在于,所述非接触式传感器为超声波传感器。5. The electronic musical instrument according to claim 1, wherein the non-contact sensor is an ultrasonic sensor. 6.根据权利要求1所述的电子乐器,其特征在于,所述非接触式传感器包括超声波发射器以及超声波接收器,所述处理器分别与所述超声波发生器以及所述超声波接收器连接;6. The electronic musical instrument according to claim 1, wherein the non-contact sensor includes an ultrasonic transmitter and an ultrasonic receiver, and the processor is connected to the ultrasonic generator and the ultrasonic receiver respectively; 在所述触发所述当前传感器组工作,发射第一信号中,通过分别触发所述当前传感器组中各非接触式传感器的超声波发送器发射超声波信号;In the process of triggering the current sensor group to work and transmitting the first signal, the ultrasonic transmitters of the non-contact sensors in the current sensor group are respectively triggered to emit ultrasonic signals; 通过所述超声波接收器接收所述第一信号对应的第一返回信号,所述第一返回信号为所述第一超声波信号对应的返回信号。A first return signal corresponding to the first signal is received by the ultrasonic receiver, and the first return signal is a return signal corresponding to the first ultrasonic signal. 7.根据权利要求6所述的电子乐器,其特征在于,还包括滤波电路,所述超声波接收器通过所述滤波电路与所述处理器连接。7. The electronic musical instrument according to claim 6, further comprising a filter circuit, the ultrasonic receiver is connected to the processor through the filter circuit. 8.根据权利要求1所述的电子乐器,其特征在于,所述处理器在接收到停止指令时,停止各所述传感器组工作。8. The electronic musical instrument according to claim 1, wherein the processor stops the operation of each of the sensor groups when receiving a stop command. 9.根据权利要求1所述的电子乐器,其特征在于,所述传感器组的数量为三个,包括第一传感器组、第二传感器组以及第三传感器组,所述第一传感器组中所述非接触式传感器的数量为三个,所述第二传感器组以及所述第三传感器组中所述非接触式传感器的数量分别为两个。9. The electronic musical instrument according to claim 1, wherein the number of the sensor groups is three, including a first sensor group, a second sensor group and a third sensor group, and all the sensor groups in the first sensor group The number of the non-contact sensors is three, and the number of the non-contact sensors in the second sensor group and the third sensor group is two respectively. 10.根据权利要求1所述的电子乐器,其特征在于,还包括分别与所述处理器连接的第一发声装置以及第二发声装置,所述第一发声装置以及所述第二发声装置相对设置于所述主体,在所述处理器发出对应声音中,所述处理器分别通过第一发声装置以及所述第二发声装置发出对应声音。10. The electronic musical instrument according to claim 1, further comprising a first sounding device and a second sounding device respectively connected to the processor, the first sounding device and the second sounding device are opposite to each other It is arranged on the main body, and when the processor emits the corresponding sound, the processor emits the corresponding sound through the first sound generating device and the second sound generating device respectively.
CN201711480700.5A 2017-12-29 2017-12-29 Electronic musical instrument Expired - Fee Related CN107945778B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711480700.5A CN107945778B (en) 2017-12-29 2017-12-29 Electronic musical instrument

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711480700.5A CN107945778B (en) 2017-12-29 2017-12-29 Electronic musical instrument

Publications (2)

Publication Number Publication Date
CN107945778A CN107945778A (en) 2018-04-20
CN107945778B true CN107945778B (en) 2023-04-07

Family

ID=61938016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711480700.5A Expired - Fee Related CN107945778B (en) 2017-12-29 2017-12-29 Electronic musical instrument

Country Status (1)

Country Link
CN (1) CN107945778B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108735191B (en) * 2018-08-24 2023-11-03 张洋 Non-contact percussion instrument
CN111754966B (en) * 2019-03-26 2025-06-27 曾耀君 Electronic musical instrument and method of using the same
CN113409748A (en) * 2021-07-13 2021-09-17 武汉东南乾丰恒裕工程有限责任公司 Ultrasonic string-free musical instrument for enlightenment teaching
CN114203134B (en) * 2021-12-14 2025-04-08 李红育 A method for removing interference from a dumb drum hitting signal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105161088A (en) * 2015-09-30 2015-12-16 得理电子(上海)有限公司 Capacitive-touch-based detection apparatus, and vibration detection system and method of electronic musical instrument
JP2017062358A (en) * 2015-09-25 2017-03-30 カシオ計算機株式会社 Sound control apparatus, method, program, and electronic musical instrument

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5567902A (en) * 1995-01-06 1996-10-22 Baldwin Piano And Organ Company Method and apparatus for optically sensing the position and velocity of piano keys
JP4135275B2 (en) * 1998-10-05 2008-08-20 ヤマハ株式会社 Speed detection apparatus and speed detection method
JP3772674B2 (en) * 2001-01-25 2006-05-10 ヤマハ株式会社 Electronic percussion instrument
CN100474289C (en) * 2003-09-19 2009-04-01 欧姆龙株式会社 Connected sensor system
JP4244916B2 (en) * 2004-12-06 2009-03-25 ヤマハ株式会社 Pronunciation control method based on performance prediction and electronic musical instrument
CN103890592B (en) * 2011-11-14 2018-01-30 富士通株式会社 Electronic installation, portable terminal device and measurement of velocity method
CN103192769B (en) * 2012-01-10 2015-04-01 上海工程技术大学 Vehicle safety volume adjustment system
JP5949879B2 (en) * 2014-11-17 2016-07-13 カシオ計算機株式会社 Touch detection device, touch detection method, and electronic musical instrument
CN106802715A (en) * 2016-12-30 2017-06-06 珠海市魅族科技有限公司 Electronic equipment and its method for sensing
CN107464548A (en) * 2017-08-03 2017-12-12 京东方科技集团股份有限公司 Contactless music sensing device and musical performance method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017062358A (en) * 2015-09-25 2017-03-30 カシオ計算機株式会社 Sound control apparatus, method, program, and electronic musical instrument
CN105161088A (en) * 2015-09-30 2015-12-16 得理电子(上海)有限公司 Capacitive-touch-based detection apparatus, and vibration detection system and method of electronic musical instrument

Also Published As

Publication number Publication date
CN107945778A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN107945778B (en) Electronic musical instrument
US5308936A (en) Ultrasonic pen-type data input device
Morgan HC-SR04 ultrasonic sensor
CN105300508A (en) Double-threshold detection circuit of ultrasonic wave signal propagation time, and detection method
CN118012287A (en) Ultrasonic touch sensor using capacitive crosstalk
CN207181685U (en) A kind of supersonic range finder
US20240393906A1 (en) Under water touch detection with ultrasonic sensors using capacitive micromachined ultrasonic transducers (cmuts)
CN2784945Y (en) Ultrasonic distance-measuring sensor
WO2022185025A1 (en) Motion tracking using pure tones
CN104614732A (en) Chaotic light ranging technology based anti-collision signal processing system and method
CN1120980C (en) Method of reducing blind zone of supersonic range finder
Akpan et al. The Development of an Enhanced Obstacle Detection System with Alarm Based on the Internet-of-Things
CN205843765U (en) A kind of sensor-based liquid level measuring system
JP2004138481A (en) Position measuring device and robot using it
CN202534185U (en) Echo sounding simulator
Zhi et al. Design of distance measuring and reversing system
CN104880512A (en) Temperature-compensation ultrasonic surface wave-based lithosphere state real-time detection system
EP1108224A2 (en) Method and system for measuring the distance from a piezoelectric element
CN219319571U (en) Sound velocity measuring circuit of time leap type sound velocity meter
Saraf et al. An IVR based intelligent guidance stick for blind
CN202587178U (en) Television anti-myopia early warning system based on ultrasonic ranging
CN221841206U (en) Multifunctional vision protection system based on single chip microcomputer
US20250190077A1 (en) Ultrasonic touch sensor with water detection
Ma et al. The research of MCU ultrasonic range finder
CN118151744A (en) Underwater touch detection with ultrasonic sensor using Capacitive Micromachined Ultrasonic Transducer (CMUT)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20230407