Audio processing method and device, playing equipment and storage medium

Through the methods of audio file segmented decoding and parallel execution, the problems of small storage space and weak processing capabilities are solved, and the parallel execution of audio file decoding and voice playback is realized, resource utilization is optimized, and the smoothness of audio playback is improved. and efficiency.

CN118939227APending Publication Date: 2024-11-12GUANGDONG CHUTIAN DRAGON SMART CARD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410959828.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The MCU has small storage space and weak processing capabilities, making it difficult to support audio processing and other scenarios that require a lot of memory and computing resources, which limits the improvement of electronic equipment performance.

Method used

Through audio file segment decoding and parallel execution, digital audio signals are transmitted to DAC drivers by DMA, and parallel execution of audio file decoding and voice playback are realized, and resource utilization is optimized.

Benefits of technology

Maximizes the utilization of MCU resources, ensures the smoothness and efficiency of audio playback, frees up CPU resources, and reduces playback delays and interrupts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939227A_ABST
    Figure CN118939227A_ABST
Patent Text Reader

Abstract

The invention discloses an audio processing method and device, playing equipment and a storage medium, and relates to the technical field of audio processing. The method comprises the following steps: after a voice interface decodes an audio clip to obtain a current digital audio signal, transmitting the current digital audio signal to a DAC (Digital-to-Analog Converter) driver of playing equipment, reading a next audio clip for decoding, and obtaining an analog audio signal from the DAC driver for audio playing, the analog audio signal is obtained by conversion of a current digital audio signal driven by a DAC; wherein transmission of the current digital audio signal to the DAC drive of the playing device and reading of the next audio clip for decoding are executed in parallel. Therefore, the audio file decoding processing and the voice playing are executed in parallel, and the resources of the MCU are optimally utilized to maximize the working efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of audio processing technology, and in particular to an audio processing method, device, playback equipment and storage medium. Background Art

[0002] A microcontroller unit (MCU) is a single-chip microcomputer system that integrates functional modules such as a microprocessor core, memory, input / output interface, and timer. Compared with traditional microprocessors, MCUs are small in size, low in power consumption, low in cost, and easy to integrate and develop, so they are widely used in various electronic devices and embedded systems. However, MCUs usually have small storage space and relatively weak processing capabilities. Therefore, MCUs are difficult to support scenarios such as audio processing that require more memory and computing resources, which restricts the performance improvement of electronic devices. Summary of the invention

[0003] In view of this, the purpose of the present invention is to overcome the deficiencies in the prior art and to provide an audio processing method, apparatus, playback device and storage medium for maximizing resource utilization and ensuring playback smoothness by performing audio file decoding processing and voice playback in parallel.

[0004] The present invention provides the following technical solutions:

[0005] In a first aspect, the present invention provides an audio processing method, the method comprising:

[0006] The application calls the voice interface of the playback device;

[0007] The voice interface obtains a broadcast event, and reads an audio file from a file system according to the broadcast event;

[0008] The voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals;

[0009] When the voice interface decodes an audio segment and obtains a current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and an analog audio signal is obtained from the DAC driver for audio playback, wherein the analog audio signal is obtained by the DAC driver according to the current digital audio signal.

[0010] The transmitting of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

[0011] In one implementation, the voice interface reads an audio file from a file system according to the broadcast event, including:

[0012] The voice interface obtains the file path corresponding to the broadcast event from the application;

[0013] The voice interface calls the file system according to the file path to read the audio file.

[0014] In one implementation, the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals, including:

[0015] Determine a decoding algorithm according to the type of the audio file;

[0016] Segmenting the audio file according to the size of the audio file and in the order in which the audio file is played, to obtain a plurality of audio segments;

[0017] The audio segments are decoded in sequence according to the decoding algorithm to obtain multiple groups of digital audio signals.

[0018] In one embodiment, the method further comprises:

[0019] Obtaining the file descriptor of the audio file;

[0020] The type of the audio file and the size of the audio file are determined according to the file descriptor.

[0021] In one embodiment, when the voice interface decodes an audio segment to obtain a current digital audio signal, the current digital audio signal is transmitted to a DAC driver of the playback device, and the next audio segment is read for decoding, including:

[0022] Acquire the audio clips in sequence according to the order in which the audio files are played;

