[go: up one dir, main page]

CN108847248B - Bluetooth device audio processing method, system, readable storage medium and Bluetooth device - Google Patents

Bluetooth device audio processing method, system, readable storage medium and Bluetooth device Download PDF

Info

Publication number
CN108847248B
CN108847248B CN201810623859.6A CN201810623859A CN108847248B CN 108847248 B CN108847248 B CN 108847248B CN 201810623859 A CN201810623859 A CN 201810623859A CN 108847248 B CN108847248 B CN 108847248B
Authority
CN
China
Prior art keywords
audio
bluetooth
data
data packet
packet
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
CN201810623859.6A
Other languages
Chinese (zh)
Other versions
CN108847248A (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.)
Zhuhai Jieli Technology Co Ltd
Original Assignee
Zhuhai Jieli Technology 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 Zhuhai Jieli Technology Co Ltd filed Critical Zhuhai Jieli Technology Co Ltd
Priority to CN201810623859.6A priority Critical patent/CN108847248B/en
Publication of CN108847248A publication Critical patent/CN108847248A/en
Application granted granted Critical
Publication of CN108847248B publication Critical patent/CN108847248B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/008Multichannel audio signal coding or decoding using interchannel correlation to reduce redundancy, e.g. joint-stereo, intensity-coding or matrixing
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/005Correction of errors induced by the transmission channel, if related to the coding algorithm
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Mathematical Physics (AREA)
  • Reverberation, Karaoke And Other Acoustics (AREA)

Abstract

本发明涉及一种蓝牙设备音频处理方法、系统、可读存储介质和蓝牙设备,属于音频处理技术领域,在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,按照蓝牙从机设备的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,封装至蓝牙数据包并传输至蓝牙从机设备,蓝牙从机设备可以播放对应声道的音频;蓝牙主机设备对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。

Figure 201810623859

The invention relates to a Bluetooth device audio processing method, system, readable storage medium and Bluetooth device, belonging to the technical field of audio processing. When a first audio data packet to be played is received, it is preprocessed to obtain channel independence. The frequency domain data of the independent channel is respectively compressed and encoded to obtain the corresponding second audio data packet. According to the audio playback requirements of the Bluetooth slave device, the first audio data packet of the corresponding channel is selected from the second audio data packet. Three audio data packets, encapsulated into Bluetooth data packets and transmitted to the Bluetooth slave device, the Bluetooth slave device can play the audio of the corresponding channel; the Bluetooth host device compresses and encodes the audio data, and transmits it according to the audio playback requirements of the Bluetooth slave device. The audio data package corresponding to the channel can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and at the same time maintain the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

Figure 201810623859

Description

蓝牙设备音频处理方法、系统、可读存储介质和蓝牙设备Bluetooth device audio processing method, system, readable storage medium and Bluetooth device

技术领域technical field

本发明涉及音频处理技术领域,特别是涉及一种蓝牙设备音频处理方法、系统、可读存储介质和蓝牙设备。The present invention relates to the technical field of audio processing, and in particular, to a Bluetooth device audio processing method, system, readable storage medium and Bluetooth device.

背景技术Background technique

随着音频技术的发展,多通道模拟立体声技术的应用日益广泛。将多通道模拟立体声技术运用于蓝牙设备的高级音频中可以真实地再现原声场的声音,能为用户带来更好的听音效果。With the development of audio technology, the application of multi-channel analog stereo technology is becoming more and more extensive. The application of multi-channel analog stereo technology to the advanced audio of Bluetooth devices can truly reproduce the sound of the original sound field, which can bring better listening effects to users.

目前,在蓝牙设备输出音频时,需要蓝牙主机设备将音频流转发至蓝牙从机设备,当进行多通道的音频输出时,需要转发的音频数据量大大增加,增大了数据带宽压力,降低了蓝牙设备的性能。At present, when the Bluetooth device outputs audio, the Bluetooth host device needs to forward the audio stream to the Bluetooth slave device. When performing multi-channel audio output, the amount of audio data that needs to be forwarded increases greatly, which increases the pressure on data bandwidth and reduces the Performance of Bluetooth devices.

发明内容SUMMARY OF THE INVENTION

基于此,有必要针对蓝牙设备因音频数据丢包导致不同步的问题,提供一种蓝牙设备音频处理方法、系统、可读存储介质和蓝牙设备。Based on this, it is necessary to provide a Bluetooth device audio processing method, system, readable storage medium and Bluetooth device for the problem that the Bluetooth device is out of synchronization due to audio data packet loss.

一种蓝牙设备音频处理方法,包括以下步骤:A Bluetooth device audio processing method, comprising the following steps:

在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;When receiving the first audio data packet to be played, preprocessing the first audio data packet to obtain channel-independent frequency domain data;

对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;Compressing and encoding the frequency domain data of different channels respectively to obtain the second audio data packet of the corresponding channel;

根据蓝牙从机设备的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;According to the audio playback requirement of the Bluetooth slave device, a third audio data packet is selected from each second audio data packet, wherein the third audio data packet corresponds to the channel in the audio playback requirement;

将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备。The third audio data packet is encapsulated into the Bluetooth data packet, and the Bluetooth data packet is transmitted to the Bluetooth slave device.

根据上述蓝牙设备音频处理方法,其是在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,按照蓝牙从机设备的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,封装至蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备,蓝牙从机设备可以播放对应声道的音频;上述方法可以应用在蓝牙主机设备中,蓝牙主机设备对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。According to the above-mentioned audio processing method for a Bluetooth device, when the first audio data packet to be played is received, it is preprocessed to obtain frequency-domain data with independent channels, and the frequency-domain data of the independent channels are respectively compressed and encoded. , obtain the corresponding second audio data packet, select the third audio data packet of the corresponding channel from the second audio data packet according to the audio playback requirements of the Bluetooth slave device, encapsulate it into the Bluetooth data packet, and transmit the Bluetooth data packet To the Bluetooth slave device, the Bluetooth slave device can play the audio of the corresponding channel; the above method can be applied to the Bluetooth host device, the Bluetooth host device compresses and encodes the audio data, and transmits the corresponding sound according to the audio playback requirements of the Bluetooth slave device. It can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and at the same time maintain the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

在其中一个实施例中,对第一音频数据包进行预处理,获得声道独立的频域数据的步骤包括以下步骤:In one of the embodiments, the step of preprocessing the first audio data packet to obtain channel-independent frequency domain data includes the following steps:

对第一音频数据包进行解析,获得音频帧头和帧内数据;Analyze the first audio data packet to obtain the audio frame header and intra-frame data;

对音频帧头进行CRC校验,若校验通过,对帧内数据进行位流分配、反量化和立体声处理,获得频域数据。CRC check is performed on the audio frame header. If the check is passed, bit stream allocation, inverse quantization and stereo processing are performed on the data in the frame to obtain frequency domain data.

在其中一个实施例中,对音频帧头进行CRC校验的步骤包括以下步骤:In one of the embodiments, the step of performing CRC check on the audio frame header includes the following steps:

获取音频帧头中的目标信息,目标信息包括声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子和第一CRC校验值;Obtain the target information in the audio frame header, the target information includes channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, scaling factor and the first CRC check value;

根据声道模式、采样率、码率、块模式、位流分配模式、子带模式和缩放因子获取第二CRC校验值,若第一CRC校验值与第二CRC校验值一致,判定CRC校验通过。Obtain the second CRC check value according to the channel mode, sampling rate, code rate, block mode, bit stream allocation mode, sub-band mode and scaling factor. If the first CRC check value is consistent with the second CRC check value, determine CRC check passed.

在其中一个实施例中,对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包的步骤包括以下步骤:In one of the embodiments, the frequency domain data of different channels are respectively compressed and encoded, and the step of acquiring the second audio data packet of the corresponding channel includes the following steps:

根据编码参数对任一声道的频域数据进行位流分配、量化和主数据封装,获得独立声道的编码数据;Perform bit stream allocation, quantization and main data encapsulation on the frequency domain data of any channel according to the encoding parameters, to obtain the encoded data of the independent channel;

对独立声道的编码数据进行封装,获取第二音频数据包。The encoded data of the independent channel is encapsulated to obtain a second audio data packet.

在其中一个实施例中,对独立声道的编码数据进行封装的步骤包括以下步骤:In one of the embodiments, the step of encapsulating the encoded data of the independent channels includes the following steps:

根据编码数据获取音频属性信息,根据音频属性信息获取第三CRC校验值,将音频属性信息和第三CRC校验值作为包头信息,将编码数据作为包内主数据,生成第二音频数据包。Obtain audio attribute information according to the encoded data, obtain a third CRC check value according to the audio attribute information, use the audio attribute information and the third CRC check value as packet header information, use the encoded data as main data in the packet, and generate a second audio data packet .

在其中一个实施例中,蓝牙设备音频处理方法还包括以下步骤:In one of the embodiments, the Bluetooth device audio processing method further includes the following steps:

根据本地的音频播放需求,从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据;According to local audio playback requirements, select a fourth audio data packet from each second audio data packet, decode the fourth audio data packet, and obtain the first time-domain PCM data;

将第一时域PCM数据发送至本地DAC装置,与蓝牙从机设备同步播放音频,其中,蓝牙从机设备从蓝牙数据包中获取第三音频数据包,对第三音频数据包进行解码,获取第二时域PCM数据,将第二时域PCM数据发送至蓝牙从机设备的DAC装置并播放音频。Send the first time-domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth slave device, wherein the Bluetooth slave device obtains the third audio data packet from the Bluetooth data packet, decodes the third audio data packet, and obtains The second time domain PCM data is sent to the DAC device of the Bluetooth slave device and audio is played.

一种蓝牙设备音频处理系统,包括:An audio processing system for a Bluetooth device, comprising:

音频预处理单元,用于在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;an audio preprocessing unit, configured to preprocess the first audio data packet to obtain channel-independent frequency domain data when receiving the first audio data packet to be played;

音频编码单元,用于对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;an audio coding unit, configured to compress and encode the frequency domain data of different channels respectively, and obtain the second audio data packet of the corresponding channel;

音频分配单元,用于根据蓝牙从机设备的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;The audio distribution unit is used to select the third audio data packet from each second audio data packet according to the audio playback requirement of the Bluetooth slave device, wherein the third audio data packet corresponds to the channel in the audio playback requirement;

音频传输单元,用于将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备。The audio transmission unit is used to encapsulate the third audio data packet into the Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device.

根据上述蓝牙设备音频处理系统,音频预处理单元在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,音频编码单元对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,音频分配单元按照蓝牙从机设备的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,音频传输单元将第三音频数据包封装至蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备,蓝牙从机设备可以播放对应声道的音频;上述系统可以应用在蓝牙主机设备中,对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。According to the above-mentioned audio processing system for Bluetooth devices, when the audio preprocessing unit receives the first audio data packet to be played, it preprocesses it to obtain channel-independent frequency domain data. The data is respectively compressed and encoded to obtain the corresponding second audio data packet, the audio distribution unit selects the third audio data packet of the corresponding channel from the second audio data packet according to the audio playback requirements of the Bluetooth slave device, and the audio transmission unit will The third audio data packet is encapsulated into a bluetooth data packet, and the bluetooth data packet is transmitted to the bluetooth slave device, and the bluetooth slave device can play the audio of the corresponding channel; the above system can be applied to the bluetooth host device to compress the audio data Encoding, transmits the audio data packets of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, which can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and maintain the audio when the Bluetooth slave device plays independent audio channels. sound quality, thereby improving the performance of your Bluetooth device.

