CN109994130B - Tone playing method, device and readable storage medium - Google Patents

Tone playing method, device and readable storage medium Download PDF

Info

Publication number
CN109994130B
CN109994130B CN201910265455.9A CN201910265455A CN109994130B CN 109994130 B CN109994130 B CN 109994130B CN 201910265455 A CN201910265455 A CN 201910265455A CN 109994130 B CN109994130 B CN 109994130B
Authority
CN
China
Prior art keywords
tone
frequency
stage
calculating
descending
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.)
Active
Application number
CN201910265455.9A
Other languages
Chinese (zh)
Other versions
CN109994130A (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.)
Shanghai Nanhua Electronics Co ltd
Original Assignee
Shanghai Nanhua Electronics Co ltd
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 Shanghai Nanhua Electronics Co ltd filed Critical Shanghai Nanhua Electronics Co ltd
Priority to CN201910265455.9A priority Critical patent/CN109994130B/en
Publication of CN109994130A publication Critical patent/CN109994130A/en
Application granted granted Critical
Publication of CN109994130B publication Critical patent/CN109994130B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08BSIGNALLING OR CALLING SYSTEMS; ORDER TELEGRAPHS; ALARM SYSTEMS
    • G08B3/00Audible signalling systems; Audible personal calling systems
    • G08B3/10Audible signalling systems; Audible personal calling systems using electric transmission; using electromagnetic transmission
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • G11B2020/10537Audio or video recording
    • G11B2020/10546Audio or video recording specifically adapted for audio data
    • G11B2020/10555Audio or video recording specifically adapted for audio data wherein the frequency, the amplitude, or other characteristics of the audio signal is taken into account
    • G11B2020/10564Audio or video recording specifically adapted for audio data wherein the frequency, the amplitude, or other characteristics of the audio signal is taken into account frequency

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Electromagnetism (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Alarm Systems (AREA)
  • Telephone Function (AREA)

Abstract

The invention provides a tone playing method, a device and a readable storage medium, which relate to the technical field of tone alarm and comprise the steps of reading specific attributes of tones, wherein the specific attributes comprise tone characteristic parameters corresponding to tone types and the tone types, the tone types comprise a continuously-changing alarm tone and a non-continuously-changing alarm tone, the tone characteristic parameters comprise duty ratio, starting frequency, ending frequency, rising time and falling time, the duty ratio is used for determining the volume of the tones, the starting frequency and the ending frequency are used for determining the frequency change range of the tones, and the rising time and the falling time are used for determining the frequency change speed of the tones; calculating the segmented frequency of the tone according to the specific attribute; and PWM waves are generated according to the segmented frequency and the duty ratio, and the playing device is driven by the PWM waves to play the tones, so that the tone difference in the transplanting process of the controller is greatly reduced.

Description

Tone playing method, device and readable storage medium
Technical Field
The present invention relates to the field of tone alarm technology, and in particular, to a tone playing method, device and readable storage medium.
Background
The sound alarm is widely applied to various application devices such as industrial instruments, automation equipment, engineering machinery, special vehicles and the like, and the sound alarms adopted by the application devices of different types can define respective standards in the aspects of sound alarm modes, tone combinations and the like, namely, different tones correspond to corresponding types of faults so that users or the devices can know the fault conditions according to the tones. Even the alert sounds presented at different clients for the same tone combination criteria have considerable differences.
At present, various tones of sound source are by storage package in the controller like the singlechip, and old, damage appear in control circuit or controller in the alarm, when the condition that needs to be changed, the tone that the alarm produced after the change can change, and user or equipment can not know clearly what kind of trouble of tone correspondence this moment for audible alarm loses the usefulness.
Disclosure of Invention
In view of the above, the present invention provides a tone playing method, apparatus and readable storage medium, which can greatly reduce the tone difference during the controller migration process.
In a first aspect, an embodiment of the present invention provides a tone playing method, including:
reading specific attributes of a tone, wherein the specific attributes comprise a tone type and tone characteristic parameters corresponding to the tone type, the tone type comprises a continuous change alarm tone and a discontinuous change alarm tone, the tone characteristic parameters comprise a duty ratio, a starting frequency, an ending frequency, a rising time and a falling time, the duty ratio is used for determining the volume size of the tone, the starting frequency and the ending frequency are used for determining the frequency change range of the tone, and the rising time and the falling time are used for determining the frequency change speed of the tone;
calculating the segmented frequency of the tone according to the specific attribute;
and generating a PWM wave according to the segmented frequency and the duty ratio, and driving a playing device to play the tone through the PWM wave.
With reference to the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, where calculating a segmented frequency of the tone according to the specific attribute includes:
determining the pitch type of the pitch;
if the tone type is a discontinuous change alert tone, the segment frequency of the tone includes the start frequency for the rise time and the end frequency for the fall time;
and if the tone type is a continuously-changing alarm tone, calculating the segment frequency of the tone according to the tone characteristic parameter.
With reference to the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, where if the tone type is a continuously variable alarm tone, calculating a segment frequency of the tone according to the tone characteristic parameter includes:
when the tone type is a continuously variable warning tone;
judging whether the current state is in an ascending stage or a descending stage according to the starting frequency and the ending frequency;
if the current stage is in the rising stage, calculating the increased frequency of the rising stage according to the tone characteristic parameter of the rising stage, and obtaining the segmented frequency of the rising stage according to the increased frequency of the rising stage;
if the current stage is in a descending stage, calculating the descending frequency of the descending stage according to the tone characteristic parameters of the descending stage, and obtaining the segmented frequency of the descending stage according to the descending frequency of the descending stage.
With reference to the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect, wherein calculating a frequency of growth of the ascending phase according to the pitch characteristic parameter of the ascending phase includes:
calculating the frequency of the rise phase increase according to:
df=((Ft-Fs)/Tu)*t
wherein df is the frequency of the increase of the rise phase, Ft is the end frequency, Fs is the start frequency, Tu is the rise time, and t is a time variable.
With reference to the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect, where calculating a reduced frequency of the descent phase according to the pitch characteristic parameter of the descent phase includes:
calculating the decreasing frequency of the decreasing phase according to:
df=((Ft-Fs)/Td)*t
where df is the reduced frequency of the falling phase, Ft is the ending frequency, Fs is the starting frequency, Td is the falling time, and t is a time variable.
With reference to the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where obtaining the segmented frequency of the ascending phase according to the increased frequency of the ascending phase includes:
calculating the segment frequency of the rise phase according to the following formula:
F=df+Fs
and df is the increased frequency of the ascending stage, Fs is the starting frequency, and F is the segment frequency of the ascending stage.
With reference to the first aspect, an embodiment of the present invention provides a sixth possible implementation manner of the first aspect, where obtaining the segmented frequency of the descending stage according to the reduced frequency of the descending stage includes:
calculating the segment frequency of the descent phase according to:
F=Ft-df
and d is the reduced frequency of the descending stage, Ft is the ending frequency, and F is the segmentation frequency of the descending stage.
With reference to the first aspect, an embodiment of the present invention provides a seventh possible implementation manner of the first aspect, where reading a specific attribute of a tone includes:
acquiring a data packet, and analyzing the data packet to obtain the specific attribute of the tone;
or the like, or, alternatively,
the specific properties of the tone stored in volatile memory are read.
In a second aspect, an embodiment of the present invention further provides a tone playing apparatus, including:
a reading unit, configured to read specific attributes of a tone, where the specific attributes include a tone type and tone characteristic parameters corresponding to the tone type, the tone type includes a continuously-changing warning tone and a non-continuously-changing warning tone, the tone characteristic parameters include a duty cycle, a start frequency, an end frequency, a rise time, and a fall time, the duty cycle is used to determine a volume size to which the tone belongs, the start frequency and the end frequency are used to determine a frequency change range of the tone, and the rise time and the fall time are used to determine a frequency change speed of the tone;
the calculating unit is used for calculating the segmented frequency of the tone according to the specific attribute;
and the playing unit is used for generating PWM waves according to the segmented frequency and driving a playing device to play the tones through the PWM waves.
In a third aspect, the present invention further provides a readable storage medium, in which a computer program is stored, and when the computer program is executed, the computer program implements the tone playing method described above.
The invention provides a tone playing method, a device and a readable storage medium, when controllers such as a singlechip and the like are used as a sound source to drive, the difference of the tone after upgrading or replacing of the singlechip is larger, the embodiment of the invention defines specific attributes of the tone, comprises the tone type and the corresponding tone characteristic parameters, qualitatively determines the tone, calculates the segment frequency of the tone according to the specific attributes, generates corresponding PWM waves through the segment frequency and the duty ratio in the specific attributes, and drives a playing device to play the tone, so that the tone after qualitative in the way can furthest reduce the difference of the tone when transplanting codes or upgrading products, and reduces the cost increased by updating.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart of a tone playing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating the frequency variation of a continuously varying alarm tone according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating the frequency variation of a non-continuous variation alarm tone according to an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating the frequency variation of a continuously varying alarm tone during the rise phase according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating the frequency change of a continuously changing alarm tone during a descent phase according to an embodiment of the present invention;
FIG. 6 is a functional block diagram of a tone reproduction apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Icon: 100-an electronic device; 10-a reading unit; 20-a computing unit; 30-a playback unit; 50-a processor; 51-a memory; 52-a bus; 53-communication interface.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
At present, because the updating and upgrading speed of control equipment such as a single chip microcomputer is high, when tone is replaced by the controller equipment, the model of the replaced control equipment is often not ensured to be consistent with that of the original control equipment. When the controller model versions applied before and after the alarm are different, the tone can be different.
The existing tone is because the starting frequency and the ending frequency of the tone are often only defined in the process program of the control chip, and the timer is gradually accumulated from the starting frequency to the ending frequency according to the increment value according to the set increment value in a semi-analog mode. The operation frequencies of the single-chip microcomputers of different models and versions used before and after the alarm are different, and the single-chip microcomputers are accumulated for a plurality of times from the starting frequency to the ending frequency, so that a large error is caused, the tone difference before and after the single-chip microcomputer controller is replaced is large (the difference can be recognized by human ears), and the fault type cannot be accurately recognized.
Based on this, the tone playing method, the device and the readable storage medium provided by the embodiments of the present invention greatly reduce the tone difference in the controller migration process.
To facilitate understanding of the present embodiment, a detailed description will be given of a tone storage method disclosed in the present embodiment.
Fig. 1 is a flowchart illustrating a tone playing method according to an embodiment of the present invention.
Referring to fig. 1, the tone playing method may include the steps of:
step S110, reading specific attributes of the tone, wherein the specific attributes comprise a tone type and tone characteristic parameters corresponding to the tone type, the tone type comprises a continuously-changing alarm tone and a discontinuously-changing alarm tone, the tone characteristic parameters comprise a duty ratio, a starting frequency, an ending frequency, a rising time and a falling time, the duty ratio is used for determining the volume of the tone, the starting frequency and the ending frequency are used for determining the frequency change range of the tone, and the rising time and the falling time are used for determining the frequency change speed of the tone;
alarm tones are taken as a general broad class, and in order to distinguish whether the type of alarm tone belongs to a non-continuously varying alarm tone type or a continuously varying alarm tone type, an attribute is required to distinguish, so we define the tone characteristic (property). Meanwhile, in order to identify the tone characteristic, a conclusion is drawn according to five tone characteristic parameters. Since the volume level affects the sound frequency, an attribute is required to determine the volume characteristic, and the pitch characteristic parameter is Duty Cycle (Duty Cycle); the tone comprises a single segment or multiple segments, a Frequency change process is generated for a complete single-segment alarm tone, two segments of alarm tones which change continuously or two segments of discontinuous alarm tones, different tones are formed according to different Frequency change ranges and different Frequency change speeds in the process (the Frequency change speed is a fixed value as defined by the tone), and the Frequency change ranges are determined by two tone characteristic parameters, namely, a Start Frequency (Start Frequency), an end Frequency (Stop Frequency), and the Frequency change speeds and speeds need two tone characteristic parameters to determine, namely, a rise Time (Go Up Time) and a fall Time (Go Down Time).
Step S120, calculating the segmentation frequency of the tone according to the specific attribute;
and step S130, generating PWM waves according to the segmented frequency and the duty ratio, and driving the playing device to play the tone through the PWM waves.
In the preferred embodiment of the practical application, when a controller such as a singlechip is used as a sound source for driving, the difference of the upgraded or replaced tones of the singlechip is large, the embodiment of the invention defines specific attributes of the tones, including the tone types and the corresponding tone characteristic parameters, characterizes the tones, calculates the segment frequency of the tones according to the specific attributes, generates corresponding PWM waves through the segment frequency and the duty ratio in the specific attributes, and drives a playing device to play the tones, so that the tone after the qualitative processing in the manner can reduce the difference of the tones to the greatest extent and reduce the cost increased by updating when transplanting codes or upgrading products.
In addition, the embodiment of the invention adopts an object mode programming mode, the tone is modularized, and various alarm tones can be defined by the tone type and different settings of the tone characteristic parameters. The tone only needs to preset six parameters, the required storage space is small, and various tones can be defined as long as the storage space allows, so that the purpose of tone diversification is realized.
For example, in the existing lower-end 8-bit single chip microcomputer (8Kbyte), 32 tones (each tone occupies 10 bytes of the memory) can be defined according to the embodiment of the present invention, and the current mainstream single chip microcomputer can define more kinds of tones.
As an alternative embodiment, step S110 in the above embodiment includes:
step S210, acquiring a data packet, and analyzing the data packet to obtain the specific attribute of the tone;
here, the specific attribute of the tone may be encapsulated in advance to obtain a packet, and the packet may be stored in a read only memory such as a magnetic disk or a ROM. When the tone is required to be played, the data packet can be obtained from the memory according to the control signal of the controller main control chip, and the data packet is analyzed to obtain the specific attribute of the tone.
Or the like, or, alternatively,
in step S220, the specific attribute of the tone stored in the volatile memory is read.
Here, the specific attribute of the tone may be written in advance in a volatile memory such as a register, a memory, or the like, and when the tone is required to be played, the specific attribute of the tone may be called from the volatile memory according to a control signal of the controller main control chip.
In order to more accurately and rapidly acquire the segment frequency of the tone, step S120 further includes:
step S310, judging the tone type of the tone;
in which the continuously changing alarm tone is shown in fig. 2, the start frequency is set to 2400Hz, the end frequency is set to 2900Hz, the rise time is set to 500ms, and the fall time is set to 500ms, i.e., the rise time from the start frequency to the end frequency is 0.5S, and the fall time from the end frequency to the start frequency is 0.5S, and the tone with this characteristic change is set as the continuously changing alarm tone.
Here, the discontinuous change alarm tone sets the start frequency to 2400Hz, the end frequency to 2900Hz, the rise time of the continuous end frequency to 500ms, the fall time of the continuous start frequency to 500ms, and the tone of which characteristic changes to the discontinuous change alarm tone, as shown in fig. 3.
Step S320, if the tone type is a discontinuous change alarm tone, the segment frequency of the tone comprises the starting frequency of continuous rising time and the ending frequency of continuous falling time;
step S330, if the tone type is the continuous change alarm tone, calculating the segment frequency of the tone according to the tone characteristic parameter.
It should be noted that, since the non-continuously changing alarm tone and the continuously changing alarm tone are different tone types and have different calculation modes of the segment frequency, the segment frequency can be quickly and accurately obtained by determining the tone type first and then performing corresponding calculation according to the corresponding tone type.
Further, in order to accurately and rapidly calculate the segment frequency in the continuously variable alarm tone, and distinguish and calculate the frequency rising and falling phases, respectively, step S330 in the above embodiment further includes the following steps:
step S410, when the tone type is a continuously variable alarm tone;
step S420, judging whether the current state is in an ascending stage or a descending stage according to the starting frequency and the ending frequency;
in step S430, if the current stage is in the rising stage, the increased frequency of the rising stage is calculated according to the pitch characteristic parameter of the rising stage, the segmented frequency of the rising stage is obtained according to the increased frequency of the rising stage, the increased frequency of the rising stage is obtained according to formula (1), and the segmented frequency of the rising stage is calculated according to formula (2), which is specifically shown in fig. 4.
df=((Ft-Fs)/Tu)*t (1)
F=df+Fs (2)
Where df is the increasing frequency of the ascending phase, Ft is the ending frequency (higher frequency), Fs is the starting frequency (lower frequency), Tu is the frequency ascending time, t is the corresponding time variable, and F is the segment frequency of the ascending phase.
Step S440, if the current stage is in the descending stage, calculating a reduced frequency of the descending stage according to the pitch characteristic parameter of the descending stage, obtaining a segmented frequency of the descending stage according to the reduced frequency of the descending stage, obtaining the reduced frequency of the descending stage according to formula (3), and calculating the segmented frequency of the descending stage according to formula (4), specifically referring to fig. 5.
df=((Ft-Fs)/Td)*t (3)
F=Ft-df (4)
Where df is the reduced frequency of the falling phase, Ft is the ending frequency (higher frequency), Fs is the starting frequency (lower frequency), Td is the frequency falling time, t is the corresponding time variable, and F is the segment frequency of the falling phase.
It should be noted that, when the time variable is a value, the corresponding formula is selected to calculate to obtain a segment frequency according to whether the current time is in the rising stage or the falling stage, that is, a plurality of segment frequencies are obtained according to the time advance, and the timer generates the PWM wave corresponding to the tone according to the plurality of segment frequencies.
It will be appreciated that the time variables in the above embodiments are associated with the sampling frequency of the timer peripheral, and may be inverse to each other. Wherein, the longer the selected time variable is, the worse the output PWM waveform is, the shorter the selected time variable is, and the accuracy of the output PWM waveform is improved. But the time variable cannot be shortened without limit because the complete pitch frequency may not be represented at this time. Correspondingly, the higher the sampling frequency of the timer peripheral, the higher the precision of the PWM waveform output by the timer peripheral, and the smaller the difference of tone generation.
Writing the starting frequency and the ending frequency of the tone into a register according to an original tone definition method, and measuring the segmented frequency of the sweep frequency with the speed of a time variable 0.52s from the starting frequency of 800Hz to the ending frequency of 1200Hz on an ATMEGA48PA single chip microcomputer platform of an AVR kernel; and the same initial frequency and time variable are attached to the STM8S103F singlechip under the same condition (the same timer frequency is set), the measuring frequency of the output tone is the initial frequency 788 Hz-the end frequency 1150Hz, and the frequency is swept at the speed of the time variable 0.31S, so that the error between the two is large, and the human ear can distinguish (the scanning speed has large influence). At this time, in order to ensure that the difference of the tones is small after the single chip microcomputer controller is replaced, the parameters such as the starting frequency, the ending frequency, the time variable and the like of the tones need to be assigned again, so that the difference of the tones played by different single chip microcomputers is small, and the matching relation between the alarm tones and the fault types can be identified.
The existing lower-end 8-bit singlechip (stm8, 16-bit timer) is transplanted and upgraded according to the embodiment of the invention, and the human ear resolution of the alarm tone is not different. And the difference of the planting under the high-position single-chip machine is smaller.
As a possible application scenario, according to the specific attribute of the tone written in the register in the embodiment of the invention, a code rule of frequency sweep with the speed of 0.5S of the time variable from the starting frequency of 800Hz to the ending frequency of 1200Hz is given on an ATMEGA48PA singlechip platform of an AVR kernel, and the code rule is transplanted into an STM8S103F singlechip under the same condition (the same timer frequency is set), at the moment, the measuring frequency of the output tone is the frequency sweep with the speed of 0.51S of the time variable from the starting frequency of 801Hz to the ending frequency of 1198Hz, the error of the output frequency of the two singlechips does not exceed 2%, and the purpose of small tone difference before and after the replacement of the controller can be realized without adjusting parameters.
As shown in fig. 6, an embodiment of the present invention further provides a tone playing apparatus, including:
a reading unit 10, configured to read specific attributes of a tone, where the specific attributes include a tone type and tone characteristic parameters corresponding to the tone type, the tone type includes a continuously-changing warning tone and a non-continuously-changing warning tone, the tone characteristic parameters include a duty ratio, a start frequency, an end frequency, a rise time, and a fall time, the duty ratio is used to determine a volume of the tone, the start frequency and the end frequency are used to determine a frequency change range of the tone, and the rise time and the fall time are used to determine a frequency change speed of the tone;
a calculating unit 20, configured to calculate a segment frequency of the tone according to the specific attribute;
and a playing unit 30 for generating a PWM wave according to the segment frequency and driving the playing device to play the tone through the PWM wave.
The device provided by the embodiment of the present invention has the same implementation principle and technical effect as the method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the method embodiments without reference to the device embodiments.
The device is an electronic device, and particularly, the electronic device comprises a processor and a storage device; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of any of the above described embodiments.
Fig. 7 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present invention, where the electronic device 100 includes: the device comprises a processor 50, a memory 51, a bus 52 and a communication interface 53, wherein the processor 50, the communication interface 53 and the memory 51 are connected through the bus 52; the processor 50 is arranged to execute executable modules, such as computer programs, stored in the memory 51.
The Memory 51 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 53 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used.
The bus 52 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 7, but this does not indicate only one bus or one type of bus.
The memory 51 is used for storing a program, the processor 50 executes the program after receiving an execution instruction, and the method executed by the apparatus defined by the flow process disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 50, or implemented by the processor 50.
The processor 50 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 50. The Processor 50 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 51, and the processor 50 reads the information in the memory 51 and completes the steps of the method in combination with the hardware thereof.
The tone playing method, the device and the computer program product of the readable storage medium provided by the embodiments of the present invention include a computer readable storage medium storing a nonvolatile program code executable by a processor, where a computer program is stored on the computer readable storage medium, and when the computer program is executed by the processor, the method described in the foregoing method embodiments is executed.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system described above may refer to the corresponding process in the foregoing embodiments, and is not described herein again.
The computer program product of the readable storage medium provided in the embodiment of the present invention includes a computer readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment, which is not described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein.

Claims (8)

1. A tone playing method, comprising:
reading specific attributes of a tone, wherein the specific attributes comprise a tone type and tone characteristic parameters corresponding to the tone type, the tone type comprises a continuous change alarm tone and a discontinuous change alarm tone, the tone characteristic parameters comprise a duty ratio, a starting frequency, an ending frequency, a rising time and a falling time, the duty ratio is used for determining the volume size of the tone, the starting frequency and the ending frequency are used for determining the frequency change range of the tone, and the rising time and the falling time are used for determining the frequency change speed of the tone;
calculating the segmented frequency of the tone according to the specific attribute;
generating PWM waves according to the segmented frequency and the duty ratio, and driving a playing device to play the tones through the PWM waves;
calculating a segment frequency of the tone according to the specific property, comprising:
determining the pitch type of the pitch;
if the tone type is a discontinuous change alert tone, the segment frequency of the tone includes the start frequency for the rise time and the end frequency for the fall time;
if the tone type is a continuously changing alarm tone, calculating the segment frequency of the tone according to the tone characteristic parameter;
if the tone type is a continuously changing alarm tone, calculating the segment frequency of the tone according to the tone characteristic parameter, including:
when the tone type is a continuously variable warning tone;
judging whether the current state is in an ascending stage or a descending stage according to the starting frequency and the ending frequency;
if the current stage is in the rising stage, calculating the increased frequency of the rising stage according to the tone characteristic parameter of the rising stage, and obtaining the segmented frequency of the rising stage according to the increased frequency of the rising stage;
if the current stage is in a descending stage, calculating the descending frequency of the descending stage according to the tone characteristic parameters of the descending stage, and obtaining the segmented frequency of the descending stage according to the descending frequency of the descending stage.
2. The tone playing method according to claim 1, wherein calculating the increased frequency of the rising phase from the tone characteristic parameter of the rising phase comprises:
calculating the frequency of the rise phase increase according to:
df=((Ft-Fs)/Tu)*t
wherein df is the frequency of the increase of the rise phase, Ft is the end frequency, Fs is the start frequency, Tu is the rise time, and t is a time variable.
3. The tone playing method according to claim 1, wherein calculating the lowered frequency of the falling phase from the tone characteristic parameter of the falling phase comprises:
calculating the decreasing frequency of the decreasing phase according to:
df=((Ft-Fs)/Td)*t
where df is the reduced frequency of the falling phase, Ft is the ending frequency, Fs is the starting frequency, Td is the falling time, and t is a time variable.
4. The tone playing method according to claim 1 or 2, wherein obtaining the segment frequency of the rising phase from the increased frequency of the rising phase comprises:
calculating the segment frequency of the rise phase according to the following formula:
F=df+Fs
and df is the increased frequency of the ascending stage, Fs is the starting frequency, and F is the segment frequency of the ascending stage.
5. The tone playing method according to claim 1 or 3, wherein obtaining the segment frequency of the falling phase from the lowered frequency of the falling phase comprises:
calculating the segment frequency of the descent phase according to:
F=Ft-df
and d is the reduced frequency of the descending stage, Ft is the ending frequency, and F is the segmentation frequency of the descending stage.
6. The tone playing method according to claim 1, wherein reading the specific attribute of the tone comprises:
acquiring a data packet, and analyzing the data packet to obtain the specific attribute of the tone;
or the like, or, alternatively,
the specific properties of the tone stored in volatile memory are read.
7. A tone playing apparatus, comprising:
a reading unit, configured to read specific attributes of a tone, where the specific attributes include a tone type and tone characteristic parameters corresponding to the tone type, the tone type includes a continuously-changing warning tone and a non-continuously-changing warning tone, the tone characteristic parameters include a duty cycle, a start frequency, an end frequency, a rise time, and a fall time, the duty cycle is used to determine a volume size to which the tone belongs, the start frequency and the end frequency are used to determine a frequency change range of the tone, and the rise time and the fall time are used to determine a frequency change speed of the tone;
the calculating unit is used for calculating the segmented frequency of the tone according to the specific attribute;
the playing unit is used for generating PWM waves according to the segmented frequency and driving a playing device to play the tones through the PWM waves;
the computing unit is further configured to determine the pitch type of the pitch; if the tone type is a discontinuous change alert tone, the segment frequency of the tone includes the start frequency for the rise time and the end frequency for the fall time; when the tone type is a continuously variable warning tone; judging whether the current state is in an ascending stage or a descending stage according to the starting frequency and the ending frequency; if the current stage is in the rising stage, calculating the increased frequency of the rising stage according to the tone characteristic parameter of the rising stage, and obtaining the segmented frequency of the rising stage according to the increased frequency of the rising stage; if the current stage is in a descending stage, calculating the descending frequency of the descending stage according to the tone characteristic parameters of the descending stage, and obtaining the segmented frequency of the descending stage according to the descending frequency of the descending stage.
8. A readable storage medium, in which a computer program is stored, which, when being executed by a processor, implements the tone playing method according to any one of claims 1 to 6.
CN201910265455.9A 2019-04-02 2019-04-02 Tone playing method, device and readable storage medium Active CN109994130B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910265455.9A CN109994130B (en) 2019-04-02 2019-04-02 Tone playing method, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910265455.9A CN109994130B (en) 2019-04-02 2019-04-02 Tone playing method, device and readable storage medium

Publications (2)

Publication Number Publication Date
CN109994130A CN109994130A (en) 2019-07-09
CN109994130B true CN109994130B (en) 2021-05-04

Family

ID=67132251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910265455.9A Active CN109994130B (en) 2019-04-02 2019-04-02 Tone playing method, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN109994130B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111965539A (en) * 2020-07-15 2020-11-20 深圳拓邦股份有限公司 Motor alarm method and motor
CN117896654B (en) * 2024-03-11 2024-05-17 南京达道电子科技有限公司 Chime sound effect generation method and control system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101124024A (en) * 2004-03-09 2008-02-13 伊莱克斯家用产品有限公司 Appliance audio notification device
US9654622B1 (en) * 2016-10-05 2017-05-16 Google Inc. Automatically altering characteristics of audio alerts
CN106803752A (en) * 2016-09-23 2017-06-06 建讯域有限公司 A kind of audio signal processor and method
CN108956160A (en) * 2018-08-10 2018-12-07 延锋伟世通电子科技(上海)有限公司 Vehicular amusement apparatus caution sound measurement method of parameters, system, device and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101124024A (en) * 2004-03-09 2008-02-13 伊莱克斯家用产品有限公司 Appliance audio notification device
CN106803752A (en) * 2016-09-23 2017-06-06 建讯域有限公司 A kind of audio signal processor and method
US9654622B1 (en) * 2016-10-05 2017-05-16 Google Inc. Automatically altering characteristics of audio alerts
CN108956160A (en) * 2018-08-10 2018-12-07 延锋伟世通电子科技(上海)有限公司 Vehicular amusement apparatus caution sound measurement method of parameters, system, device and computer readable storage medium

Also Published As

Publication number Publication date
CN109994130A (en) 2019-07-09

Similar Documents

Publication Publication Date Title
CN109994130B (en) Tone playing method, device and readable storage medium
CN1163894C (en) Frequence control/phase synchronizing circuit
CN109973301B (en) Method and device for controlling pitch variation of wind generating set under extreme turbulent wind condition
JP6749455B2 (en) Motor driving method, terminal device, and computer-readable recording medium
CN111741019A (en) Communication protocol analysis method and system based on field description
WO2017067171A1 (en) App recommendation information display method and apparatus
CN112052619A (en) Air pollution particle information optimization method and device and electronic equipment
CN111472941B (en) Fan state judgment method and device and storage medium
CN103594082A (en) Sound synthesis device, sound synthesis method and storage medium
CN109558403B (en) Data aggregation method and device, computer device and computer readable storage medium
CN114861571B (en) Method and device for calculating dynamic boundary of river channel type reservoir and storage medium
CN114099296B (en) Pressure regulating method and device for sputum excretion device and storage medium
US20080137240A1 (en) System and method for monitoring speed signals from multiple fans
CN110988661B (en) FPGA prototype verification development board time division analysis system, method, medium and terminal
CN108959028B (en) Method and device for analyzing life cycle of disk
US20180120363A1 (en) Data processing device, data processing method, and non-transitory storage medium
US9003371B2 (en) Recursive method call representation in a plot view of method execution performance
CN111124285B (en) Solid state disk data holding method, device, equipment and medium
CN114724591A (en) Baby cry detection method and device and electronic equipment
CN116112859B (en) Sounding performance evaluation method and system for ceramic loudspeaker
JP2020032676A (en) Kneading abnormality degree learning device, kneading abnormality degree estimation device, kneading abnormality degree learning method, kneading abnormality degree estimation method and program
JP7372530B2 (en) Kneading abnormality degree learning device, learned model generation method and program
JP4042669B2 (en) Waveform data editing apparatus and waveform data editing program
CN118151835A (en) Log management method, log management system, terminal and storage medium of embedded system
CN116185272A (en) Touch track calibration method and device and electronic equipment

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