[0023] Decoding the currently acquired audio segment according to the decoding algorithm to obtain a current digital audio signal;

[0024] Transmitting the current digital audio signal to the DAC driver; and determining whether the currently acquired audio segment is the last audio segment;

[0025] If yes, then end the decoding;

[0026] If not, the next audio segment is used as the currently acquired audio segment, and the step of decoding the currently acquired audio segment according to the decoding algorithm to obtain the current digital audio signal is re-executed.

[0027] In one embodiment, transmitting the current digital audio signal to the DAC driver includes:

[0028] The current digital audio signal is transmitted to the pre-play buffer queue driven by the DAC via DMA.

[0029] In one embodiment, the step of obtaining an analog audio signal from the DAC driver for audio playback includes:

[0030] When the DAC driver is in an idle state, the DAC driver obtains the to-be-played digital audio signal from the pre-play buffer queue; and converts the to-be-played digital audio signal into the analog audio signal;

[0031] The voice interface obtains the analog audio signal from the DAC driver for audio playback.

[0032] In a second aspect, the present invention provides an audio processing device, the device comprising:

[0033] A calling module, used to call the voice interface of the playback device through the application;

[0034] An acquisition module, used for acquiring a broadcast event through the voice interface, and reading an audio file from a file system according to the broadcast event;

[0035] A decoding module, used for the voice interface to divide the audio file into multiple audio segments, and decode each audio segment in turn to obtain multiple groups of digital audio signals;

[0036] A playback module, which is used to, when the voice interface decodes an audio segment and obtains a current digital audio signal, transmit the current digital audio signal to the DAC driver of the playback device, read the next audio segment for decoding, and obtain an analog audio signal from the DAC driver for audio playback, wherein the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the transmitting of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

[0037] In a third aspect, the present invention proposes a playback device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the audio processing method as described in the first aspect is implemented.

[0038] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the audio processing method as described in the first aspect.

[0039] The audio processing method, device, playback device and storage medium disclosed in the present invention, the application calls the voice interface of the playback device; the voice interface obtains the broadcast event, and reads the audio file from the file system according to the broadcast event; the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; when the voice interface decodes an audio segment to obtain the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and the analog audio signal is obtained from the DAC driver for audio playback, and the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, which is executed in parallel. In this way, by decoding the audio file in segments and transmitting the decoded digital audio signal at the same time, the audio file decoding process and the voice playback are executed in parallel, thereby optimizing the use of MCU resources and maximizing work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.

[0041] Figure 1 A schematic diagram of a flow chart of the audio processing method proposed by the present invention is shown;

[0042] Figure 2 Another schematic diagram of the flow of the audio processing method proposed by the present invention is shown;

[0043] Figure 3 Another schematic diagram of the flow of the audio processing method proposed by the present invention is shown;

[0044] Figure 4 Another schematic diagram of the flow of the audio processing method proposed by the present invention is shown;

[0045] Figure 5 A schematic diagram of the structure of the audio processing device proposed by the present invention is shown;

[0046] Figure 6 A structural schematic diagram of a playback device proposed by the present invention is shown.

[0047] Figure identification: 500 - audio processing device; 501 - calling module; 502 - acquisition module; 503 - decoding module; 504 - playing module; 600 - playing device; 601 - transceiver; 602 - processor; 603 - memory. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0049] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0050] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0051] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0052] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.

[0053] Example 1

[0054] The embodiment of the present disclosure provides an audio processing method for maximizing resource utilization and ensuring playback fluency by performing audio file decoding processing and voice playback in parallel.

[0055] See also Figure 1The audio processing method includes steps S101 to S105, and each step is described in detail below.

[0056] Step S101: The application program calls the voice interface of the playback device.

[0057] In this embodiment, when an application needs to play an audio file, it will interact with a playback device. In order to realize the voice playback function, the application needs to call the voice interface of the playback device. The voice interface is a method of packaging a digital-to-analog converter (DAC) and a file system after designing logic, and providing it to the application for calling. The DAC driver runs at the bottom layer.

[0058] Among them, the application program can be a mobile phone application, computer software or other types of software, and the playback device can be a smart playback speaker, smart home device, etc.

[0059] Step S102: the voice interface obtains a broadcast event, and reads an audio file from a file system according to the broadcast event.