一种可读存储介质,可读存储介质上存储有可执行程序,该可执行程序被处理器执行时实现上述蓝牙设备音频处理方法的步骤。A readable storage medium, on which an executable program is stored, when the executable program is executed by a processor, implements the steps of the above-mentioned Bluetooth device audio processing method.

上述可读存储介质,通过其存储的可执行程序,实现了对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输确定对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned readable storage medium, through the executable program stored therein, realizes the compression and coding of audio data, and transmits the audio data packets of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, which can greatly reduce the amount of audio data transmission, The corresponding buffer space is reduced, and the audio quality is maintained when the Bluetooth slave device plays audio, thereby improving the performance of the Bluetooth device.

一种蓝牙主机设备,包括存储器和处理器,存储器存储有可执行程序,处理器执行可执行程序时实现上述蓝牙设备音频处理方法的步骤。A Bluetooth host device includes a memory and a processor, the memory stores an executable program, and the processor implements the steps of the above Bluetooth device audio processing method when the executable program is executed.

上述蓝牙主机设备,通过在处理器上运行可执行程序,实现了对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输确定对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned Bluetooth host device, by running an executable program on the processor, realizes the compression and encoding of audio data, and transmits the audio data packets of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, which can greatly reduce the amount of audio data transmission. , reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays audio, thereby improving the performance of the Bluetooth device.

一种蓝牙设备音频处理方法,包括以下步骤:A Bluetooth device audio processing method, comprising the following steps:

从蓝牙主机设备接收上述的蓝牙数据包,从蓝牙数据包中获取第三音频数据包;Receive the above-mentioned Bluetooth data packet from the Bluetooth host device, and obtain the third audio data packet from the Bluetooth data packet;

对第三音频数据包进行解析,获得包头信息和包内数据;Analyze the third audio data packet to obtain packet header information and data in the packet;

对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;Verify the packet header information, and if the verification passes, parse the data in the packet to obtain the target frequency domain data;

将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至本地DAC装置,与蓝牙主机设备同步播放音频,其中,蓝牙主机设备根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频。Convert the target frequency domain data into second time domain PCM data, send the second time domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth host device, wherein the Bluetooth host device according to audio playback requirements from each second audio data The fourth audio data packet is selected from the packet, the fourth audio data packet is decoded, the first time domain PCM data is obtained, the first time domain PCM data is sent to the DAC device of the Bluetooth host device, and the audio is played.

根据上述蓝牙设备音频处理方法,其是从蓝牙主机设备接收上述方法中的蓝牙数据包,从中获取第三音频数据包,对其进行校验和解析,获取目标频域数据并转化成第二时域PCM数据,由本地DAC设备播放第二时域PCM数据,同时,蓝牙主机设备根据音频播放需求选取第四音频数据包,对其进行解码,获取第一时域PCM数据,并由蓝牙主机设备的DAC设备播放第一时域PCM数据,本地DAC设备与蓝牙主机设备的DAC设备同步播放音频;上述方法可以应用在蓝牙从机设备中,蓝牙从机设备接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。According to the above-mentioned Bluetooth device audio processing method, the Bluetooth data packet in the above method is received from the Bluetooth host device, a third audio data packet is obtained therefrom, a checksum is performed on it, and the target frequency domain data is obtained and converted into a second audio data packet. domain PCM data, the second time domain PCM data is played by the local DAC device, and at the same time, the Bluetooth host device selects the fourth audio data packet according to the audio playback requirements, decodes it, obtains the first time domain PCM data, and sends it to the Bluetooth host device. The DAC device plays the first time-domain PCM data, and the local DAC device plays audio synchronously with the DAC device of the Bluetooth host device; the above method can be applied to the Bluetooth slave device, and the Bluetooth slave device receives the Bluetooth containing the independent channel audio data packets. Data, independent channel audio data packets are compressed and encoded data, the amount of audio data is small, which can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays audio with independent channels, Thereby improving the performance of the Bluetooth device.

一种蓝牙设备音频处理系统,包括:An audio processing system for a Bluetooth device, comprising:

音频接收单元,用于从蓝牙主机设备接收上述的蓝牙数据包,从蓝牙数据包中获取第三音频数据包;an audio receiving unit, configured to receive the above-mentioned Bluetooth data packet from the Bluetooth host device, and obtain a third audio data packet from the Bluetooth data packet;

校验解析单元,用于对第三音频数据包进行解析,获得包头信息和包内数据;对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;a verification parsing unit, configured to parse the third audio data packet to obtain packet header information and data in the packet; verify the packet header information, and if the verification passes, parse the data in the packet to obtain target frequency domain data;

转化传输单元,用于将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至本地DAC装置,与蓝牙主机设备同步播放音频,其中,蓝牙主机设备根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频。The conversion and transmission unit is used to convert the target frequency domain data into the second time domain PCM data, send the second time domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth host device, wherein the Bluetooth host device is based on audio playback requirements. Select the fourth audio data packet from each second audio data packet, decode the fourth audio data packet, obtain the first time domain PCM data, send the first time domain PCM data to the DAC device of the Bluetooth host device and play the audio .

一种可读存储介质,可读存储介质上存储有可执行程序,该可执行程序被处理器执行时实现上述蓝牙设备音频处理方法的步骤。A readable storage medium, on which an executable program is stored, when the executable program is executed by a processor, implements the steps of the above-mentioned Bluetooth device audio processing method.

上述可读存储介质,通过其存储的可执行程序,实现了接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned readable storage medium, through the executable program stored therein, realizes receiving Bluetooth data including independent channel audio data packets, independent channel audio data packets are compressed encoded data, and the audio data volume is small, which can greatly reduce the transmission of audio data. The corresponding buffer space is reduced, and the audio quality is maintained when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

一种蓝牙从机设备,包括存储器和处理器,存储器存储有可执行程序,处理器执行可执行程序时实现上述蓝牙设备音频处理方法的步骤。A Bluetooth slave device includes a memory and a processor, the memory stores an executable program, and the processor implements the steps of the audio processing method for a Bluetooth device when the executable program is executed.

上述蓝牙从机设备,通过在处理器上运行可执行程序,实现了接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned Bluetooth slave device, by running an executable program on the processor, realizes receiving Bluetooth data including independent channel audio data packets. The independent channel audio data packets are compressed and encoded data, and the amount of audio data is small, which can greatly reduce the audio frequency. The data transmission volume reduces the corresponding buffer space, and at the same time maintains the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

一种蓝牙设备,包括蓝牙主机设备和蓝牙从机设备;A Bluetooth device, including a Bluetooth host device and a Bluetooth slave device;

蓝牙主机设备在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;根据蓝牙从机设备的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备;When the Bluetooth host device receives the first audio data packet to be played, it preprocesses the first audio data packet to obtain channel-independent frequency domain data; compresses and encodes the frequency domain data of different channels to obtain the corresponding frequency domain data. The second audio data packet of the channel; according to the audio playback requirements of the Bluetooth slave device, a third audio data packet is selected from each second audio data packet, wherein the third audio data packet is the same as the channel in the audio playback requirements. Corresponding; encapsulate the third audio data packet into the Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device;

蓝牙主机设备根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备的DAC装置。The Bluetooth host device selects the fourth audio data packet from the second audio data packets according to the audio playback requirements, decodes the fourth audio data packet, obtains the first time-domain PCM data, and sends the first time-domain PCM data to the Bluetooth host. device's DAC unit.

蓝牙从机设备从接收到的蓝牙数据包中获取第三音频数据包;对第三音频数据包进行解析,获得包头信息和包内数据;对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至蓝牙从机设备的DAC装置,与蓝牙主机设备的DAC装置同步播放音频。The Bluetooth slave device obtains the third audio data packet from the received Bluetooth data packet; parses the third audio data packet to obtain the packet header information and the data in the packet; verifies the packet header information, if the verification passes, the packet Analyze the internal data to obtain the target frequency domain data; convert the target frequency domain data into the second time domain PCM data, send the second time domain PCM data to the DAC device of the Bluetooth slave device, and synchronize with the DAC device of the Bluetooth host device Play audio.

附图说明Description of drawings

图1是一个实施例中蓝牙设备音频处理方法的应用场景图;1 is an application scenario diagram of a Bluetooth device audio processing method in one embodiment;

图2是一个实施例中蓝牙设备音频处理方法的流程示意图;Fig. 2 is a schematic flowchart of a method for audio processing of a Bluetooth device in one embodiment;

图3是一个实施例中蓝牙设备音频处理系统的结构示意图;3 is a schematic structural diagram of a Bluetooth device audio processing system in one embodiment;

图4是另一个实施例中蓝牙设备音频处理系统的结构示意图;4 is a schematic structural diagram of a Bluetooth device audio processing system in another embodiment;

图5是另一个实施例中蓝牙设备音频处理方法的流程示意图;5 is a schematic flowchart of a Bluetooth device audio processing method in another embodiment;

图6是又一个实施例中蓝牙设备音频处理系统的结构示意图;6 is a schematic structural diagram of a Bluetooth device audio processing system in another embodiment;

图7是一个实施例中蓝牙设备的关系示意图;7 is a schematic diagram of the relationship of a Bluetooth device in one embodiment;

图8是一个实施例中蓝牙主机设备处理音频数据包的流程示意图;8 is a schematic flow chart of a Bluetooth host device processing an audio data packet in one embodiment;

图9是一个实施例中蓝牙主机设备处理频域数据的流程示意图;9 is a schematic flowchart of a Bluetooth host device processing frequency domain data in one embodiment;

图10是一个实施例中音频数据包封装格式示意图。FIG. 10 is a schematic diagram of an audio data packet encapsulation format in one embodiment.

具体实施方式Detailed ways

为使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步的详细说明。应当理解,此处所描述的具体实施方式仅仅用以解释本发明,并不限定本发明的保护范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, and do not limit the protection scope of the present invention.

需要说明的是,本发明实施例所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序。应该理解“第一\第二\第三”区分的对象在适当情况下可以互换,以使这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。It should be noted that the term "first\second\third" involved in the embodiments of the present invention is only to distinguish similar objects, and does not represent a specific ordering of objects. It is understandable that "first\second\" "Third" may interchange a specific order or sequence where permitted. It should be understood that the "first\second\third" distinctions may be interchanged under appropriate circumstances to enable the embodiments of the invention described herein to be practiced in sequences other than those illustrated or described herein.

本申请提供的蓝牙设备音频处理方法,可以应用于如图1所示的应用环境中。其中,蓝牙主机设备与蓝牙从机设备进行通信。蓝牙主机设备在接收到待播放的音频数据包时,对音频数据包进行处理,根据蓝牙从机设备的音频播放需求,选取相应声道的音频数据包,将其封装至蓝牙数据包中并传输至蓝牙从机设备,蓝牙从机设备提取蓝牙数据包中的音频数据,对其进行处理和播放。其中,蓝牙主机设备和蓝牙从机设备均可以是各种具备蓝牙通信和音频播放功能的设备,如个人计算机、笔记本电脑、掌上电脑、智能手机、平板电脑、便携式可穿戴设备、蓝牙音箱等,蓝牙从机设备可以有多个。The audio processing method for a Bluetooth device provided in this application can be applied to the application environment shown in FIG. 1 . Among them, the Bluetooth host device communicates with the Bluetooth slave device. When the Bluetooth host device receives the audio data packet to be played, it processes the audio data packet, selects the audio data packet of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, encapsulates it into the Bluetooth data packet and transmits it. To the Bluetooth slave device, the Bluetooth slave device extracts the audio data in the Bluetooth data packet, processes and plays it. Among them, both the Bluetooth host device and the Bluetooth slave device can be various devices with Bluetooth communication and audio playback functions, such as personal computers, notebook computers, PDAs, smart phones, tablet computers, portable wearable devices, Bluetooth speakers, etc. There can be multiple Bluetooth slave devices.