[0060] In this embodiment, after the application calls the voice interface, the voice interface obtains the pending event from its own pending event list and determines the type of the pending event; if the pending event type is a broadcast event, the voice interface reads the audio file to be played from the file system according to the broadcast event.

[0061] See also Figure 2 In a specific embodiment, the voice interface reads the audio file from the file system according to the broadcast event, including steps S1021 to S1022, and each step is described in detail below.

[0062] Step S1021: the voice interface obtains the file path corresponding to the announcement event from the application.

[0063] In this embodiment, when the application needs to play an audio file, the file path of the audio file is first determined, and the file path is passed as a parameter to the language interface.

[0064] Step S1022: The voice interface calls the file system according to the file path to read the audio file.

[0065] In this embodiment, after the voice interface obtains the file path from the application, it calls the file system according to the file path to access the corresponding audio file; after the file system finds the audio file according to the file path, it returns a file descriptor to the voice interface; after the voice interface receives the file descriptor, it reads the audio file according to the file descriptor. The file descriptor is used to record the structure of file information, including file name, file size, file type, read or write to file location and other information.

[0066] Step S103: the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in sequence to obtain multiple groups of digital audio signals.

[0067] In this embodiment, in order to ensure the continuity of audio playback, the next part of the audio file is usually decoded in advance when the current audio data is played. Therefore, the voice interface decodes the read audio file in sections to obtain multiple groups of audio signals.

[0068] See also Figure 3 In a specific embodiment, step S103 includes steps S1031 to S1033, and each step is described in detail below.

[0069] Step S1031, determining a decoding algorithm according to the type of the audio file.

[0070] In this embodiment, there are many different types of audio files, such as: MP3; Advanced Audio Coding (AAC); Waveform Audio File Format (WAV); Free Lossless Audio Codec (FLAC), etc.

[0071] Each audio format has its own specific decoding algorithm, which is used to restore the original audio signal from the compressed audio data. By choosing the correct decoding algorithm, you can ensure that the audio player or decoder software can correctly restore the audio data and provide a high-quality audio playback experience.

[0072] Step S1032: segment the audio file according to the size of the audio file and in the order in which the audio file is played, to obtain a plurality of audio segments.

[0073] In this embodiment, multiple audio segments are obtained by dividing the original audio file in the order of playing the original audio file according to the size of the original audio file and the preset segment size. Large audio files may take up a lot of memory or storage space, and segmenting them helps to manage these resources more effectively; for audio streams that need to be processed in real time (such as telephone calls, video conferences, etc.), segmentation can ensure that audio data is processed in smaller blocks, thereby reducing delays. At the same time, dividing the entire audio file into segments can be used to play the first decoded audio segment, and while playing the first decoded audio segment, the subsequent audio segment to be decoded is decoded.

[0074] In a specific embodiment, the method further includes: obtaining a file descriptor of the audio file; and determining the type of the audio file and the size of the audio file according to the file descriptor.

[0075] In this embodiment, since the file descriptor records information such as the size and type of the audio file, the size and type of the audio file can be directly obtained through the file descriptor.

[0076] Step S1033: decode the audio segments in sequence according to the decoding algorithm to obtain multiple groups of digital audio signals.

[0077] In this embodiment, each audio segment is decoded in turn according to a decoding algorithm to obtain a corresponding digital audio signal.

[0078] Step S104, when the voice interface decodes an audio segment and obtains the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and an analog audio signal is obtained from the DAC driver for audio playback. The analog audio signal is obtained by the DAC driver according to the current digital audio signal.

[0079] In this embodiment, when the voice interface decodes each audio clip in turn, after each set of digital audio signals is decoded, the currently decoded digital audio signal is transmitted to the DAC driver, and at the same time, the voice interface reads the next audio clip for decoding. Prior to this, the DAC driver needs to be turned on first. Furthermore, after the DAC driver receives the digital audio signal and converts the decoded digital audio signal into an analog audio signal, the playback method in the voice interface obtains the analog audio signal for audio playback. In this way, while the voice interface plays audio according to the currently decoded and converted analog audio signal, the audio clip to be decoded is decoded, thereby realizing the parallel execution of audio file decoding processing and voice playback, thereby freeing up MCU resources.

[0080] See also Figure 4In a specific embodiment, when the voice interface decodes an audio segment and obtains the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, including: steps S401 to S405, and the steps are described in detail below.

[0081] Step S401: acquiring the audio clips in sequence according to the playback order of the audio files.

[0082] In this embodiment, the voice interface encapsulates multiple methods, including a segmentation method, a decoding method, a playing method, etc. Among them, the segmentation method is used to segment the audio file, the decoding method is used to obtain the segmented audio file for decoding, and the playing method can be used to play the decoded audio data. After the audio file is segmented by the segmentation method in the voice interface, the decoding method in the voice interface will obtain each audio segment in the segmentation order.

[0083] Step S402: decode the currently acquired audio segment according to the decoding algorithm to obtain a current digital audio signal.

[0084] In this embodiment, the currently acquired audio segment is decoded in real time according to a decoding algorithm to obtain its corresponding digital audio signal.

[0085] In a specific embodiment, transmitting the current digital audio signal to the DAC driver includes: transmitting the current digital audio signal to a pre-play buffer queue of the DAC driver via DMA.

[0086] In this embodiment, every time an audio clip is decoded and the corresponding digital audio signal is obtained, the voice interface will transfer the currently decoded digital audio signal to the pre-play cache queue of the DAC driver in a direct memory access (DMA) manner. In this way, the pre-play cache queue can ensure the continuous playback of the audio signal, avoid playback gaps or interruptions, and enhance the user's auditory experience; and while transmitting the audio signal to the DAC driver, the next audio clip is decoded, freeing up MCU resources.

[0087] It should be noted that the decoded digital audio signal is transferred from the voice interface to the DAC driver via DMA, which is a high-speed data transfer operation that allows data to be read and written directly between external devices and memory. This process is independent of the CPU and does not pass through the CPU or require CPU intervention, so the CPU can continue to perform other tasks, such as decoding new audio clips.

[0088] Step S403: transmitting the current digital audio signal to the DAC driver; and determining whether the currently acquired audio segment is the last audio segment.

[0089] In this embodiment, after obtaining the current digital audio signal, it is necessary to transmit the current digital audio signal to the DAC driver, and at the same time determine whether the currently obtained audio segment is the last one of all audio segments.

[0090] Step S404: If yes, then end the decoding.

[0091] In this embodiment, if the currently acquired audio segment is the last one of all the audio segments, it can be known that all the currently acquired audio segments have been decoded and the decoding needs to be stopped.

[0092] Step S405: if not, taking the next audio segment as the currently acquired audio segment, and re-performing the step of decoding the currently acquired audio segment according to the decoding algorithm to obtain the current digital audio signal.

[0093] In this embodiment, if the currently acquired audio segment is not the last one of all the audio segments, the next audio segment to be decoded is used as the currently acquired audio segment, and the process goes to step S402 to continue executing subsequent steps until all audio segments are decoded, and each time the corresponding current audio signal is decoded, it is directly transferred to the pre-playback cache queue via DMA.

[0094] In this embodiment, the DAC driver fills and plays the decoded audio signals in the played cache list in the transmission order. Due to the asynchronous transmission characteristics and interrupt mechanism of DMA, decoding and voice playback can be performed in parallel physically. This means that the voice interface can continue to decode new audio clips under the control of the CPU, while the DAC driver can continue to play the decoded audio signals under the control of DMA. This parallel processing improves the efficiency and continuity of audio playback, reduces playback interruptions or delays caused by CPU busyness, and frees up CPU resources.

[0095] In a specific embodiment, obtaining the analog audio signal from the DAC driver for audio playback includes: when the DAC driver is in an idle state, the DAC driver obtains the to-be-played digital audio signal from the pre-play cache queue; and converts the to-be-played digital audio signal into the analog audio signal; the voice interface obtains the analog audio signal from the DAC driver for audio playback.

[0096] In this embodiment, after the DAC driver converts a digital audio signal and plays it by the voice interface, it will be in an idle state; at this time, the DAC driver will check whether there is an unplayed digital audio signal to be played in the pre-play cache queue. If so, it will then obtain the next digital audio signal to be played from the pre-play cache queue and perform format conversion based on the digital audio signal to be played, so that the voice interface can directly obtain the converted analog audio signal from the DAC driver for audio playback. When the user issues control instructions such as play, pause, stop, etc., the DAC driver can quickly adjust the playback status from the pre-play cache queue and provide instant feedback; and because the digital audio data has been pre-loaded into the cache, the DAC driver can respond to the playback request more quickly, reducing the delay from the request to the actual playback.