参见图2所示,为本发明一个实施例的蓝牙设备音频处理方法的流程示意图。该实施例中的蓝牙设备音频处理方法包括以下步骤:Referring to FIG. 2 , it is a schematic flowchart of an audio processing method for a Bluetooth device according to an embodiment of the present invention. The Bluetooth device audio processing method in this embodiment includes the following steps:

步骤S110:在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;Step S110: when receiving the first audio data packet to be played, preprocessing the first audio data packet to obtain channel-independent frequency domain data;

在本步骤中,待播放的第一音频数据包可以是从外界接收的音频数据,第一音频数据包可以保存在本地的缓存空间中;不同声道的频域数据有所不同,声道独立的频域数据的数据量小于原始音频数据的数据量;In this step, the first audio data packet to be played may be audio data received from the outside world, and the first audio data packet may be stored in the local buffer space; the frequency domain data of different channels are different, and the channels are independent The data volume of the frequency domain data is less than the data volume of the original audio data;

步骤S120:对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;Step S120: compressing and encoding the frequency domain data of different channels respectively, and obtaining the second audio data packet of the corresponding channel;

在本步骤中,不同声道的频域数据是需要进行播放的声道对应的频域数据,在进行双声道播放时,有两个声道的频域数据;在进行四声道播放时,有四个声道的频域数据;In this step, the frequency-domain data of different channels is the frequency-domain data corresponding to the channel that needs to be played. When performing two-channel playback, there are two-channel frequency-domain data; when performing four-channel playback , there are four channels of frequency domain data;

步骤S130:根据蓝牙从机设备的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;Step S130: According to the audio playback requirement of the Bluetooth slave device, select a third audio data packet from each second audio data packet, wherein the third audio data packet corresponds to the channel in the audio playback requirement;

在本步骤中,蓝牙从机设备根据音频播放需求使用相应的声道进行音频播放;In this step, the Bluetooth slave device uses the corresponding channel for audio playback according to the audio playback requirements;

步骤S140:将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备。Step S140: Encapsulate the third audio data packet into a Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device.

在本步骤中,第三音频数据包封装在蓝牙数据包中,以蓝牙信号的形式传输至蓝牙从机设备,蓝牙从机设备可以对第三音频数据包中的音频数据进行播放。In this step, the third audio data packet is encapsulated in a Bluetooth data packet and transmitted to the Bluetooth slave device in the form of a Bluetooth signal, and the Bluetooth slave device can play the audio data in the third audio data packet.

在本实施例中,在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,按照蓝牙从机设备的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,封装至蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备,蓝牙从机设备可以播放对应声道的音频;上述方法可以应用在蓝牙主机设备中,蓝牙主机设备对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。In this embodiment, when the first audio data packet to be played is received, it is preprocessed to obtain frequency domain data with independent channels, and the frequency domain data of independent channels are respectively compressed and encoded to obtain the corresponding The second audio data packet, according to the audio playback requirements of the Bluetooth slave device, selects the third audio data packet corresponding to the channel from the second audio data packet, encapsulates it into the Bluetooth data packet, and transmits the Bluetooth data packet to the Bluetooth slave device. device, the bluetooth slave device can play the audio of the corresponding channel; the above method can be applied to the bluetooth host device, the bluetooth host device compresses and encodes the audio data, and transmits the audio data of the corresponding channel according to the audio playback requirements of the bluetooth slave device The package can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

需要说明的是,将蓝牙数据包传输至蓝牙从机设备之前,已与蓝牙从机设备建立起蓝牙连接,接收的待播放的第一音频数据包可以是来自手机端或其他音频数据发送端的音频数据。It should be noted that, before the Bluetooth data packet is transmitted to the Bluetooth slave device, a Bluetooth connection has been established with the Bluetooth slave device, and the received first audio data packet to be played may be the audio from the mobile phone or other audio data sender. data.

在一个实施例中,对第一音频数据包进行预处理,获得声道独立的频域数据的步骤包括以下步骤:In one embodiment, the step of preprocessing the first audio data packet to obtain channel-independent frequency domain data includes the following steps:

对第一音频数据包进行解析,获得音频帧头和帧内数据;Analyze the first audio data packet to obtain the audio frame header and intra-frame data;

对音频帧头进行CRC校验,若校验通过,对帧内数据进行位流分配、反量化和立体声处理,获得频域数据。CRC check is performed on the audio frame header. If the check is passed, bit stream allocation, inverse quantization and stereo processing are performed on the data in the frame to obtain frequency domain data.

在本实施例中,对第一音频数据包进行预处理时,解析得到其中的音频帧头和帧内数据,先对音频帧头进行CRC校验(Cyclic Redundancy Check,循环冗余检验),查验第一音频数据包中帧头信息是否正确,在CRC校验通过的条件下,表明第一音频数据包中的数据准确,未收到干扰,可以对帧内数据进行位流分配、反量化和立体声处理等操作,获得对应声道的频域数据;进行CRC校验可以确保接收到的音频数据的完整性,获取准确的独立声道的频域数据。In this embodiment, when the first audio data packet is preprocessed, the audio frame header and intra-frame data are obtained by parsing, and the audio frame header is first subjected to a CRC check (Cyclic Redundancy Check, cyclic redundancy check), and the Whether the frame header information in the first audio data packet is correct, and under the condition that the CRC check is passed, indicates that the data in the first audio data packet is accurate and has not received interference, and the intra-frame data can be subjected to bit stream allocation, inverse quantization and Stereo processing and other operations to obtain the frequency domain data of the corresponding channel; CRC check can ensure the integrity of the received audio data and obtain accurate independent channel frequency domain data.

进一步的,若CRC校验未通过,表明第一音频数据包数据有误或是校验过程出错,可以不对音频数据进行后续操作,重新对第一音频数据包进行解析,或者,向发送第一音频数据包的终端发起重发请求,重新接收第一音频数据包。Further, if the CRC check fails, it indicates that the data of the first audio data packet is incorrect or that the verification process is wrong, and the audio data may not be subjected to follow-up operations, and the first audio data packet may be parsed again, or, the first audio data packet may be sent to the first audio data packet. The terminal of the audio data packet initiates a retransmission request, and re-receives the first audio data packet.

在一个实施例中,对音频帧头进行CRC校验的步骤包括以下步骤:In one embodiment, the step of performing CRC check on the audio frame header includes the following steps:

获取音频帧头中的目标信息,目标信息包括声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子和第一CRC校验值;Obtain the target information in the audio frame header, the target information includes channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, scaling factor and the first CRC check value;

根据声道模式、采样率、码率、块模式、位流分配模式、子带模式和缩放因子获取第二CRC校验值,若第一CRC校验值与第二CRC校验值一致,判定CRC校验通过。Obtain the second CRC check value according to the channel mode, sampling rate, code rate, block mode, bit stream allocation mode, sub-band mode and scaling factor. If the first CRC check value is consistent with the second CRC check value, determine CRC check passed.

在本实施例中,对音频帧头进行解析,获取其中的声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子和第一CRC校验值等信息,第一CRC校验值是原先记录在音频帧头中用于校验比较,利用上述声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子等信息计算第二CRC校验值,并与第一CRC校验值相比较,若一致,表明音频信息未发生改变,音频数据正常,可以判定CRC校验通过,利用音频属性信息进行校验可以保证数据传输的正确性和完整性。In this embodiment, the audio frame header is parsed to obtain information such as channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, scaling factor, and the first CRC check value, etc., The first CRC check value is originally recorded in the audio frame header for verification and comparison, and is calculated by using the above-mentioned information such as channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, and scaling factor. The second CRC check value is compared with the first CRC check value. If it is consistent, it indicates that the audio information has not changed and the audio data is normal. It can be determined that the CRC check is passed, and the audio attribute information can be used to verify the data transmission. correctness and completeness.

在一个实施例中,对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包的步骤包括以下步骤:In one embodiment, the frequency domain data of different channels are respectively compressed and encoded, and the step of acquiring the second audio data packet of the corresponding channel includes the following steps:

根据编码参数对任一声道的频域数据进行位流分配、量化和主数据封装,获得独立声道的编码数据;Perform bit stream allocation, quantization and main data encapsulation on the frequency domain data of any channel according to the encoding parameters, to obtain the encoded data of the independent channel;

对独立声道的编码数据进行封装,获取第二音频数据包。The encoded data of the independent channel is encapsulated to obtain a second audio data packet.

在本实施例中,不同的编码方法对频域数据的处理过程不同,可以参考编码参数对频域数据进行处理,经过位流分配、量化和主数据封装,获得独立声道的编码数据,进而得到第二音频数据包,通过上述方式可以完成独立声道的频域数据的编码,并使第二音频数据包与声道相对应。In this embodiment, different coding methods have different processing procedures for frequency domain data. The frequency domain data can be processed with reference to coding parameters, and the coded data of independent channels can be obtained through bit stream allocation, quantization and main data encapsulation. The second audio data packet is obtained, and the encoding of the frequency domain data of the independent channel can be completed by the above method, and the second audio data packet is corresponding to the channel.

在一个实施例中,对独立声道的编码数据进行封装的步骤包括以下步骤:In one embodiment, the step of encapsulating the encoded data of the independent channels includes the following steps:

根据编码数据获取音频属性信息,根据音频属性信息获取第三CRC校验值,将音频属性信息和第三CRC校验值作为包头信息,将编码数据作为包内主数据,生成第二音频数据包。Obtain audio attribute information according to the encoded data, obtain a third CRC check value according to the audio attribute information, use the audio attribute information and the third CRC check value as packet header information, use the encoded data as main data in the packet, and generate a second audio data packet .

在本实施例中,在生成第二音频数据包时,在数据包中需要添加必要的包头信息,该包头信息主要包括音频属性信息,利用该音频属性信息可以获取第三CRC校验值,并附加在包头信息中,用于对第二音频数据包进行校验,确保第二音频数据包可以被完整正确地接收。In this embodiment, when generating the second audio data packet, necessary header information needs to be added to the data packet, the packet header information mainly includes audio attribute information, and the third CRC check value can be obtained by using the audio attribute information, and It is attached to the packet header information for checking the second audio data packet to ensure that the second audio data packet can be received completely and correctly.

进一步的,音频属性信息可以包括包同步字、音频基本信息、能量等级、包号信息、包内帧数信息等,包内帧数信息与第二音频数据包中编码数据的帧数对应,音频基本信息包括码率信息,同一音频数据包中码率固定,不同音频数据包中码率可变,不同音频数据包可包含不同的帧数,由包头信息中的包内帧数信息指示。需要说明的是,第二音频数据包与声道相对应,对应独立声道可以有多个第二音频数据包。Further, the audio attribute information may include packet synchronization word, audio basic information, energy level, packet number information, frame number information in the packet, etc. The frame number information in the packet corresponds to the frame number of the encoded data in the second audio data packet, and the audio The basic information includes code rate information. The code rate in the same audio data packet is fixed, and the code rate in different audio data packets is variable. Different audio data packets can contain different frame numbers, which are indicated by the frame number information in the packet header information. It should be noted that the second audio data packet corresponds to a channel, and there may be multiple second audio data packets corresponding to an independent channel.