[0097] It should be noted that when there is no digital audio signal to be played in the pre-play cache queue, it can be known that all digital audio signals corresponding to the audio file have been played. At this time, the DAC driver is turned off, the audio file is also closed, and the playback is completed.

[0098] Exemplarily, if the audio file X is divided into audio segments A, B, C, and D, after the audio segment A is decoded to obtain the audio signal A', the audio signal A' is transmitted to the pre-play cache queue driven by the DAC through the DMA mode, and at the same time, it is determined that the audio segment A is not the last audio segment, and the next audio segment B is decoded to obtain the audio signal B', and then the audio signal B' is transmitted to the pre-play cache queue driven by the DAC through the DMA mode, and at the same time, it is determined that the audio segment B is not the last audio segment, and the next audio segment C is decoded to obtain the audio signal C', and then the audio signal C' is transmitted to the pre-play cache queue driven by the DAC through the DMA mode, and at the same time, it is determined that the audio segment C is not the last audio segment, and the next audio segment D is decoded to obtain the audio signal D', and then the audio signal A' is transmitted to the pre-play cache queue driven by the DAC through the DMA mode, and at the same time, it is determined that the audio segment D is the last audio segment, and the segmented decoding of the audio file is ended. When the pre-play cache queue driven by the DAC receives the audio signal A', it will play according to the audio signal A'. After the audio signal A' is played, the audio signal B' in the pre-play cache queue will be played, and so on, until all the audio signals are played. From the above, it can be seen that when the pre-play cache queue driven by the DAC receives the audio signal A' and plays according to the audio signal A', the next audio segment B is decoded, and so on, thereby realizing the parallel execution of audio file decoding processing and voice playback.

[0099] It should be noted that in the audio playback process, the control instructions on the interprocess communication (IPC) mechanism are monitored. Once the instruction is received, it is processed immediately (such as starting to play the audio file, pausing the playback, etc.), and the voice playback status is updated, thereby achieving real-time control of the voice playback status.

[0100] The audio processing method proposed in this embodiment is that the application calls the voice interface of the playback device; the voice interface obtains the broadcast event, and reads the audio file from the file system according to the broadcast event; the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; when the voice interface decodes an audio segment to obtain the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and the analog audio signal is obtained from the DAC driver for audio playback, and the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, which is executed in parallel. In this way, by decoding the audio file in segments and transmitting the decoded digital audio signal at the same time, the audio file decoding process and the voice playback are executed in parallel, thereby optimizing the use of MCU resources and maximizing work efficiency.

[0101] Example 2

[0102] In addition, the present disclosure provides an audio processing device 500, see Figure 5 , the device comprises:

[0103] The calling module 501 is used to call the voice interface of the playback device through the application program;

[0104] The acquisition module 502 is used to acquire the broadcast event through the voice interface and read the audio file from the file system according to the broadcast event;

[0105] A decoding module 503, configured to divide the audio file into multiple audio segments through the voice interface, and decode each audio segment in turn to obtain multiple groups of digital audio signals;

[0106] The playback module 504 is used for, when the voice interface decodes an audio segment and obtains the current digital audio signal, transmitting the current digital audio signal to the DAC driver of the playback device, reading the next audio segment for decoding, and obtaining the analog audio signal from the DAC driver for audio playback, wherein the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the transmitting of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

[0107] Optionally, the acquisition module 502 is further used to obtain the file path corresponding to the broadcast event from the application through the voice interface; the voice interface calls the file system according to the file path to read the audio file.

[0108] Optionally, the decoding module 503 is further used to determine a decoding algorithm according to the type of the audio file; segment the audio file according to the size of the audio file and the order in which the audio file is played to obtain multiple audio segments; and decode each of the audio segments in turn according to the decoding algorithm to obtain multiple groups of digital audio signals.

[0109] Optionally, the decoding module 503 is further configured to obtain a file descriptor of the audio file; and determine the type of the audio file and the size of the audio file according to the file descriptor.

[0110] Optionally, the decoding module 503 is also used to obtain each of the audio clips in sequence according to the playback order of the audio file; decode the currently obtained audio clip according to the decoding algorithm to obtain a current digital audio signal; transmit the current digital audio signal to the DAC driver; and determine whether the currently obtained audio clip is the last audio clip; if so, end the decoding; if not, use the next audio clip as the currently obtained audio clip, and re-execute the step of decoding the currently obtained audio clip according to the decoding algorithm to obtain the current digital audio signal.