进一步的,可以根据音频数据包内每一帧的点数、采样率计算出已压缩的一帧数据的长度,对每一帧压缩数据进行字节对齐处理,以节省数据容量。Further, the length of a compressed frame of data can be calculated according to the number of points and the sampling rate of each frame in the audio data packet, and byte alignment processing is performed on each frame of compressed data to save data capacity.

在一个实施例中,蓝牙设备音频处理方法还包括以下步骤:In one embodiment, the Bluetooth device audio processing method further includes the following steps:

根据本地的音频播放需求,从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据;According to local audio playback requirements, select a fourth audio data packet from each second audio data packet, decode the fourth audio data packet, and obtain the first time-domain PCM data;

将第一时域PCM数据发送至本地DAC装置,与蓝牙从机设备同步播放音频,其中,蓝牙从机设备从蓝牙数据包中获取第三音频数据包,对第三音频数据包进行解码,获取第二时域PCM数据,将第二时域PCM数据发送至蓝牙从机设备的DAC装置并播放音频。Send the first time-domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth slave device, wherein the Bluetooth slave device obtains the third audio data packet from the Bluetooth data packet, decodes the third audio data packet, and obtains The second time domain PCM data is sent to the DAC device of the Bluetooth slave device and audio is played.

在本实施例中,本地可按播放需求选取第四音频数据包,并对其进行解码,得到第一时域PCM(Pulse Code Modulation,脉冲编码调制)数据,并发送至本地DAC(Digital toanalog converter,数字模拟转换)装置,DAC装置可以直接播放已经解码的时域PCM数据;蓝牙从机设备在获取第三音频数据包以后,解码获取第二时域PCM数据,发送至蓝牙从机设备的DAC装置,与本地DAC装置同步播放音频,实现音频立体声的听音效果。In this embodiment, the fourth audio data packet can be selected locally according to the playback requirements, and decoded to obtain the first time-domain PCM (Pulse Code Modulation, pulse code modulation) data, and sent to the local DAC (Digital toanalog converter) , digital-to-analog conversion) device, the DAC device can directly play the decoded time-domain PCM data; after the Bluetooth slave device obtains the third audio data packet, it decodes to obtain the second time-domain PCM data, and sends it to the DAC of the Bluetooth slave device The device plays audio synchronously with the local DAC device to realize the audio stereo listening effect.

根据上述蓝牙设备音频处理方法,本发明实施例还提供一种蓝牙设备音频处理系统,以下就本发明的蓝牙设备音频处理系统的实施例进行详细说明。According to the above-mentioned Bluetooth device audio processing method, an embodiment of the present invention further provides a Bluetooth device audio processing system, and the embodiments of the Bluetooth device audio processing system of the present invention are described in detail below.

参见图3所示,为本发明一个实施例的蓝牙设备音频处理系统的结构示意图。该实施例中的蓝牙设备音频处理系统包括:Referring to FIG. 3 , it is a schematic structural diagram of an audio processing system for a Bluetooth device according to an embodiment of the present invention. The Bluetooth device audio processing system in this embodiment includes:

音频预处理单元210,用于在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;The audio preprocessing unit 210 is configured to preprocess the first audio data packet to obtain channel-independent frequency domain data when receiving the first audio data packet to be played;

音频编码单元220,用于对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;The audio coding unit 220 is used to compress and encode the frequency domain data of different channels respectively, and obtain the second audio data packet of the corresponding channel;

音频分配单元230,用于根据蓝牙从机设备的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;The audio distribution unit 230 is used to select the third audio data packet from each second audio data packet according to the audio playback requirement of the Bluetooth slave device, wherein the third audio data packet corresponds to the channel in the audio playback requirement;

音频传输单元240,用于将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备。The audio transmission unit 240 is configured to encapsulate the third audio data packet into the Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device.

在本实施例中,音频预处理单元在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,音频编码单元对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,音频分配单元按照蓝牙从机设备的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,音频传输单元将第三音频数据包封装至蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备,蓝牙从机设备可以播放对应声道的音频;上述系统可以应用在蓝牙主机设备中,对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。In this embodiment, the audio preprocessing unit preprocesses the to-be-played first audio data packet to obtain channel-independent frequency-domain data, and the audio coding unit separately processes the frequency-domain data of the independent channel Compression coding is performed to obtain the corresponding second audio data packet, the audio distribution unit selects the third audio data packet of the corresponding channel from the second audio data packet according to the audio playback requirements of the Bluetooth slave device, and the audio transmission unit transfers the third audio data packet. The audio data packet is encapsulated into a Bluetooth data packet, and the Bluetooth data packet is transmitted to the Bluetooth slave device, and the Bluetooth slave device can play the audio of the corresponding channel; the above system can be applied to the Bluetooth host device to compress and encode the audio data, According to the audio playback requirements of the Bluetooth slave device, the audio data packets of the corresponding channel can be transmitted, which can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays independent audio channels. Thereby improving the performance of the Bluetooth device.

在一个实施例中,音频预处理单元210对第一音频数据包进行解析,获得音频帧头和帧内数据;对音频帧头进行CRC校验,若校验通过,对帧内数据进行位流分配、反量化和立体声处理,获得频域数据。In one embodiment, the audio preprocessing unit 210 parses the first audio data packet to obtain an audio frame header and intra-frame data; performs CRC check on the audio frame header, and if the check is passed, performs a bit stream on the intra-frame data Distribution, inverse quantization and stereo processing to obtain frequency domain data.

在其中一个实施例中,音频预处理单元210获取音频帧头中的目标信息,目标信息包括声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子和第一CRC校验值;根据声道模式、采样率、码率、块模式、位流分配模式、子带模式和缩放因子获取第二CRC校验值,若第一CRC校验值与第二CRC校验值一致,判定CRC校验通过。In one embodiment, the audio preprocessing unit 210 obtains target information in the audio frame header, and the target information includes channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, scaling factor and A CRC check value; obtain the second CRC check value according to the channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode and scaling factor, if the first CRC check value and the second CRC check value are If the check value is consistent, it is determined that the CRC check is passed.

在其中一个实施例中,音频编码单元220根据编码参数对任一声道的频域数据进行位流分配、量化和主数据封装,获得独立声道的编码数据;对独立声道的编码数据进行封装,获取第二音频数据包。In one of the embodiments, the audio coding unit 220 performs bit stream allocation, quantization and main data encapsulation on the frequency domain data of any channel according to the coding parameters to obtain the coded data of the independent channel; encapsulate to obtain a second audio data packet.

在其中一个实施例中,音频编码单元220根据编码数据获取音频属性信息,根据音频属性信息获取第三CRC校验值,将音频属性信息和第三CRC校验值作为包头信息,将编码数据作为包内主数据,生成第二音频数据包。In one embodiment, the audio encoding unit 220 obtains audio attribute information according to the encoded data, obtains a third CRC check value according to the audio attribute information, uses the audio attribute information and the third CRC check value as packet header information, and uses the encoded data as The main data in the package generates the second audio data package.

在其中一个实施例中,如图4所示,蓝牙设备音频处理系统还包括音频转换单元250;In one of the embodiments, as shown in FIG. 4 , the audio processing system for the Bluetooth device further includes an audio conversion unit 250;

音频转换单元250用于根据本地的音频播放需求,从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据;将第一时域PCM数据发送至本地DAC装置,与蓝牙从机设备同步播放音频;其中,蓝牙从机设备从蓝牙数据包中获取第三音频数据包,对第三音频数据包进行解码,获取第二时域PCM数据,将第二时域PCM数据发送至蓝牙从机设备的DAC装置并播放音频。The audio conversion unit 250 is used to select a fourth audio data packet from each second audio data packet according to local audio playback requirements, decode the fourth audio data packet, and obtain the first time domain PCM data; The PCM data is sent to the local DAC device, and the audio is played synchronously with the Bluetooth slave device; wherein, the Bluetooth slave device obtains the third audio data packet from the Bluetooth data packet, decodes the third audio data packet, and obtains the second time domain PCM. data, send the second time-domain PCM data to the DAC device of the Bluetooth slave device and play audio.

本发明的蓝牙设备音频处理系统与本发明的蓝牙设备音频处理方法相对应,在上述蓝牙设备音频处理方法的实施例中阐述的技术特征及其有益效果均适用于蓝牙设备音频处理系统的实施例中。The Bluetooth device audio processing system of the present invention corresponds to the Bluetooth device audio processing method of the present invention, and the technical features and beneficial effects described in the above embodiments of the Bluetooth device audio processing method are all applicable to the embodiments of the Bluetooth device audio processing system middle.

根据上述蓝牙设备音频处理方法,本发明实施例还提供一种可读存储介质和一种蓝牙主机设备。According to the above-mentioned audio processing method for a Bluetooth device, an embodiment of the present invention further provides a readable storage medium and a Bluetooth host device.

一种可读存储介质,其上存储有可执行程序,该可执行程序被处理器执行时实现上述蓝牙设备音频处理方法的步骤。A readable storage medium on which an executable program is stored, and when the executable program is executed by a processor, implements the steps of the above-mentioned audio processing method for a Bluetooth device.

上述可读存储介质,通过其存储的可执行程序,实现了对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输确定对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned readable storage medium, through the executable program stored therein, realizes the compression and coding of audio data, and transmits the audio data packets of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, which can greatly reduce the amount of audio data transmission, The corresponding buffer space is reduced, and the audio quality is maintained when the Bluetooth slave device plays audio, thereby improving the performance of the Bluetooth device.

一种蓝牙主机设备,包括存储器和处理器,存储器存储有可执行程序,处理器执行可执行程序时实现上述蓝牙设备音频处理方法的步骤。A Bluetooth host device includes a memory and a processor, the memory stores an executable program, and the processor implements the steps of the above Bluetooth device audio processing method when the executable program is executed.

上述蓝牙主机设备,通过在处理器上运行可执行程序,实现了对音频数据进行压缩编码,根据蓝牙从机设备的音频播放需求传输确定对应声道的音频数据包,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned Bluetooth host device, by running an executable program on the processor, realizes the compression and encoding of audio data, and transmits the audio data packets of the corresponding channel according to the audio playback requirements of the Bluetooth slave device, which can greatly reduce the amount of audio data transmission. , reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays audio, thereby improving the performance of the Bluetooth device.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,程序可存储于一非易失性的计算机可读取存储介质中,如实施例中,该程序可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述蓝牙设备音频处理方法的实施例的流程。其中,存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(RandomAccess Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, In an embodiment, the program may be stored in a storage medium of a computer system and executed by at least one processor in the computer system to implement the process including the above-mentioned embodiment of the audio processing method for a Bluetooth device. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.

根据上述蓝牙设备音频处理方法,本发明实施例还提供另一种蓝牙设备音频处理方法,以下就本发明的另一种蓝牙设备音频处理方法的实施例进行详细说明。According to the above-mentioned Bluetooth device audio processing method, the embodiment of the present invention further provides another Bluetooth device audio processing method, and an embodiment of another Bluetooth device audio processing method of the present invention will be described in detail below.

参见图5所示,为本发明一个实施例的蓝牙设备音频处理方法的流程示意图。该实施例中的蓝牙设备音频处理方法包括以下步骤:Referring to FIG. 5, it is a schematic flowchart of an audio processing method for a Bluetooth device according to an embodiment of the present invention. The Bluetooth device audio processing method in this embodiment includes the following steps:

步骤S310:从蓝牙主机设备接收上述的蓝牙数据包,从蓝牙数据包中获取第三音频数据包;Step S310: Receive the above-mentioned Bluetooth data packet from the Bluetooth host device, and obtain a third audio data packet from the Bluetooth data packet;

步骤S320:对第三音频数据包进行解析,获得包头信息和包内数据;Step S320: parse the third audio data packet to obtain packet header information and data in the packet;

步骤S330:对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;Step S330: Verify the packet header information, and if the verification passes, parse the data in the packet to obtain target frequency domain data;

步骤S340:将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至本地DAC装置,与蓝牙主机设备同步播放音频,其中,蓝牙主机设备根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频。Step S340: Convert the target frequency domain data into the second time domain PCM data, send the second time domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth host device, wherein the Bluetooth host device according to the audio playback requirements The fourth audio data packet is selected from the two audio data packets, the fourth audio data packet is decoded, the first time domain PCM data is obtained, the first time domain PCM data is sent to the DAC device of the Bluetooth host device, and the audio is played.

在本实施例中,从蓝牙主机设备接收上述方法中的蓝牙数据包,从中获取第三音频数据包,对其进行校验和解析,获取目标频域数据并转化成第二时域PCM数据,由本地DAC设备播放第二时域PCM数据,同时,蓝牙主机设备根据音频播放需求选取第四音频数据包,对其进行解码,获取第一时域PCM数据,并由蓝牙主机设备的DAC设备播放第一时域PCM数据,本地DAC设备与蓝牙主机设备的DAC设备同步播放音频;上述方法可以应用在蓝牙从机设备中,蓝牙从机设备接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。In this embodiment, the Bluetooth data packet in the above method is received from a Bluetooth host device, a third audio data packet is obtained therefrom, a checksum is performed on it, and target frequency domain data is obtained and converted into second time domain PCM data, The second time-domain PCM data is played by the local DAC device, and at the same time, the Bluetooth host device selects the fourth audio data packet according to the audio playback requirements, decodes it, obtains the first time-domain PCM data, and plays it by the DAC device of the Bluetooth host device In the first time-domain PCM data, the local DAC device and the DAC device of the Bluetooth host device play audio synchronously; the above method can be applied to the Bluetooth slave device, and the Bluetooth slave device receives the Bluetooth data including the independent channel audio data packets, and the independent audio The audio data packets are compressed and encoded data, and the audio data volume is small, which can greatly reduce the amount of audio data transmission, reduce the corresponding buffer space, and maintain the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the Bluetooth device. performance.

进一步的,对第三音频数据包进行解析时,可以先校验第三音频数据包中的同步字,以此确定包头位置,获得包头信息和包内数据。Further, when analyzing the third audio data packet, the synchronization word in the third audio data packet may be checked first, thereby determining the position of the packet header, and obtaining the packet header information and the data in the packet.

需要说明的是,对包内数据进行解析时,把包内若干帧压缩的音频数据通过位流分配、反量化等处理,获取频域数据。It should be noted that, when analyzing the data in the packet, the audio data compressed by several frames in the packet is processed by bit stream allocation, inverse quantization, etc., to obtain frequency domain data.

在一个实施例中,对包头信息进行校验的步骤包括以下步骤:In one embodiment, the step of verifying the packet header information includes the following steps:

从包头信息中获取包号信息,在包号信息与上一第三音频数据包的包号信息不连续时,根据音频播放需求向蓝牙主机设备发起重发请求或补包请求。The packet number information is obtained from the packet header information, and when the packet number information is not continuous with the packet number information of the last third audio data packet, a retransmission request or a packet supplement request is initiated to the Bluetooth host device according to audio playback requirements.

在本实施例中,包号信息是用来表示第三音频数据包顺序的信息,利用当前第三音频数据包中的包号信息与接收的上一个第三音频数据包中的包号信息,判断两者是否连续,若是,表明接收的第三音频数据包连续未断;否则,表明第三音频数据包出现丢包的情况,可以向蓝牙主机设备发起重发请求或补包请求,以保证第三音频数据包的完整性,重发请求或补包请求可以根据实际的音频播放需求来选择,以适应应用需要。In this embodiment, the packet number information is information used to indicate the sequence of the third audio data packet, using the packet number information in the current third audio data packet and the packet number information in the received last third audio data packet, Determine whether the two are continuous. If so, it indicates that the received third audio data packet is not interrupted; otherwise, it indicates that the third audio data packet is lost. You can send a retransmission request or a supplementary packet request to the Bluetooth host device to ensure that The integrity of the third audio data packet, the retransmission request or the supplementary packet request can be selected according to the actual audio playback requirements to meet application needs.

在一个实施例中,对包头信息进行校验的步骤包括以下步骤:In one embodiment, the step of verifying the packet header information includes the following steps:

获取包头信息中的第三CRC校验值,根据包头信息中除第三CRC校验值外的其他信息,获取第四CRC校验值;Obtain the third CRC check value in the packet header information, and obtain the fourth CRC check value according to other information in the packet header information except the third CRC check value;

若第三CRC校验值与第四CRC校验值一致,判定校验通过。If the third CRC check value is consistent with the fourth CRC check value, it is determined that the check is passed.

在本实施例中,包头信息包括第三CRC校验值和音频数据的属性信息,利用音频属性信息计算第四CRC校验值,并与第三CRC校验值相比较,若一致,表明音频信息未发生改变,音频数据正常,可以判定CRC校验通过,利用音频属性信息进行校验可以保证数据传输的正确性和完整性。In this embodiment, the packet header information includes the third CRC check value and the attribute information of the audio data, the fourth CRC check value is calculated by using the audio attribute information, and compared with the third CRC check value, if they are consistent, it indicates that the audio If the information has not changed and the audio data is normal, it can be determined that the CRC check is passed, and the correctness and integrity of the data transmission can be ensured by using the audio attribute information to check.

需要说明的是,对包头信息的校验过程可以采用CRC校验,也可以采用其他形式的数据校验方法。It should be noted that, the verification process of the packet header information may adopt CRC verification, or may adopt other forms of data verification methods.

根据上述蓝牙设备音频处理方法,本发明实施例还提供一种蓝牙设备音频处理系统,以下就本发明的蓝牙设备音频处理系统的实施例进行详细说明。According to the above-mentioned Bluetooth device audio processing method, an embodiment of the present invention further provides a Bluetooth device audio processing system, and the embodiments of the Bluetooth device audio processing system of the present invention are described in detail below.

参见图6所示,为本发明一个实施例的蓝牙设备音频处理系统的结构示意图。该实施例中的蓝牙设备音频处理系统包括:Referring to FIG. 6, it is a schematic structural diagram of an audio processing system for a Bluetooth device according to an embodiment of the present invention. The Bluetooth device audio processing system in this embodiment includes:

音频接收单元410,用于从蓝牙主机设备接收上述的蓝牙数据包,从蓝牙数据包中获取第三音频数据包;The audio receiving unit 410 is configured to receive the above-mentioned Bluetooth data packet from the Bluetooth host device, and obtain the third audio data packet from the Bluetooth data packet;

校验解析单元420,用于对第三音频数据包进行解析,获得包头信息和包内数据;对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;The verification parsing unit 420 is used to parse the third audio data packet to obtain packet header information and data in the packet; verify the packet header information, and if the verification passes, parse the data in the packet to obtain target frequency domain data;

转化传输单元430,用于将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至本地DAC装置,与蓝牙主机设备同步播放音频,其中,蓝牙主机设备根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频。The conversion and transmission unit 430 is used to convert the target frequency domain data into second time domain PCM data, send the second time domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth host device, wherein the Bluetooth host device plays the audio according to the It is required to select a fourth audio data packet from each second audio data packet, decode the fourth audio data packet, obtain the first time-domain PCM data, and send the first time-domain PCM data to the DAC device of the Bluetooth host device and play audio.

在本实施例中,音频接收单元410从蓝牙主机设备接收上述方法中的蓝牙数据包,从中获取第三音频数据包,校验解析单元420对其进行校验和解析,获取目标频域数据,转化传输单元430将其转化成第二时域PCM数据,由本地DAC设备播放第二时域PCM数据,同时,蓝牙主机设备根据音频播放需求选取第四音频数据包,对其进行解码,获取第一时域PCM数据,并由蓝牙主机设备的DAC设备播放第一时域PCM数据,本地DAC设备与蓝牙主机设备的DAC设备同步播放音频;上述系统可以应用在蓝牙从机设备中,蓝牙从机设备接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。In this embodiment, the audio receiving unit 410 receives the Bluetooth data packet in the above method from the Bluetooth host device, obtains the third audio data packet therefrom, and the verification and parsing unit 420 checks and parses it to obtain the target frequency domain data, The conversion and transmission unit 430 converts it into the second time domain PCM data, and the second time domain PCM data is played by the local DAC device. Meanwhile, the Bluetooth host device selects the fourth audio data packet according to the audio playback requirements, decodes it, and obtains the first One time domain PCM data, and the first time domain PCM data is played by the DAC device of the Bluetooth host device, and the local DAC device and the DAC device of the Bluetooth host device play audio synchronously; the above system can be applied to the Bluetooth slave device, the Bluetooth slave device The device receives Bluetooth data including independent channel audio data packets. The independent channel audio data packets are compressed and encoded data, and the amount of audio data is small, which can greatly reduce the amount of audio data transmission and reduce the corresponding buffer space. Improves the performance of Bluetooth devices by maintaining audio quality when playing channel-independent audio.

在一个实施例中,校验解析单元420从包头信息中获取包号信息,在包号信息与上一第三音频数据包的包号信息不连续时,根据音频播放需求向蓝牙主机设备发起重发请求或补包请求。In one embodiment, the verification and parsing unit 420 obtains the packet number information from the packet header information, and when the packet number information is not continuous with the packet number information of the last third audio data packet, initiates a replay to the Bluetooth host device according to the audio playback requirement. Send a request or a supplementary request.

本发明的蓝牙设备音频处理系统与本发明的蓝牙设备音频处理方法相对应,在上述蓝牙设备音频处理方法的实施例中阐述的技术特征及其有益效果均适用于蓝牙设备音频处理系统的实施例中。The Bluetooth device audio processing system of the present invention corresponds to the Bluetooth device audio processing method of the present invention, and the technical features and beneficial effects described in the above embodiments of the Bluetooth device audio processing method are all applicable to the embodiments of the Bluetooth device audio processing system middle.

根据上述蓝牙设备音频处理方法,本发明实施例还提供一种可读存储介质和一种蓝牙从机设备。According to the above-mentioned audio processing method for a Bluetooth device, an embodiment of the present invention further provides a readable storage medium and a Bluetooth slave device.

一种可读存储介质,其上存储有可执行程序,该可执行程序被处理器执行时实现上述蓝牙设备音频处理方法的步骤。A readable storage medium on which an executable program is stored, and when the executable program is executed by a processor, implements the steps of the above-mentioned audio processing method for a Bluetooth device.

上述可读存储介质,通过其存储的可执行程序,实现了接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned readable storage medium, through the executable program stored therein, realizes receiving Bluetooth data including independent channel audio data packets, independent channel audio data packets are compressed encoded data, and the audio data volume is small, which can greatly reduce the transmission of audio data. The corresponding buffer space is reduced, and the audio quality is maintained when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

一种蓝牙从机设备,包括存储器和处理器,存储器存储有可执行程序,处理器执行可执行程序时实现上述蓝牙设备音频处理方法的步骤。A Bluetooth slave device includes a memory and a processor, the memory stores an executable program, and the processor implements the steps of the audio processing method for a Bluetooth device when the executable program is executed.

上述蓝牙从机设备,通过在处理器上运行可执行程序,实现了接收包含独立声道音频数据包的蓝牙数据,独立声道音频数据包是压缩编码数据,音频数据量小,可以大大降低音频数据传输量,减小对应的缓存空间,同时在蓝牙从机设备播放声道独立的音频时保持音频音质,从而提升蓝牙设备的性能。The above-mentioned Bluetooth slave device, by running an executable program on the processor, realizes receiving Bluetooth data including independent channel audio data packets. The independent channel audio data packets are compressed and encoded data, and the amount of audio data is small, which can greatly reduce the audio frequency. The data transmission volume reduces the corresponding buffer space, and at the same time maintains the audio quality when the Bluetooth slave device plays audio with independent channels, thereby improving the performance of the Bluetooth device.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,程序可存储于一非易失性的计算机可读取存储介质中,如实施例中,该程序可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述蓝牙设备音频处理方法的实施例的流程。其中,存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(RandomAccess Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, In an embodiment, the program can be stored in a storage medium of a computer system and executed by at least one processor in the computer system to implement the process including the above-mentioned embodiments of the Bluetooth device audio processing method. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.

根据上述蓝牙设备音频处理方法,本发明实施例还提供一种蓝牙设备,以下就本发明的一种蓝牙设备的实施例进行详细说明。According to the above-mentioned audio processing method of a Bluetooth device, an embodiment of the present invention further provides a Bluetooth device, and an embodiment of a Bluetooth device of the present invention will be described in detail below.

参见图7所示,为本发明一个实施例的蓝牙设备的结构示意图。该实施例中的蓝牙设备包括蓝牙主机设备510和蓝牙从机设备520;Referring to FIG. 7, it is a schematic structural diagram of a Bluetooth device according to an embodiment of the present invention. The Bluetooth device in this embodiment includes a Bluetooth host device 510 and a Bluetooth slave device 520;

蓝牙主机设备510在接收到待播放的第一音频数据包时,对第一音频数据包进行预处理,获得声道独立的频域数据;对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;根据蓝牙从机设备520的音频播放需求,从各第二音频数据包中选取第三音频数据包,其中,第三音频数据包与音频播放需求中的声道相对应;将第三音频数据包封装到蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备520;When receiving the first audio data packet to be played, the Bluetooth host device 510 preprocesses the first audio data packet to obtain channel-independent frequency domain data; compresses and encodes the frequency domain data of different channels to obtain The second audio data packet of the corresponding channel; according to the audio playback requirements of the Bluetooth slave device 520, a third audio data packet is selected from each second audio data packet, wherein the third audio data packet and the audio in the audio playback requirements are selected. corresponding to the channel; encapsulate the third audio data packet into a Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device 520;

蓝牙主机设备510根据音频播放需求从各第二音频数据包中选取第四音频数据包,对第四音频数据包进行解码,获取第一时域PCM数据,将第一时域PCM数据发送至蓝牙主机设备510的DAC装置。The Bluetooth host device 510 selects a fourth audio data packet from each second audio data packet according to the audio playback requirement, decodes the fourth audio data packet, obtains the first time-domain PCM data, and sends the first time-domain PCM data to the Bluetooth The DAC device of the host device 510 .

蓝牙从机设备520从接收到的蓝牙数据包中获取第三音频数据包;对第三音频数据包进行解析,获得包头信息和包内数据;对包头信息进行校验,若校验通过,对包内数据进行解析,获取目标频域数据;将目标频域数据转化为第二时域PCM数据,将第二时域PCM数据发送至蓝牙从机设备520的DAC装置,与蓝牙主机设备510的DAC装置同步播放音频。The Bluetooth slave device 520 obtains the third audio data packet from the received Bluetooth data packet; parses the third audio data packet to obtain the packet header information and the data in the packet; The data in the packet is analyzed to obtain the target frequency domain data; the target frequency domain data is converted into the second time domain PCM data, and the second time domain PCM data is sent to the DAC device of the Bluetooth slave device 520, and the Bluetooth host device 510. The DAC unit plays the audio synchronously.

在本实施例中,蓝牙主机设备510在接收到待播放的第一音频数据包时,对其进行预处理,获得声道独立的频域数据,对独立声道的频域数据分别进行压缩编码,得到相应的第二音频数据包,按照蓝牙从机设备520的音频播放需求,从第二音频数据包中选取对应声道的第三音频数据包,封装至蓝牙数据包中,将蓝牙数据包传输至蓝牙从机设备520,蓝牙从机设备520从蓝牙数据包中获取第三音频数据包,对其进行校验和解析,获取目标频域数据并转化成第二时域PCM数据,由本地DAC设备播放第二时域PCM数据,同时,蓝牙主机设备510根据音频播放需求选取第四音频数据包,对其进行解码,获取第一时域PCM数据,并由蓝牙主机设备510的DAC设备播放第一时域PCM数据,本地DAC设备与蓝牙主机设备510的DAC设备同步播放音频;通过上述过程,蓝牙主机设备510和蓝牙从机设备520可以同步播放独立声道的音频,通过多声道的音频播放确保音频音质和音效,而且传输经过压缩编码的声道独立的音频数据量相对于一般的音频数据量小,降低音频数据传输量可以有效减小对应的缓存空间,从而提升蓝牙设备的性能。In this embodiment, when receiving the first audio data packet to be played, the Bluetooth host device 510 preprocesses it to obtain frequency-domain data with independent channels, and compresses and encodes the frequency-domain data of the independent channels respectively. , obtain the corresponding second audio data packet, according to the audio playback requirements of the Bluetooth slave device 520, select the third audio data packet of the corresponding channel from the second audio data packet, encapsulate it into the Bluetooth data packet, and the Bluetooth data packet It is transmitted to the bluetooth slave device 520, and the bluetooth slave device 520 obtains the third audio data packet from the bluetooth data packet, performs checksum analysis on it, obtains the target frequency domain data and converts it into the second time domain PCM data. The DAC device plays the second time-domain PCM data, and at the same time, the Bluetooth host device 510 selects the fourth audio data packet according to the audio playback requirements, decodes it, obtains the first time-domain PCM data, and is played by the DAC device of the Bluetooth host device 510 In the first time-domain PCM data, the local DAC device and the DAC device of the Bluetooth host device 510 play audio synchronously; Audio playback ensures audio quality and sound effects, and the amount of independent audio data transmitted through compressed and encoded channels is smaller than that of general audio data. Reducing the amount of audio data transmission can effectively reduce the corresponding cache space, thereby improving the performance of Bluetooth devices. .

进一步的,蓝牙主机设备510可以通过有线或无线方式等方式接入公共网络,如Internet网等,与其他终端或服务器进行通信,接收并缓存音频数据,在整理音频数据包之后向蓝牙从机设备520发送。Further, the Bluetooth host device 510 can access the public network, such as the Internet network, etc. through wired or wireless means, communicate with other terminals or servers, receive and cache audio data, and send the Bluetooth slave device to the Bluetooth slave device after sorting out the audio data packets. 520 to send.

在一个实施例中,蓝牙设备音频处理方法可以应用在蓝牙对箱中。In one embodiment, the audio processing method of a Bluetooth device can be applied to a Bluetooth pairing box.

蓝牙对箱包括蓝牙主机设备和蓝牙从机设备,蓝牙从机设备可以有多个。The Bluetooth pairing box includes a Bluetooth host device and a Bluetooth slave device, and there can be multiple Bluetooth slave devices.

对蓝牙主机设备接收到的高级音频SBC(Sub Band Code,子带编码)格式的音频数据包进行分帧预处理,如图8所示,主要有音频帧头信息解析,包括声道模式、采样率、码率、块模式、位流分配模式、子带模式、SBC缩放因子信息以及CRC校验值C0,然后进行CRC校验,即计算声道模式、采样率、码率、块模式、位流分配模式、子带模式、SBC缩放因子信息这些重要信息的CRC得到C1,比较C0与C1是否一致。若不一致则重新找音频数据包中的同步头解析音频帧头信息,如一致再进行位流分配方案解析,频域数据反量化,立体声处理,得到声道独立的频域数据。The audio data packets in the advanced audio SBC (Sub Band Code, sub-band coding) format received by the Bluetooth host device are preprocessed by frame, as shown in Figure 8, mainly including audio frame header information analysis, including channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, SBC scaling factor information and CRC check value C0, and then perform CRC check, that is, calculate channel mode, sampling rate, code rate, block mode, bit The CRC of important information such as stream allocation mode, subband mode, and SBC scaling factor information obtains C1, and compares whether C0 and C1 are consistent. If it is inconsistent, find the synchronization header in the audio data packet to parse the audio frame header information again. If it is consistent, then analyze the bit stream allocation scheme, inverse quantize the frequency domain data, and perform stereo processing to obtain channel-independent frequency domain data.

按照不同的声道对频域数据进行压缩编码处理。如图9所示,主要包括根据编码参数对频域数据进行位流分配、量化、主数据封装,然后通过音频数据包封装,按照图10所示格式加上包同步字、音频基本信息、能量等级、包号信息、包内帧数信息,并对包头这些重要信息做CRC校验,将CRC校验值附在其后,加上对应包内帧数信息所示帧数的编码好的主数据,形成声道独立的音频数据包。如果是双声道则形成两个独立的音频数据流,如果是四声道则形成四个独立的音频数据流,如果是更多声道则形成相应个数独立的音频数据流。再根据每一帧的点数、采样率计算出压缩好的一帧数据的长度,对每一帧压缩数据做字节对齐处理,音频基本信息中包括码率信息,同一音频数据包中码率固定,不同音频包码率可变。不同的音频数据包可包含不同的帧数,由包头的变量包内帧数信息指示。The frequency domain data is compressed and encoded according to different channels. As shown in Figure 9, it mainly includes bit stream allocation, quantization, and main data encapsulation of frequency domain data according to coding parameters, and then through audio data packet encapsulation, according to the format shown in Figure 10, plus packet synchronization word, audio basic information, energy Level, packet number information, frame number information in the packet, and perform CRC check on the important information of the packet header, attach the CRC check value to it, and add the encoded main frame number corresponding to the frame number information in the packet. data to form channel-independent audio packets. If it is two channels, it forms two independent audio data streams, if it is four channels, it forms four independent audio data streams, and if it is more channels, it forms a corresponding number of independent audio data streams. Then calculate the length of the compressed data according to the number of points and sampling rate of each frame, and perform byte alignment processing on each frame of compressed data. The basic audio information includes the bit rate information, and the bit rate in the same audio data packet is fixed. , the bit rate of different audio packets is variable. Different audio data packets may contain different frame numbers, which are indicated by the variable frame number information in the packet header.

蓝牙主机设备根据蓝牙从机设备的播放需求,将选定的一个通道的音频数据包封装到蓝牙数据包中,传输到一个蓝牙从机设备。蓝牙从机设备解析出相应的音频数据包,校验同步字确定包头位置,解析出音频基本信息,能量等级、包号信息、包内帧数信息,CRC校验值。通过比较计算出的CRC值与包头信息的CRC值是否一致或者其他数据校验方法确定包头重要信息是否正确、包号信息与上一包是否连续,判断蓝牙传输的音频数据有没有丢包,根据应用需求确定要求重发或者补包。蓝牙从机设备执行与压缩编码对应的解码过程,把包内若干帧压缩的音频数据流通过位流分配、反量化等处理,得到频域数据,最后经过SBC子带合成滤波器组,解码为可以直接播放的时域PCM数据推送到DAC。The Bluetooth host device encapsulates the audio data packet of a selected channel into a Bluetooth data packet according to the playback requirements of the Bluetooth slave device, and transmits it to a Bluetooth slave device. The Bluetooth slave device parses the corresponding audio data packet, checks the synchronization word to determine the position of the packet header, and parses out the basic audio information, energy level, packet number information, frame number information in the packet, and CRC check value. By comparing whether the calculated CRC value is consistent with the CRC value of the packet header information or other data verification methods, determine whether the important information of the packet header is correct, whether the packet number information is continuous with the previous packet, and determine whether the audio data transmitted by Bluetooth has lost packets. The application requirements are determined to require retransmission or supplementary packages. The Bluetooth slave device performs the decoding process corresponding to the compression encoding, and processes the compressed audio data stream of several frames in the packet through bit stream allocation, inverse quantization, etc. to obtain frequency domain data, and finally passes through the SBC sub-band synthesis filter bank to decode as Time-domain PCM data that can be played directly is pushed to the DAC.

另一方面蓝牙主机设备也按照播放需求选定一个通道的音频数据包,直接进行解码流程,得到时域数据,与蓝牙从机设备进行同步播放。On the other hand, the Bluetooth host device also selects an audio data packet of a channel according to the playback requirements, directly performs the decoding process, obtains time domain data, and plays synchronously with the Bluetooth slave device.

如此可以在保持高级音频较高音质的同时,根据播放需求对需要转发的独立声道的音频进行频域压缩,在增加少量运算的基础上大大降低了音频数据传输量,可减小对应的缓存空间,从而提升蓝牙性能。In this way, while maintaining the high quality of advanced audio, frequency domain compression can be performed on the audio of the independent channel that needs to be forwarded according to the playback requirements, which greatly reduces the amount of audio data transmission on the basis of adding a small number of operations, and can reduce the corresponding cache. space to improve Bluetooth performance.

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

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成。所述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,包括上述方法所述的步骤。所述的存储介质,包括:ROM/RAM、磁碟、光盘等。Those skilled in the art can understand that all or part of the steps in the method of the above embodiments can be implemented by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. When the program is executed, the steps described in the above method are included. The storage medium includes: ROM/RAM, magnetic disk, optical disk and so on.

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

Claims (12)

1.一种蓝牙设备音频处理方法,其特征在于,包括以下步骤:1. a Bluetooth device audio processing method, is characterized in that, comprises the following steps: 在接收到待播放的第一音频数据包时,对所述第一音频数据包进行预处理,获得声道独立的频域数据;When receiving the first audio data packet to be played, preprocessing the first audio data packet to obtain channel-independent frequency domain data; 对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;Compressing and encoding the frequency domain data of different channels respectively to obtain the second audio data packet of the corresponding channel; 根据蓝牙从机设备的音频播放需求,从各所述第二音频数据包中选取第三音频数据包,其中,所述第三音频数据包与所述音频播放需求中的声道相对应;According to the audio playback requirement of the Bluetooth slave device, a third audio data packet is selected from each of the second audio data packets, wherein the third audio data packet corresponds to the channel in the audio playback requirement; 将所述第三音频数据包封装到蓝牙数据包中,将所述蓝牙数据包传输至所述蓝牙从机设备。The third audio data packet is encapsulated into a Bluetooth data packet, and the Bluetooth data packet is transmitted to the Bluetooth slave device. 2.根据权利要求1所述的蓝牙设备音频处理方法,其特征在于,所述对所述第一音频数据包进行预处理,获得声道独立的频域数据的步骤包括以下步骤:2. The Bluetooth device audio processing method according to claim 1, wherein the step of preprocessing the first audio data packet to obtain channel-independent frequency domain data comprises the following steps: 对所述第一音频数据包进行解析,获得音频帧头和帧内数据;The first audio data packet is analyzed to obtain audio frame header and intra-frame data; 对所述音频帧头进行CRC校验,若校验通过,对所述帧内数据进行位流分配、反量化和立体声处理,获得所述频域数据。CRC check is performed on the audio frame header, and if the check is passed, bit stream allocation, inverse quantization and stereo processing are performed on the data in the frame to obtain the frequency domain data. 3.根据权利要求2所述的蓝牙设备音频处理方法,其特征在于,所述对所述音频帧头进行CRC校验的步骤包括以下步骤:3. The bluetooth device audio processing method according to claim 2, wherein the step of carrying out a CRC check to the audio frame header comprises the following steps: 获取所述音频帧头中的目标信息,所述目标信息包括声道模式、采样率、码率、块模式、位流分配模式、子带模式、缩放因子和第一CRC校验值;Acquiring target information in the audio frame header, the target information includes channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode, scaling factor and a first CRC check value; 根据所述声道模式、采样率、码率、块模式、位流分配模式、子带模式和缩放因子获取第二CRC校验值,若所述第一CRC校验值与所述第二CRC校验值一致,判定CRC校验通过。A second CRC check value is obtained according to the channel mode, sampling rate, code rate, block mode, bit stream allocation mode, subband mode and scaling factor, if the first CRC check value is the same as the second CRC check value If the check value is consistent, it is determined that the CRC check is passed. 4.根据权利要求1所述的蓝牙设备音频处理方法,其特征在于,所述对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包的步骤包括以下步骤:4. The bluetooth device audio processing method according to claim 1, wherein the frequency domain data of different channels are respectively compressed and encoded, and the step of acquiring the second audio data packet of the corresponding channel comprises the following steps: 根据编码参数对任一声道的频域数据进行位流分配、量化和主数据封装,获得独立声道的编码数据;Perform bit stream allocation, quantization and main data encapsulation on the frequency domain data of any channel according to the encoding parameters, to obtain the encoded data of the independent channel; 对所述独立声道的编码数据进行封装,获取所述第二音频数据包。The encoded data of the independent channel is encapsulated to obtain the second audio data packet. 5.根据权利要求4所述的蓝牙设备音频处理方法,其特征在于,所述对所述独立声道的编码数据进行封装的步骤包括以下步骤:5. The Bluetooth device audio processing method according to claim 4, wherein the step of encapsulating the encoded data of the independent channel comprises the following steps: 根据所述编码数据获取音频属性信息,根据所述音频属性信息获取第三CRC校验值,将所述音频属性信息和所述第三CRC校验值作为包头信息,将所述编码数据作为包内主数据,生成所述第二音频数据包。Acquire audio attribute information according to the encoded data, obtain a third CRC check value according to the audio attribute information, use the audio attribute information and the third CRC check value as packet header information, and use the encoded data as a packet inner main data to generate the second audio data packet. 6.根据权利要求1所述的蓝牙设备音频处理方法,其特征在于,还包括以下步骤:6. The Bluetooth device audio processing method according to claim 1, further comprising the steps of: 根据本地的音频播放需求,从各所述第二音频数据包中选取第四音频数据包,对所述第四音频数据包进行解码,获取第一时域PCM数据;According to local audio playback requirements, select a fourth audio data packet from each of the second audio data packets, decode the fourth audio data packet, and obtain the first time-domain PCM data; 将所述第一时域PCM数据发送至本地DAC装置,与所述蓝牙从机设备同步播放音频,其中,所述蓝牙从机设备从所述蓝牙数据包中获取所述第三音频数据包,对所述第三音频数据包进行解码,获取第二时域PCM数据,将所述第二时域PCM数据发送至蓝牙从机设备的DAC装置并播放音频。sending the first time-domain PCM data to the local DAC device, and playing audio synchronously with the Bluetooth slave device, wherein the Bluetooth slave device obtains the third audio data packet from the Bluetooth data packet, Decode the third audio data packet, obtain second time-domain PCM data, send the second time-domain PCM data to the DAC device of the Bluetooth slave device, and play audio. 7.一种蓝牙设备音频处理方法,其特征在于,包括以下步骤:7. A Bluetooth device audio processing method, characterized in that, comprising the following steps: 从蓝牙主机设备接收如权利要求1至6中任意一项所述的蓝牙数据包,从所述蓝牙数据包中获取所述第三音频数据包;Receive the Bluetooth data packet according to any one of claims 1 to 6 from a Bluetooth host device, and obtain the third audio data packet from the Bluetooth data packet; 对所述第三音频数据包进行解析,获得包头信息和包内数据;The third audio data packet is analyzed to obtain packet header information and data in the packet; 对所述包头信息进行校验,若校验通过,对所述包内数据进行解析,获取目标频域数据;Verifying the packet header information, and if the verification passes, parsing the data in the packet to obtain target frequency domain data; 将所述目标频域数据转化为第二时域PCM数据,将所述第二时域PCM数据发送至本地DAC装置,与所述蓝牙主机设备同步播放音频,其中,所述蓝牙主机设备根据音频播放需求从各所述第二音频数据包中选取第四音频数据包,对所述第四音频数据包进行解码,获取第一时域PCM数据,将所述第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频;Convert the target frequency domain data into second time domain PCM data, send the second time domain PCM data to the local DAC device, and play audio synchronously with the Bluetooth host device, wherein the Bluetooth host device The playback requirement selects a fourth audio data packet from each of the second audio data packets, decodes the fourth audio data packet, obtains first time-domain PCM data, and sends the first time-domain PCM data to Bluetooth DAC device of the host device and play audio; 所述对所述包头信息进行校验的步骤包括以下步骤:The step of verifying the packet header information includes the following steps: 从所述包头信息中获取包号信息,在所述包号信息与上一第三音频数据包的包号信息不连续时,根据音频播放需求向所述蓝牙主机设备发起重发请求或补包请求。Obtain the packet number information from the packet header information, and when the packet number information is not continuous with the packet number information of the previous third audio data packet, initiate a retransmission request or supplementary packet to the Bluetooth host device according to audio playback requirements ask. 8.一种蓝牙设备音频处理系统,其特征在于,包括:8. A Bluetooth device audio processing system, characterized in that, comprising: 音频预处理单元,用于在接收到待播放的第一音频数据包时,对所述第一音频数据包进行预处理,获得声道独立的频域数据;an audio preprocessing unit, configured to preprocess the first audio data packet to obtain channel-independent frequency domain data when receiving the first audio data packet to be played; 音频编码单元,用于对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;an audio coding unit, configured to compress and encode the frequency domain data of different channels respectively, and obtain the second audio data packet of the corresponding channel; 音频分配单元,用于根据蓝牙从机设备的音频播放需求,从各所述第二音频数据包中选取第三音频数据包,其中,所述第三音频数据包与所述音频播放需求中的声道相对应;The audio distribution unit is used to select a third audio data packet from each of the second audio data packets according to the audio playback requirements of the Bluetooth slave device, wherein the third audio data packet and the audio playback requirements Corresponding to the channel; 音频传输单元,用于将所述第三音频数据包封装到蓝牙数据包中,将所述蓝牙数据包传输至所述蓝牙从机设备。An audio transmission unit, configured to encapsulate the third audio data packet into a Bluetooth data packet, and transmit the Bluetooth data packet to the Bluetooth slave device. 9.一种蓝牙主机设备,包括存储器和处理器,所述存储器存储有可执行程序,其特征在于,所述处理器执行所述可执行程序时实现权利要求1至6中任一项所述的蓝牙设备音频处理方法的步骤。9. A Bluetooth host device, comprising a memory and a processor, wherein the memory stores an executable program, wherein the processor implements the execution of any one of claims 1 to 6 when the executable program is executed. The steps of the Bluetooth device audio processing method. 10.一种蓝牙设备音频处理系统,其特征在于,包括:10. A Bluetooth device audio processing system, comprising: 音频接收单元,用于从蓝牙主机设备接收如权利要求9所述的蓝牙数据包,从所述蓝牙数据包中获取所述第三音频数据包;an audio receiving unit, configured to receive the Bluetooth data packet according to claim 9 from a Bluetooth host device, and obtain the third audio data packet from the Bluetooth data packet; 校验解析单元,用于对所述第三音频数据包进行解析,获得包头信息和包内数据;对所述包头信息进行校验,若校验通过,对所述包内数据进行解析,获取目标频域数据;a verification parsing unit, configured to parse the third audio data packet to obtain packet header information and data in the packet; verify the packet header information, and if the verification passes, parse the data in the packet to obtain target frequency domain data; 转化传输单元,用于将所述目标频域数据转化为第二时域PCM数据,将所述第二时域PCM数据发送至本地DAC装置,与所述蓝牙主机设备同步播放音频,其中,所述蓝牙主机设备根据音频播放需求从各所述第二音频数据包中选取第四音频数据包,对所述第四音频数据包进行解码,获取第一时域PCM数据,将所述第一时域PCM数据发送至蓝牙主机设备的DAC装置并播放音频。A conversion and transmission unit, configured to convert the target frequency domain data into second time domain PCM data, send the second time domain PCM data to a local DAC device, and play audio synchronously with the Bluetooth host device, wherein the The bluetooth host device selects a fourth audio data packet from each of the second audio data packets according to audio playback requirements, decodes the fourth audio data packet, obtains the first time domain PCM data, and converts the first time domain PCM data. Domain PCM data is sent to the DAC unit of the Bluetooth host device and audio is played. 11.一种蓝牙从机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求7所述的蓝牙设备音频处理方法的步骤。11. A Bluetooth slave device, comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the audio processing method of the Bluetooth device according to claim 7 when the processor executes the computer program. step. 12.一种蓝牙设备,其特征在于,包括蓝牙主机设备和蓝牙从机设备;12. A Bluetooth device, comprising a Bluetooth host device and a Bluetooth slave device; 所述蓝牙主机设备在接收到待播放的第一音频数据包时,对所述第一音频数据包进行预处理,获得声道独立的频域数据;对不同声道的频域数据分别进行压缩编码,获取对应声道的第二音频数据包;根据所述蓝牙从机设备的音频播放需求,从各所述第二音频数据包中选取第三音频数据包,其中,所述第三音频数据包与所述音频播放需求中的声道相对应;将所述第三音频数据包封装到蓝牙数据包中,将所述蓝牙数据包传输至所述蓝牙从机设备;When receiving the first audio data packet to be played, the Bluetooth host device preprocesses the first audio data packet to obtain channel-independent frequency-domain data; and compresses the frequency-domain data of different channels respectively encoding, and obtain the second audio data packet of the corresponding channel; according to the audio playback requirements of the Bluetooth slave device, select a third audio data packet from each of the second audio data packets, wherein the third audio data The package corresponds to the channel in the audio playback requirement; the third audio data package is encapsulated into a Bluetooth data package, and the Bluetooth data package is transmitted to the Bluetooth slave device; 所述蓝牙主机设备根据音频播放需求从各所述第二音频数据包中选取第四音频数据包,对所述第四音频数据包进行解码,获取第一时域PCM数据,将所述第一时域PCM数据发送至所述蓝牙主机设备的DAC装置;The Bluetooth host device selects a fourth audio data packet from each of the second audio data packets according to audio playback requirements, decodes the fourth audio data packet, obtains first time-domain PCM data, and converts the first sending time-domain PCM data to the DAC device of the Bluetooth host device; 所述蓝牙从机设备从接收到的蓝牙数据包中获取所述第三音频数据包;对所述第三音频数据包进行解析,获得包头信息和包内数据;对所述包头信息进行校验,若校验通过,对所述包内数据进行解析,获取目标频域数据;将所述目标频域数据转化为第二时域PCM数据,将所述第二时域PCM数据发送至所述蓝牙从机设备的DAC装置,与所述蓝牙主机设备的DAC装置同步播放音频。The bluetooth slave device obtains the third audio data packet from the received bluetooth data packet; parses the third audio data packet to obtain packet header information and data in the packet; verifies the packet header information , if the verification passes, parse the data in the packet to obtain target frequency domain data; convert the target frequency domain data into second time domain PCM data, and send the second time domain PCM data to the The DAC device of the Bluetooth slave device plays audio synchronously with the DAC device of the Bluetooth host device.
CN201810623859.6A 2018-06-15 2018-06-15 Bluetooth device audio processing method, system, readable storage medium and Bluetooth device Active CN108847248B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810623859.6A CN108847248B (en) 2018-06-15 2018-06-15 Bluetooth device audio processing method, system, readable storage medium and Bluetooth device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810623859.6A CN108847248B (en) 2018-06-15 2018-06-15 Bluetooth device audio processing method, system, readable storage medium and Bluetooth device

Publications (2)

Publication Number Publication Date
CN108847248A CN108847248A (en) 2018-11-20
CN108847248B true CN108847248B (en) 2020-12-15

Family

ID=64201844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810623859.6A Active CN108847248B (en) 2018-06-15 2018-06-15 Bluetooth device audio processing method, system, readable storage medium and Bluetooth device

Country Status (1)

Country Link
CN (1) CN108847248B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113539280B (en) * 2020-04-16 2025-01-14 华为技术有限公司 Control signal sending method, receiving method and related equipment
CN111768793B (en) * 2020-07-11 2023-09-01 北京百瑞互联技术有限公司 LC3 audio encoder coding optimization method, system and storage medium
CN111885414B (en) * 2020-07-24 2023-03-21 腾讯科技(深圳)有限公司 Data processing method, device and equipment and readable storage medium
CN112019885A (en) * 2020-08-12 2020-12-01 四川长虹网络科技有限责任公司 ECM data verification method and device based on digital television and computer equipment
CN113395392B (en) * 2021-06-11 2022-08-05 哈尔滨海能达科技有限公司 Call access control method, system, simulcast system and terminal
CN113689864B (en) * 2021-10-27 2022-01-18 北京百瑞互联技术有限公司 Audio data processing method and device and storage medium
CN115171706B (en) * 2022-06-27 2025-04-18 伟光有限公司 Data encoding method, data decoding method, device, equipment and medium
CN115223577A (en) * 2022-07-01 2022-10-21 哲库科技(上海)有限公司 Audio processing method, chip, apparatus, device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217038A (en) * 2008-01-17 2008-07-09 中兴通讯股份有限公司 An encoding method of audio data SBC algorithm and Bluetooth stereo subsystem
CN103699501A (en) * 2013-12-17 2014-04-02 上海斐讯数据通信技术有限公司 Audio equipment managing method and system of mobile terminal
CN103945310A (en) * 2014-04-29 2014-07-23 华为终端有限公司 Transmission method, mobile terminal, multi-channel earphones and audio playing system
CN105047209A (en) * 2015-08-13 2015-11-11 珠海市杰理科技有限公司 Bluetooth audio playing synchronization method and apparatus and Bluetooth audio playing apparatus
CN103369371B (en) * 2012-03-29 2017-06-09 索尼公司 Method and apparatus for providing the content channels of the access of selection

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI530169B (en) * 2013-08-23 2016-04-11 晨星半導體股份有限公司 Method of processing video/audio data and module thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217038A (en) * 2008-01-17 2008-07-09 中兴通讯股份有限公司 An encoding method of audio data SBC algorithm and Bluetooth stereo subsystem
CN103369371B (en) * 2012-03-29 2017-06-09 索尼公司 Method and apparatus for providing the content channels of the access of selection
CN103699501A (en) * 2013-12-17 2014-04-02 上海斐讯数据通信技术有限公司 Audio equipment managing method and system of mobile terminal
CN103945310A (en) * 2014-04-29 2014-07-23 华为终端有限公司 Transmission method, mobile terminal, multi-channel earphones and audio playing system
CN105047209A (en) * 2015-08-13 2015-11-11 珠海市杰理科技有限公司 Bluetooth audio playing synchronization method and apparatus and Bluetooth audio playing apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Analog memristive memory with applications in audio signal processing;DUAN ShuKai1,等;《Science China(Information Sciences)》;20130510;第57卷;第1-15页 *
基于ACL 的蓝牙音频应用模型及算法研究;郭昌建,吴永忠;《计算机技术与发展》;20080930;第18卷(第9期);第68-71页 *

Also Published As

Publication number Publication date
CN108847248A (en) 2018-11-20

Similar Documents

Publication Publication Date Title
CN108847248B (en) Bluetooth device audio processing method, system, readable storage medium and Bluetooth device
JP6523249B2 (en) Method and apparatus for compressing packet header
JP4724452B2 (en) Digital media general-purpose basic stream
US7769477B2 (en) Audio file format conversion
CN108111997B (en) Bluetooth device audio synchronization method and system
CN101180674B (en) Method of encoding and decoding an audio signal
CN104917671B (en) Audio-frequency processing method and device based on mobile terminal
CN106664161A (en) System and method of redundancy based packet transmission error recovery
JP2005176352A (en) Wireless moving image streaming file for moving image streaming service of mobile communication terminal, service method and system
TW200913626A (en) Efficient, secure digital wireless voice telephony via selective encryption
CN113689864B (en) Audio data processing method and device and storage medium
CN102832968A (en) Method for performing communication between mobile phone and equipment by using audio interface
CN115206352B (en) Audio processing method, device, chip, electronic device and storage medium
EP4362012A1 (en) Encoding and decoding methods and apparatuses for multi-channel signals
WO2023051370A1 (en) Encoding and decoding methods and apparatus, device, storage medium, and computer program
CN115273869A (en) Audio data transmission method, device, chip, electronic device and storage medium
US20230368801A1 (en) Bit allocation method and apparatus for audio object
WO2022012554A1 (en) Multi-channel audio signal encoding method and apparatus
CN108738007B (en) Audio transmission method, equipment and system
CN112995730A (en) Sound and picture synchronous adjustment method and device, electronic equipment and medium
US20250090963A1 (en) Efficient packet-loss protected data encoding and/or decoding
WO2022012677A1 (en) Audio encoding method, audio decoding method, related apparatus and computer-readable storage medium
WO2013185494A1 (en) Image encoding method, image decoding method , image encoder and image decoder
US11696075B2 (en) Optimized audio forwarding
CN113838470B (en) Audio processing methods, devices, electronic equipment and computer-readable media and products

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
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 519000 No. 333, Kexing Road, Xiangzhou District, Zhuhai City, Guangdong Province

Patentee after: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.

Address before: Floor 1-107, building 904, ShiJiHua Road, Zhuhai City, Guangdong Province

Patentee before: ZHUHAI JIELI TECHNOLOGY Co.,Ltd.