[0111] Optionally, the playing module 504 is further configured to transmit the current digital audio signal to a pre-playing cache queue driven by the DAC via DMA.

[0112] Optionally, the playback module 504 is also used for, when the DAC driver is in an idle state, the DAC driver obtains the digital audio signal to be played from the pre-play cache queue; and converts the digital audio signal to be played into the analog audio signal; and the voice interface obtains the analog audio signal from the DAC driver for audio playback.

[0113] The device provided in the embodiment of the present disclosure can execute the steps of the audio processing method provided in Example 1, which will not be described again to avoid repetition.

[0114] The audio processing device proposed in this embodiment, the application calls the voice interface of the playback device; the voice interface obtains the broadcast event, and reads the audio file from the file system according to the broadcast event; the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; when the voice interface decodes an audio segment to obtain the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and the analog audio signal is obtained from the DAC driver for audio playback, and the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, which is executed in parallel. In this way, by decoding the audio file in segments and transmitting the decoded digital audio signal at the same time, the audio file decoding process and the voice playback are executed in parallel, thereby optimizing the use of MCU resources and maximizing work efficiency.

[0115] Example 3

[0116] In addition, an embodiment of the present disclosure provides a playback device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the audio processing method described in Embodiment 1 is implemented.

[0117] For details, see Figure 6 The playback device 600 includes: a transceiver 601, a bus interface and a processor 602, wherein the processor 602 is used for: an application program calling a voice interface of the playback device; the voice interface obtains a broadcast event, and reads an audio file from a file system according to the broadcast event; the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; when the voice interface decodes an audio segment to obtain a current digital audio signal, the current digital audio signal is transmitted to a DAC driver of the playback device, the next audio segment is read for decoding, and an analog audio signal is obtained from the DAC driver for audio playback, and the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the transmission of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

[0118] In one embodiment, the processor 602 is further configured to: cause the voice interface to obtain a file path corresponding to the announcement event from the application; and cause the voice interface to call the file system according to the file path to read the audio file.

[0119] In one embodiment, the processor 602 is further used to: determine a decoding algorithm according to the type of the audio file; segment the audio file according to the size of the audio file and the order in which the audio file is played to obtain multiple audio segments; and decode each of the audio segments in turn according to the decoding algorithm to obtain multiple groups of digital audio signals.

[0120] In one implementation, the processor 602 is further configured to: obtain a file descriptor of the audio file; and determine a type of the audio file and a size of the audio file according to the file descriptor.

[0121] In one implementation, the processor 602 is further configured to: sequentially acquire each of the audio clips according to the playback order of the audio files;

[0122] The currently acquired audio segment is decoded according to the decoding algorithm to obtain a current digital audio signal; the current digital audio signal is transmitted to the DAC driver; and it is determined whether the currently acquired audio segment is the last audio segment; if so, the decoding is terminated; if not, the next audio segment is used as the currently acquired audio segment, and the step of decoding the currently acquired audio segment according to the decoding algorithm to obtain the current digital audio signal is re-executed.

[0123] In one implementation, the processor 602 is further configured to: transmit the current digital audio signal to the pre-play buffer queue driven by the DAC via DMA.

[0124] In one embodiment, the processor 602 is also used for: when the DAC driver is in an idle state, the DAC driver obtains the digital audio signal to be played from the pre-play cache queue; and converts the digital audio signal to be played into the analog audio signal; the voice interface obtains the analog audio signal from the DAC driver for audio playback.

[0125] In the embodiment of the present invention, the playback device 600 further includes a memory 603. Figure 6In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 602 and various circuits of memory represented by memory 603 are linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 601 may be a plurality of components, namely, a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 602 is responsible for managing the bus architecture and general processing, and the memory 603 may store data used by the processor 602 when performing operations. The device provided in the embodiment of the present disclosure may execute the steps of the audio processing method provided in Embodiment 1, and will not be described in detail to avoid repetition.

[0126] The playback device proposed in this embodiment, the application calls the voice interface of the playback device; the voice interface obtains the broadcast event, and reads the audio file from the file system according to the broadcast event; the voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; when the voice interface decodes an audio segment to obtain the current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and the analog audio signal is obtained from the DAC driver for audio playback, and the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, which is executed in parallel. In this way, by decoding the audio file in segments and transmitting the decoded digital audio signal at the same time, the audio file decoding process and the voice playback are executed in parallel, thereby optimizing the use of MCU resources and maximizing work efficiency.

[0127] Example 4

[0128] The embodiment of the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the audio processing method described in Embodiment 1 is implemented.

[0129] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0130] The computer-readable storage medium provided in this embodiment can implement the audio processing method provided in Embodiment 1, and will not be described again here to avoid repetition.

[0131] In all examples shown and described herein, any specific values ​​should be interpreted as merely exemplary and not as limiting, and thus other examples of the exemplary embodiments may have different values.

[0132] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0133] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. An audio processing method, characterized in that: The method comprises: The application calls the voice interface of the playback device; The voice interface obtains a broadcast event, and reads an audio file from a file system according to the broadcast event; The voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals; When the voice interface decodes an audio segment and obtains a current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, the next audio segment is read for decoding, and an analog audio signal is obtained from the DAC driver for audio playback, wherein the analog audio signal is obtained by the DAC driver according to the current digital audio signal. The transmitting of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

2. The audio processing method according to claim 1, characterized in that: The voice interface reads the audio file from the file system according to the broadcast event, including: The voice interface obtains the file path corresponding to the broadcast event from the application; The voice interface calls the file system according to the file path to read the audio file.

3. The audio processing method according to claim 1, characterized in that: The voice interface divides the audio file into multiple audio segments, and decodes each audio segment in turn to obtain multiple groups of digital audio signals, including: Determine a decoding algorithm according to the type of the audio file; Segmenting the audio file according to the size of the audio file and in the order in which the audio file is played, to obtain a plurality of audio segments; The audio segments are decoded in sequence according to the decoding algorithm to obtain multiple groups of digital audio signals.

4. The audio processing method according to claim 3, characterized in that: The method further comprises: Obtaining the file descriptor of the audio file; The type of the audio file and the size of the audio file are determined according to the file descriptor.

5. The audio processing method according to claim 3, characterized in that: When the voice interface decodes an audio segment to obtain a current digital audio signal, the current digital audio signal is transmitted to the DAC driver of the playback device, and the next audio segment is read for decoding, including: Acquire the audio clips in sequence according to the order in which the audio files are played; Decoding the currently acquired audio segment according to the decoding algorithm to obtain a current digital audio signal; Transmitting the current digital audio signal to the DAC driver; and determining whether the currently acquired audio segment is the last audio segment; If yes, then end the decoding; If not, the next audio segment is used as the currently acquired audio segment, and the step of decoding the currently acquired audio segment according to the decoding algorithm to obtain the current digital audio signal is re-executed.

6. The audio processing method according to claim 4, characterized in that: The transmitting the current digital audio signal to the DAC driver comprises: The current digital audio signal is transmitted to the pre-play buffer queue driven by the DAC via DMA.

7. The audio processing method according to claim 6, characterized in that: The step of obtaining an analog audio signal from the DAC driver for audio playback includes: When the DAC driver is in an idle state, the DAC driver obtains the to-be-played digital audio signal from the pre-play buffer queue; and converts the to-be-played digital audio signal into the analog audio signal; The voice interface obtains the analog audio signal from the DAC driver for audio playback.

8. An audio processing device, characterized in that: The device comprises: A calling module is used to call the voice interface of the playback device through the application program; An acquisition module, used for acquiring a broadcast event through the voice interface, and reading an audio file from a file system according to the broadcast event; A decoding module, used for the voice interface to divide the audio file into multiple audio segments, and decode each audio segment in turn to obtain multiple groups of digital audio signals; A playback module, which is used to, when the voice interface decodes an audio segment and obtains a current digital audio signal, transmit the current digital audio signal to the DAC driver of the playback device, read the next audio segment for decoding, and obtain an analog audio signal from the DAC driver for audio playback, wherein the analog audio signal is obtained by the DAC driver according to the current digital audio signal conversion; wherein the transmitting of the current digital audio signal to the DAC driver of the playback device and the reading of the next audio segment for decoding are performed in parallel.

9. A playback device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the audio processing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the audio processing method according to any one of claims 1 to 7.