CN114783452B - Audio playing method, device and storage medium - Google Patents

Audio playing method, device and storage medium Download PDF

Info

Publication number
CN114783452B
CN114783452B CN202210683076.3A CN202210683076A CN114783452B CN 114783452 B CN114783452 B CN 114783452B CN 202210683076 A CN202210683076 A CN 202210683076A CN 114783452 B CN114783452 B CN 114783452B
Authority
CN
China
Prior art keywords
audio
sampling mode
target
played
sampling
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
CN202210683076.3A
Other languages
Chinese (zh)
Other versions
CN114783452A (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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210683076.3A priority Critical patent/CN114783452B/en
Publication of CN114783452A publication Critical patent/CN114783452A/en
Application granted granted Critical
Publication of CN114783452B publication Critical patent/CN114783452B/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/04Speech 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 using predictive techniques
    • G10L19/16Vocoder architecture
    • G10L19/18Vocoders using multiple modes
    • G10L19/22Mode decision, i.e. based on audio signal content versus external parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72409User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories
    • H04M1/72412User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories using two-way short-range wireless interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/7243User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages
    • H04M1/72433User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages for voice messaging, e.g. dictaphones
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M2250/00Details of telephonic subscriber devices
    • H04M2250/02Details of telephonic subscriber devices including a Bluetooth interface

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Computational Linguistics (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Telephone Function (AREA)

Abstract

An audio playing method, an audio playing device and a storage medium relate to the field of audio playing, and the method comprises the following steps: acquiring a sampling mode of audio to be played, wherein the sampling mode comprises sampling frequency and sampling digit; determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment; coding the audio to be played based on the target sampling mode to obtain coded audio data; and sending the encoded audio data to the target playing device, wherein the target playing device is used for decoding and playing the encoded audio data based on the target sampling mode. Therefore, the target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment, and the audio to be played is coded and decoded by adopting the target sampling mode, so that the sound source content is matched with the transmission link quality, and the tone quality experience is effectively improved.

Description

Audio playing method, device and storage medium
Technical Field
The present application relates to the field of audio playing, and in particular, to an audio playing method, apparatus and storage medium.
Background
Along with the continuous development of bluetooth, bluetooth headset's use is more and more common, and people also promote gradually to bluetooth headset tone quality's requirement.
In some implementations, when the terminal device is connected to the bluetooth headset for the first time, the terminal device may negotiate a sampling mode with the bluetooth headset, and after the terminal device is connected to the bluetooth headset for the first time, the terminal device may perform audio transmission with the bluetooth headset by using the sampling mode.
However, when playing audio based on this method, the audio quality of the audio coming from the bluetooth headset may be poor.
Disclosure of Invention
The embodiment of the application provides an audio playing method, an audio playing device and a storage medium, relates to the field of audio playing, and is beneficial to improving tone quality experience.
In a first aspect, an embodiment of the present application provides an audio playing method, where the method includes: acquiring a sampling mode of the audio to be played, wherein the sampling mode comprises sampling frequency and sampling digit; determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capacity of the target playing equipment; coding the audio to be played based on a target sampling mode to obtain coded audio data; and sending the encoded audio data to a target playing device, wherein the target playing device is used for decoding the encoded audio data based on a target sampling mode and playing the audio data. Therefore, the target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment, and the audio to be played is coded and decoded by adopting the target sampling mode, so that the sound source content is matched with the transmission link quality, and the tone quality experience is effectively improved.
In a possible implementation manner, determining a target sampling manner according to a sampling manner of an audio to be played and a sampling manner support capability of a target playing device includes: when a sampling mode that the target playing device supports the audio to be played is determined according to the sampling mode supporting capacity of the target playing device, a target sampling mode is obtained, wherein the target sampling mode is the sampling mode of the audio to be played; or when determining that the target playing device does not support the sampling mode of the audio to be played according to the sampling mode support capability of the target playing device, obtaining a target sampling mode, wherein the target sampling mode comprises: the electronic device and the target playing device negotiate in advance in a sampling mode, or the electronic device and the target playing device set in advance in a sampling mode. Therefore, the electronic equipment and the target playing equipment can encode and decode the audio to be played in a sampling mode matched with the audio to be played or a higher-order sampling mode, and therefore tone quality experience is effectively improved.
In a possible implementation manner, the sampling manner negotiated in advance between the electronic device and the target playback device includes a high-order sampling manner that can be supported by the target playback device. Therefore, when the target playing device is determined not to support the sampling mode of the audio to be played, the high-order sampling mode which can be supported by the target playing device can be determined to be the target sampling mode, and the audio to be played is coded and decoded by adopting the sampling mode with the higher order than the sampling mode of the audio to be played, so that the tone quality experience of a user can be effectively improved.
In one possible implementation, the method further comprises: judging whether the sampling mode of the audio to be played is the same as the sampling mode of the audio data historically played by the electronic equipment or not; determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capability of the target playing device, wherein the method comprises the following steps: and when the sampling mode of the audio to be played is different from the sampling mode of the audio data historically played by the electronic equipment, determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capacity of the target playing equipment. Therefore, the respective target sampling mode is determined according to the different selectivity of the sampling modes of the audios to be played, and the target sampling mode corresponding to each audio to be played is well matched with the sampling mode of each audio to be played, so that the tone quality experience of each audio to be played is effectively improved, and the waste of air interface transmission resources is reduced.
In one possible implementation, the method further comprises: and when the sampling mode of the audio to be played is the same as the sampling mode of the audio data historically played by the electronic equipment, determining a target sampling mode, wherein the target sampling mode is the sampling mode adopted when the audio data historically played by the electronic equipment is played. Therefore, a proper target sampling mode is determined, and the tone quality experience is effectively improved.
In a possible implementation manner, the obtaining of the sampling manner of the audio to be played includes: and responding to the play triggering operation of the audio to be played in the audio playing application, and acquiring the sampling mode of the audio to be played. When the playing of the audio to be played in the audio playing application is triggered to start, the sampling mode of the audio to be played is obtained, and compared with the mode of obtaining the audio all the time, the power consumption of the electronic equipment can be effectively reduced.
In a possible implementation manner, before encoding the audio to be played based on the target sampling manner and obtaining the encoded audio data, the method further includes: sending a reconfiguration request to the target playing equipment, wherein the reconfiguration request comprises a target sampling mode; and receiving a reconfiguration response from the target playing device. Therefore, the audio to be played can be coded and decoded in the same sampling mode, and the sound quality loss is effectively reduced.
In a possible implementation manner, a bluetooth module is provided in the electronic device, and the bluetooth module is configured to determine a target sampling manner, obtain encoded audio data, and send the encoded audio data to a target playback device. Therefore, the target playing device can decode the encoded audio data in a target sampling mode, and user experience is improved well.
In a possible implementation manner, the sampling manner support capability of the target playback device is obtained when the electronic device establishes a bluetooth communication connection with the target playback device. Therefore, the negotiation time of the electronic equipment and the target playing equipment can be reduced, and the audio playing efficiency is improved.
In a second aspect, an embodiment of the present application provides an audio playing apparatus, where a processing unit is configured to obtain a sampling mode of an audio to be played, where the sampling mode includes a sampling frequency and a sampling number; the processing unit is used for determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment; the processing unit is used for coding the audio to be played based on a target sampling mode to obtain coded audio data; and the communication unit is used for sending the encoded audio data to the target playing equipment, and the target playing equipment is used for decoding and playing the encoded audio data based on the target sampling mode.
In a possible implementation manner, the processing unit is further configured to obtain a target sampling manner when determining, according to a sampling manner support capability of the target playback device, a sampling manner in which the target playback device supports an audio to be played, where the target sampling manner is a sampling manner of the audio to be played; or, the processing unit is further configured to obtain a target sampling mode when it is determined that the target playback device does not support the sampling mode of the audio to be played according to the sampling mode support capability of the target playback device, where the target sampling mode includes: the electronic device and the target playing device negotiate in advance in a sampling mode, or a sampling mode preset by a user.
In a possible implementation manner, the sampling manner negotiated in advance between the electronic device and the target playback device includes a high-order sampling manner that can be supported by the target playback device.
In a possible implementation manner, the processing unit is further configured to determine whether a sampling manner of the audio to be played is the same as a sampling manner of audio data historically played by the electronic device; and the processing unit is also used for determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capability of the target playing equipment when the sampling mode of the audio to be played is different from the sampling mode of the audio data historically played by the electronic equipment.
In a possible implementation manner, the processing unit is further configured to determine a target sampling manner when a sampling manner of the audio to be played is the same as a sampling manner of audio data historically played by the electronic device, where the target sampling manner is a sampling manner adopted when the audio data historically played by the electronic device is played.
In a possible implementation manner, the processing unit is further configured to respond to a play trigger operation on an audio to be played in the audio play application, and acquire a sampling manner of the audio to be played.
In a possible implementation manner, before encoding an audio to be played based on a target sampling manner and obtaining encoded audio data, the processing unit is further configured to send a reconfiguration request to the target playing device, where the reconfiguration request includes the target sampling manner; and receiving a reconfiguration response from the target playing device.
In a possible implementation manner, the processing unit is further configured to set a bluetooth module in the electronic device, where the bluetooth module is configured to determine a target sampling manner, obtain encoded audio data, and send the encoded audio data to the target playback device.
In one possible implementation manner, the sampling manner support capability of the target playback device is acquired by the electronic device when the electronic device establishes a bluetooth communication connection with the target playback device.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory is used for storing code instructions; the processor is configured to execute the code instructions to cause the electronic device to perform the audio playing method as described in the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions that, when executed, cause a computer to perform an audio playing method as described in the first aspect or any one of the possible implementation manners of the first aspect.
In a fifth aspect, the present application provides a chip or a chip system, where the chip or the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to execute a computer program or instructions to perform the audio playing method described in the first aspect or any one of the possible implementation manners of the first aspect. The communication interface in the chip may be an input/output interface, a pin, a circuit, or the like.
In a possible implementation, the chip or the chip system described above in this embodiment of the present application further includes at least one memory, where the at least one memory stores instructions. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or may be a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).
It should be understood that the first aspect of the present application corresponds to the technical solutions of the second aspect to the fifth aspect of the present application, and the beneficial effects achieved by the aspects and the corresponding possible implementations are similar and will not be described again.
Drawings
FIG. 1 is a schematic diagram illustrating a scenario in which an embodiment of the present application is applied;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 3 is a block diagram of a software structure of an electronic device according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a workflow of software and hardware of an electronic device according to an embodiment of the present application;
fig. 5 is a schematic flowchart of an audio playing method according to an embodiment of the present application;
fig. 6a is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
fig. 6b is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
fig. 6c is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
fig. 6d is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
fig. 6e is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
fig. 6f is a schematic interface diagram of a preset sampling manner according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram showing a list of audio sampling modes and different Bluetooth sampling modes of the same Bluetooth audio codec;
FIG. 8 is a schematic diagram of an audio sampling mode and a list of different Bluetooth audio codecs corresponding to the same Bluetooth sampling mode;
fig. 9 is a schematic flowchart of a bluetooth sampling mode switching method according to an embodiment of the present application;
fig. 10 is a schematic flowchart of another bluetooth sampling mode switching method according to an embodiment of the present application;
fig. 11 is a schematic flowchart of an audio playing method according to an embodiment of the present application;
fig. 12 is an interaction diagram of audio playing provided in an embodiment of the present application;
fig. 13 is a schematic structural diagram of an audio playing apparatus according to an embodiment of the present application;
fig. 14 is a schematic hardware structure diagram of another electronic device according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
In the embodiments of the present application, the terms "first", "second", and the like are used to distinguish the same or similar items having substantially the same function and effect. For example, the first chip and the second chip are only used for distinguishing different chips, and the sequence order thereof is not limited. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the embodiments of the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated object, indicating that there may be three relationships, for example, a and/or B, which may indicate: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of the singular or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c can be single or multiple.
Along with bluetooth technology's continuous development, bluetooth headset's use is more and more common, and people also promote gradually to bluetooth headset tone quality's requirement.
In some implementations, when the terminal device is connected to the bluetooth headset for the first time, the terminal device may negotiate a sampling mode with the bluetooth headset, and after the terminal device is connected to the bluetooth headset for the first time, the terminal device may perform audio transmission with the bluetooth headset by using the sampling mode.
The sampling mode may include a sampling frequency and a sampling bit number. A sampling frequency (also referred to as a sampling speed or a sampling rate) which represents the number of samples extracted from a continuous signal (analog signal) and constituting a discrete signal (digital signal) per unit time and is expressed in hertz (hertz, hz), and may be, for example, 44.1kHz, 48kHz, or 96 kHz; the number of sampling bits (also referred to as quantization bits, bit depth or resolution), which represents how many levels the continuous intensity of sound can be divided into after being digitally represented, is represented in bits (bits), and may be, for example, 16 bits or 24 bits. The higher the sampling frequency or the higher the number of sampling bits, the higher the quality of the sound source.
For example, when the bluetooth headset is used to listen to music in the mobile phone, the mobile phone may negotiate with the bluetooth headset when the mobile phone is connected to the bluetooth headset for the first time, for example, a sampling mode with a higher sampling frequency and a larger number of sampling bits is used in agreement, the higher sampling frequency may be, for example, 96kHz, and the larger number of sampling bits may be, for example, 24bit, that is, the mobile phone uses a sampling mode of 96kHz/24bit to encode an audio file, and the bluetooth headset uses a sampling mode of 96kHz/24bit to decode an audio file.
However, the above method does not pay attention to the sampling method of the sound source content, and when the sampling method of the audio file is inconsistent with the sampling method negotiated when the terminal device and the bluetooth headset are connected for the first time, the sound source content and the transmission link quality are not matched.
Illustratively, low-sampling low-bit-rate transmission is used when playing high-quality audio sources, so that audio source content is not matched with transmission link quality, and the audio quality experience is reduced. The code rate is also called a bit rate, and indicates the amount of data transmitted per unit time, and is generally expressed in units of kilobytes per second (kbps). For example, a Compact Disc (CD) is a sampling frequency of 44100 Hz per second, two channels, each sample being 13 bits, are coded by a Pulse Code Modulator (PCM), so the code rate of the CD is 44100 × 2 × 13=1146600. The higher the code rate, the smaller the data compression ratio, the smaller the sound quality loss, and the closer to the sound quality of the sound source, correspondingly, the larger the encoded audio file. The lower the code rate, the larger the data compression ratio, the greater the sound quality loss, and correspondingly, the smaller the encoded audio file.
In view of this, an embodiment of the present application provides an audio playing method, where a sampling manner of a sound source content is identified, and a corresponding bluetooth sampling manner is selected according to the identified sampling manner, so that the sound source content matches with transmission link quality, thereby improving sound quality experience.
Fig. 1 shows a schematic view of a scenario to which an embodiment of the present application is applied. As shown in fig. 1, the electronic device 100 may be an electronic device with a bluetooth connection function, such as a mobile phone, the playback device 200 may be a bluetooth headset, and the electronic device 100 and the playback device 200 may communicate with each other through bluetooth.
The electronic device 100 may provide various applications for providing audio, for example, audio provided by a music application (app), a game, a video, and the like, the electronic device 100 may transmit the audio to the playing device 200 based on an audio playing method provided in an embodiment of the present application, and the playing device 200 may be used for audio playing.
Illustratively, the audio playing method may include: the method comprises the steps that the electronic equipment obtains a sampling mode of the audio to be played, the sampling mode comprises sampling frequency and sampling digit, a target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode supporting capacity of target playing equipment (such as the Bluetooth headset), the audio to be played is coded based on the target sampling mode, and coded audio data are obtained; and sending the encoded audio data to a target playing device, wherein the target playing device is used for decoding the encoded audio data based on a target sampling mode and playing the audio data. Therefore, the target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment, and the audio to be played is coded and decoded by adopting the target sampling mode, so that the sound source content is matched with the transmission link quality, and the tone quality experience is effectively improved.
For example, fig. 2 shows a schematic structural diagram of the electronic device 100.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processor (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. Wherein, the different processing units may be independent devices or may be integrated in one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, a charger, a flash, a camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 through an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through the I2S interface, so as to implement a function of receiving a call through a bluetooth headset.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a display screen serial interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture functionality of electronic device 100. Processor 110 and display screen 194 communicate via a DSI interface to implement display functions of electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, and the like.
It should be understood that the connection relationship between the modules according to the embodiment of the present invention is only illustrative, and is not limited to the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), global Navigation Satellite System (GNSS), frequency Modulation (FM), near Field Communication (NFC), infrared (IR), and the like. For example, the wireless communication module 160 may be used to implement the audio playing method provided in the embodiment of the present application. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In this embodiment, the mobile phone and the bluetooth headset may perform message interaction through bluetooth of the wireless communication module 160, or the mobile phone may send a bluetooth audio data packet to the bluetooth headset through bluetooth of the wireless communication module 160.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
In this embodiment of the application, the audio module may determine a bluetooth sampling mode used for encoding the audio data packet according to different applications or different audio data packets, and the like.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into a sound signal. When the electronic apparatus 100 receives a call or voice information, it is possible to receive voice by placing the receiver 170B close to the human ear.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking near the microphone 170C through the mouth. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and so on.
In some scenarios, for example, the electronic device 100 connected to a wireless bluetooth headset, the audio module 170, the wireless communication module 160, and the application processor may also implement audio functions. Such as music playing, etc.
The audio module 170 is used to encode audio signals and convert digital audio information into analog audio signals. The wireless communication module 160 is configured to output an analog audio signal. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110, for example, the audio module 170 may be an application processor in the processor 110.
The pressure sensor 180A is used for sensing a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a wide variety, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic apparatus 100 may also calculate the touched position from the detection signal of the pressure sensor 180A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may receive a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenes (such as time reminding, receiving information, alarm clock, game and the like) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The software system of the electronic device 100 may employ a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention uses an android (android) system with a hierarchical architecture as an example to exemplarily illustrate a software structure of the electronic device 100.
Fig. 3 is a block diagram of a software structure of the electronic device 100 according to an embodiment of the present application.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.
The application layer may include a series of application packages.
As shown in fig. 3, the application package may include camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc. applications.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 3, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and answered, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide communication functions for the electronic device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The kernel layer is a layer between hardware and software. The kernel layer at least comprises a touch panel driver, an LCD/LED screen driver, a display driver, a Bluetooth driver, a WIFI driver, a keyboard driver, a shared memory driver, an audio driver and the like.
The hardware may be audio devices, bluetooth devices, camera devices, sensor devices, etc.
For example, fig. 4 shows a workflow diagram of software and Hardware of the electronic device 100, as shown in fig. 4, a music player (music player) of an application Layer is started, a sampling frequency and a sampling bit number of audio to be played are written into an audio track (audio track), the audio track calls a direct output thread (direct output thread) service of an audio manager (audio finger) to transmit the sampling frequency and the sampling bit number of the audio to be played to an audio Hardware Abstraction Layer (audio Hardware Abstraction Layer, audio HAL), the audio HAL calls an advanced Linux sound architecture (advanced Linux sound architecture, ALSA), the ALSA configures an encoding mode of the audio, the encoding mode recognition module recognizes the sampling frequency and the sampling bit number of the audio, specifies an encoding mode of the bluetooth sa, the audio calls an audio driver (audio driver) to transmit audio data packets, and the audio packets are compressed by a radio frequency decoder (audio codec, and the audio packets are compressed according to a digital audio codec (audio codec) of the bluetooth sa. In one possible implementation, A2DP is also used for negotiation of the codec mode of bluetooth. The Bluetooth RF of the earphone converts the received digital audio data into Bluetooth data packets, the Bluetooth data packets are subjected to layer decapsulation through the A2DP of the earphone and converted into compressed data packets, and the compressed data packets are sent to an audio decoder (audio decoder) of the earphone for decoding and played by an audio play unit (audio play) of the earphone.
The following describes in detail an audio playing method according to an embodiment of the present application with reference to specific embodiments. The following embodiments may be combined with each other or implemented independently, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 5 is a flowchart illustrating an audio playing method according to an embodiment of the present application. As shown in fig. 5, the method may include:
s501, obtaining a sampling mode of the audio to be played, wherein the sampling mode comprises sampling frequency and sampling digit.
In the embodiment of the present application, the audio to be played may be, for example, audio provided by a music app, a game, a video, and the like in a mobile phone. The audio file to be played may be, for example, an audio file of moving picture experts group audio layer III (mp 3), lossless audio compression coding (flac), or the like.
In the embodiment of the application, the electronic device can acquire the sampling frequency and the sampling number of bits of the audio to be played when receiving the audio playing starting operation. For example, the electronic device may analyze an audio file of the audio to be played when receiving an audio play start operation, and obtain a sampling mode of the audio to be played from a frame header of a frame included in the audio file, where the sampling mode includes a sampling frequency and a sampling bit number.
S502, determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment.
The target playback device may be a playback device with a bluetooth connection function, such as a bluetooth headset. The target sampling mode may be understood as a sampling mode for encoding and decoding the audio to be played after negotiation between the electronic device and the target playing device. For example, the mobile phone encodes the audio to be played in a target sampling mode, and the bluetooth headset decodes the audio to be played in the target sampling mode.
In this embodiment, the sampling mode support capability of the target playback device may include a bluetooth audio codec type (or a code rate of the bluetooth audio codec) and a bluetooth sampling mode that can be supported by the target playback device, where the bluetooth sampling mode may include a sampling frequency of bluetooth and a sampling bit number of bluetooth. For example, bluetooth audio codec types supported by a bluetooth headset may include: high-quality encoding (low-latency hi-definition audio codec, LDAC), aptx, advanced audio encoding (AAC), subband encoding (SBC), and the like; the sampling frequency of Bluetooth may include 96kHz, 48kHz, 44.1kHz, 32kHz, 24kHz, 16kHz, etc.; the number of sampling bits of bluetooth may include 8 bits, 16 bits, 24 bits, etc.
It can be understood that the sampling mode support capability of the target playback device may be obtained when the mobile phone and the bluetooth headset are connected for the first time and stored locally in the mobile phone, or the sampling mode support capability of the target playback device may be obtained after the mobile phone identifies the sampling mode of the audio to be played and sends a request to the bluetooth headset.
In a possible implementation manner, the mobile phone identifies a sampling manner of the audio to be played, and determines a target sampling manner according to whether a bluetooth sampling manner identical to the sampling manner of the audio to be played exists in the sampling manner support capability of the target playing device.
For example, the code recognition module of the mobile phone recognizes a sampling mode of an audio to be played, the sampling mode of the audio to be played may be, for example, 44 kHz/24bit, the sampling mode support capability of the bluetooth headset includes a bluetooth sampling mode that the bluetooth headset can support, the bluetooth sampling mode may include, for example, 44 kHz/16bit, 44 kHz/24bit, and the like, at this time, a bluetooth sampling mode in the sampling mode support capability of the bluetooth headset is the same as the sampling mode of the audio to be played, and it may be determined that the sampling mode of the audio to be played is a target sampling mode.
S503, coding the audio to be played based on the target sampling mode to obtain coded audio data.
In a possible implementation manner, audio data of an audio to be played may be decoded into Pulse-Code Modulation (PCM) data, and the electronic device encodes the PCM data of the audio to be played based on a target sampling manner to obtain an encoded compressed data packet, where the encoded compressed data packet is encoded audio data.
Illustratively, after the mobile phone starts audio playing, the coding mode configuration module of the mobile phone obtains audio data of an audio to be played and decodes the audio data of the audio to be played to obtain PCM data of the audio to be played, and the coding identification module of the mobile phone codes the PCM data of the audio to be played based on a target sampling mode to obtain coded audio data.
S504, sending the encoded audio data to a target playing device, wherein the target playing device is used for decoding and playing the encoded audio data based on a target sampling mode.
Exemplarily, the mobile phone sends the encoded audio data to the bluetooth headset, the bluetooth headset decodes the encoded audio data according to a target sampling mode, the decoded audio data is converted into an analog signal through a digital to analog converter (DAC) in the bluetooth headset, and the analog signal drives a speaker through an amplifying circuit to play sound.
In the embodiment of the application, by acquiring a sampling mode of an audio to be played, the sampling mode comprises sampling frequency and sampling digit, a target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode support capacity of a target playing device, the audio to be played is encoded based on the target sampling mode, encoded audio data is obtained, the encoded audio data is sent to the target playing device, and the target playing device is used for decoding the encoded audio data based on the target sampling mode and playing the encoded audio data. Therefore, the target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment, and the audio to be played is coded and decoded by adopting the target sampling mode, so that the sound source content is matched with the transmission link quality, and the tone quality experience is effectively improved.
Optionally, on the basis of the embodiment corresponding to fig. 5, in a possible implementation, determining a target sampling mode according to a sampling mode of an audio to be played and a sampling mode support capability of a target playback device includes:
when the sampling mode that the target playing device supports the audio to be played is determined according to the sampling mode supporting capacity of the target playing device, a target sampling mode is obtained, wherein the target sampling mode is the sampling mode of the audio to be played; or, when the sampling mode of the audio to be played is determined not to be supported by the target playing device according to the sampling mode support capability of the target playing device, obtaining a target sampling mode, where the target sampling mode includes: the electronic device and the target playing device negotiate in advance in a sampling mode, or the electronic device and the target playing device set in advance in a sampling mode.
For example, the sampling mode of the audio to be played may be 44.1kHz/16bit, and when the sampling mode support capability of the bluetooth headset reported by the bluetooth headset to the mobile phone includes the bluetooth sampling mode 44.1kHz/16bit, or when the reconfiguration response of the bluetooth headset indicates that the bluetooth headset supports the bluetooth sampling mode 44.1kHz/16bit, it may be determined that 44.1kHz/16bit is the target sampling mode. When the Bluetooth sampling mode support capability of the Bluetooth earphone reported by the Bluetooth earphone to the mobile phone does not have the Bluetooth sampling mode of 44.1kHz/16bit or the reconfiguration response of the Bluetooth earphone indicates that the Bluetooth earphone does not support the Bluetooth sampling mode of 44.1kHz/16bit, the method can determine that the negotiated sampling mode when the mobile phone is connected with the Bluetooth earphone for the first time is a target sampling mode; or the mobile phone and the Bluetooth headset can renegotiate a sampling mode which is close to the sampling mode of 44.1kHz/16bit and the Bluetooth sampling mode which can be supported by the Bluetooth headset is determined as a target sampling mode; or, determining the sampling mode preset by the user as the target sampling mode.
For example, fig. 6a shows an interface schematic diagram of a preset sampling manner provided in the embodiment of the present application, and after the mobile phone detects a pairing operation with a bluetooth headset, the mobile phone may display the interface shown in fig. 6a, as shown in fig. 6a, where the interface may include: a switch control of bluetooth, a device name control, a received file control, a paired device list 601, and an available device list 602, as shown in fig. 6a, a paired device name 603 and device settings 604 are displayed in the paired device list 601, and a device searched by the mobile phone but not paired with the mobile phone is displayed in the available device list 602.
Fig. 6b shows an interface schematic diagram of a preset sampling manner provided in an embodiment of the present application, in the interface shown in fig. 6a, after the mobile phone detects a trigger operation for the device setting 604, the mobile phone may display the interface shown in fig. 6b, as shown in fig. 6b, the interface may include: renaming control, internet access switch control, shared contacts control, bluetooth automatic connect switch control, and sampling information control 605.
Fig. 6c shows an interface schematic diagram for presetting a sampling mode according to an embodiment of the present application, in the interface shown in fig. 6b, after the mobile phone detects the trigger operation for the sampling information control 605, the mobile phone may display the interface shown in fig. 6c, as shown in fig. 6c, the interface may include: bluetooth audio codec control 606, bluetooth sampling frequency control 607, bluetooth sampling bit number control 608.
Fig. 6d shows an interface schematic diagram of a preset sampling manner provided by the embodiment of the application, in the interface shown in fig. 6c, after the mobile phone detects the trigger operation for the bluetooth audio codec control 606, the mobile phone may display the interface shown in fig. 6d, as shown in fig. 6d, the interface may include a system selection (default) codec, an SBC codec, an AAC codec 609, an aptx codec, an LDAC codec, and the like, and in a possible implementation, a user may preset the bluetooth audio codec in the interface, for example, select the AAC codec.
In the interface shown in fig. 6d, the handset may display the interface shown in fig. 6c in response to a trigger operation for the AAC codec 609. Fig. 6e shows an interface schematic diagram of a preset sampling manner provided in the embodiment of the present application, in the interface shown in fig. 6c, after the mobile phone detects a trigger operation for the bluetooth sampling frequency control 607, the mobile phone may display the interface shown in fig. 6e, as shown in fig. 6e, the interface may include a sampling frequency selected (default) by using a system, a sampling frequency 610 of 44.1kHz, a sampling frequency 48kHz, a sampling frequency 96kHz, and the like, and in a possible implementation, a user may preset the sampling frequency of bluetooth in the interface, for example, select the sampling frequency 44.1 kHz.
In the interface shown in fig. 6e, the handset may display the interface shown in fig. 6c in response to a trigger operation for the 44.1kHz sampling frequency 610. Fig. 6f shows an interface schematic diagram of a preset sampling manner provided in the embodiment of the present application, in the interface shown in fig. 6c, after the mobile phone detects the trigger operation for the bluetooth sampling bit number control 608, the mobile phone may display the interface shown in fig. 6f, as shown in fig. 6f, the interface may include a sampling bit number selected (default) by using the system, a 16-bit sampling bit number, a 24-bit sampling bit number 611, and the like, and in a possible implementation, a user may preset a sampling frequency of bluetooth in the interface, for example, select a 24-bit sampling bit number.
It is to be understood that the sampling information of different target playback devices may be different, and the examples in fig. 6a to fig. 6f do not limit the embodiments of the present application.
In the embodiment of the application, when the target playing device supports the sampling mode of the audio to be played, the target sampling mode is the sampling mode of the audio to be played, and when the target playing device does not support the sampling mode of the audio to be played, it is determined that the sampling mode negotiated in advance by the electronic device and the target playing device or the sampling mode preset by a user is the target sampling mode, so that the electronic device and the target playing device can encode and decode the audio to be played in the sampling mode matched with the audio to be played or in a higher-order sampling mode, and therefore the tone quality experience is effectively improved.
Optionally, the sampling mode pre-negotiated between the electronic device and the target playback device includes a high-order sampling mode that can be supported by the target playback device.
The high-order sampling mode may be a bluetooth sampling mode corresponding to the high-order bluetooth audio codec, and the high-order bluetooth audio codec may be a bluetooth audio codec with a higher code rate.
In a possible implementation manner, when the electronic device and the target playback device are connected for the first time, the electronic device may select a bluetooth sampling manner that is supported by both the electronic device and the target playback device and corresponds to a bluetooth audio codec with the highest code rate.
Exemplary bluetooth audio codec types supported by a bluetooth headset may include: LDAC, aptX, aptX HD, aptX LL, AAC; the sampling frequencies of supported bluetooth may include 48kHz, 44.1kHz, 32kHz, 24kHz, 16kHz; the number of sampling bits for bluetooth supported may include 8 bits, 16 bits. The bluetooth audio codec types supported by the mobile phone may include: LDAC, aptX, aptX HD, aptX LL, SBC; the sampling frequencies of supported bluetooth may include 48kHz, 44.1kHz, 24kHz, 8kHz; the number of sampling bits for bluetooth supported may include 8 bits, 16 bits. The mobile phone can select a high-order Bluetooth audio codec and a high-order sampling mode which are supported by both the mobile phone and the Bluetooth headset. For example, the mobile phone selects the type of the bluetooth audio codec as LDAC, the sampling frequency of bluetooth is 48kHz, and the sampling bit number of bluetooth is 16 bits.
In the embodiment of the application, the sampling mode pre-negotiated between the electronic device and the target playing device includes a high-order sampling mode that can be supported by the target playing device, so that when it is determined that the target playing device does not support the sampling mode of the audio to be played, the high-order sampling mode that can be supported by the target playing device can be determined to be the target sampling mode, and thus the audio to be played is coded and decoded by adopting a higher-order sampling mode than the sampling mode of the audio to be played, and the tone quality experience of a user can be effectively improved.
Optionally, judging whether the sampling mode of the audio to be played is the same as the sampling mode of the audio data historically played by the electronic equipment; determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capability of the target playing device, wherein the method comprises the following steps: and when the sampling mode of the audio to be played is different from the sampling mode of the audio data historically played by the electronic equipment, determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capacity of the target playing equipment.
The sampling mode of the audio data historically played by the electronic device may be a sampling mode adopted when the electronic device plays the last audio of the audio to be played.
In one possible implementation, the bluetooth codec used when audio data historically played by the electronic device is played supports a sampling mode of the audio to be played, and when the sampling mode of the audio to be played is different from the sampling mode of the audio data historically played by the electronic device, the sampling mode used when the audio data historically played by the electronic device is played and a target sampling mode are different bluetooth sampling modes corresponding to the same bluetooth codec.
For example, fig. 7 shows a list diagram of audio sampling modes and different bluetooth sampling modes of the same bluetooth audio codec. As shown in a of fig. 7, the audio sampling pattern may include A1:44.1kHz/16bit, A2:44.1kHz/24bit, A3:96kHz/24bit, etc. As shown in b of fig. 7, the same bluetooth audio codec may correspond to different bluetooth sampling modes such as C1:44.1kHz/16bit, C2:44.1kHz/24bit, C3:96kHz/24bit, etc.
For example, when a music player in a mobile phone plays music with an audio sampling mode of A1, a target sampling mode corresponding to the music may be C1, when the music player switches music, a coding mode identification module in the mobile phone determines whether the audio sampling mode of the switched music is A1, and if the audio sampling mode of the switched music is not A1, the coding mode identification module determines the target sampling mode according to the audio sampling mode of the switched music and the sampling mode support capability of the target playing device. For example, the sampling mode of the switched music may be A2, and a bluetooth audio codec of the bluetooth headset corresponds to a bluetooth sampling mode C2:44.1kHz/24bit, then the Bluetooth sampling mode C2 can be determined to be the target sampling mode.
In another possible implementation, the bluetooth codec used when the audio data historically played by the electronic device is played does not support the sampling mode of the audio to be played, and when the sampling mode of the audio to be played is different from the sampling mode of the audio data historically played by the electronic device, the sampling mode and the target sampling mode used when the audio data historically played by the electronic device is played are different bluetooth sampling modes corresponding to different bluetooth codecs.
For example, fig. 8 shows an audio sampling mode and a list diagram of different bluetooth audio codecs corresponding to the same bluetooth sampling mode. As shown in a of fig. 8, the audio sampling pattern may include A1:44.1kHz/16bit, A2:44.1kHz/24bit, A3:96kHz/24bit, etc. As shown in b of fig. 8, the same bluetooth sampling mode may correspond to different bluetooth audio codecs: the sampling mode 44.1kHz/16bit can correspond to C1-1: SBC, C1-2: AAC, C1-3: LDAC; the sampling mode 44.1kHz/24bit can correspond to C2-1: AAC, C2-2: aptx, C2-3: LDAC; the sampling mode 96kHz/24bit can correspond to C3-1: LHAC, C3-2: LDAC, etc.
For example, when a music player in a mobile phone plays music with an audio sampling mode of A1, a target sampling mode may be 44.1kHz/16bit, and a corresponding bluetooth audio codec may be SBC, when the music player switches music, a coding mode identification module in the mobile phone determines whether the audio sampling mode of the switched music is A1, if the audio sampling mode of the switched music is not A1, for example, the audio sampling mode of the switched music is A2, at this time, the coding mode identification module determines that the bluetooth audio codec SBC does not support the sampling mode A2, and the coding mode identification module in the mobile phone may switch the bluetooth audio codec to AAC, and determine 44.1kHz/24bit as the target sampling mode.
In the embodiment of the application, when the sampling mode of the audio to be played is judged to be different from the sampling mode of the audio data historically played by the electronic device, the target sampling mode is determined according to the sampling mode of the audio to be played and the sampling mode support capacity of the target playing device, namely, the respective target sampling mode is determined according to different selectivity of the sampling modes of the audio to be played, so that the target sampling mode corresponding to the audio to be played is well matched with the sampling mode of the audio to be played, the tone quality experience of the audio to be played is effectively improved, and the waste of air interface transmission resources is reduced.
Optionally, when the sampling mode of the audio to be played is the same as the sampling mode of the audio data historically played by the electronic device, a target sampling mode is determined, where the target sampling mode is a sampling mode adopted when the audio data historically played by the electronic device is played.
The sampling mode adopted when the audio data historically played by the electronic equipment is played can be understood as a bluetooth sampling mode adopted when the audio data historically played by the electronic equipment is played.
For example, when a music player in the mobile phone plays music with an audio sampling mode A1 as shown in fig. 7, a corresponding target sampling mode may be C1 as shown in fig. 7, and when the music player switches music, an encoding mode identification module in the mobile phone identifies whether the switched sampling mode of the music is A1, and then the encoding mode identification module determines that the target sampling mode is a sampling mode adopted when audio data that is played by the electronic device in history is played, so that the audio to be played may be encoded and decoded in the target sampling mode.
In the embodiment of the application, the sampling mode adopted when the target sampling mode is the audio data historically played by the electronic equipment is determined by the same sampling mode of the audio to be played as the audio data historically played by the electronic equipment, so that the appropriate target sampling mode is determined, and the tone quality experience is effectively improved.
Optionally, the obtaining a sampling mode of the audio to be played includes: and responding to the play triggering operation of the audio to be played in the audio playing application, and acquiring the sampling mode of the audio to be played.
The audio playing application may be an application capable of playing audio, and may be, for example, a music app, a game, a video, or the like.
In a possible implementation manner, when the coding mode configuration module of the electronic device detects a play trigger operation of an audio to be played in an audio play application, an audio file of the audio to be played is analyzed, and a sampling manner of the audio to be played is obtained.
Illustratively, when the encoding mode configuration module of the mobile phone detects a play start operation in the music app, the audio file of the audio to be played is analyzed to obtain a sampling frequency and a sampling bit number of the audio to be played.
In the embodiment of the application, when the playing of the audio to be played in the audio playing application is triggered to start, the sampling mode of the audio to be played is acquired, and compared with the mode of always acquiring, the power consumption of the electronic equipment can be effectively reduced.
Optionally, encoding the audio to be played based on the target sampling mode, and before obtaining the encoded audio data, further including: sending a reconfiguration request to the target playing equipment, wherein the reconfiguration request comprises a target sampling mode; and receiving a reconfiguration response from the target playing device.
In a possible implementation manner, after determining a target sampling mode, a bluetooth module of an electronic device sends a reconfiguration request including the target sampling mode to a target playing device, the target playing device sends a reconfiguration response to the electronic device after receiving the reconfiguration request, and the electronic device receives the reconfiguration response to indicate that the negotiation between the electronic device and the target playing device is completed, that is, the electronic device encodes an audio to be played in the target sampling mode, and the target playing device decodes encoded audio data of the audio to be played in the target sampling mode.
In the embodiment of the application, the electronic device sends the target sampling mode to the target playing device through the reconfiguration request, so that the audio to be played can be coded and decoded in the same sampling mode, and the tone quality loss is effectively reduced.
Optionally, a bluetooth module is disposed in the electronic device, and the bluetooth module is configured to determine a target sampling manner, obtain encoded audio data, and send the encoded audio data to the target playback device.
In one possible implementation, a bluetooth module in the electronic device receives a bluetooth sampling mode specified by a code recognition module, determines a target sampling mode in a sampling mode support capability of a target playback device based on the bluetooth sampling mode, sends a reconfiguration request including the target sampling mode to the target playback device, receives encoded audio data sent by the code recognition module of the electronic device, and sends the encoded audio data to the target playback device.
In another possible implementation, a bluetooth module in the electronic device receives a bluetooth sampling mode specified by the code recognition module, negotiates with the target playing device to determine a target sampling mode based on the bluetooth sampling mode, sends a reconfiguration request including the target sampling mode to the target playing device, receives encoded audio data sent by the code recognition module of the electronic device, and sends the encoded audio data to the target playing device.
In the embodiment of the application, the Bluetooth module arranged in the electronic device is used for determining the target sampling mode and interacting with the target playing device, so that the target playing device can decode the encoded audio data in the target sampling mode, and the user experience is better improved.
Optionally, the sampling mode support capability of the target playback device is obtained when the electronic device establishes a bluetooth communication connection with the target playback device.
In one possible implementation, when the electronic device is initially connected to the target playback device, the target playback device reports the sampling mode support capability of the target playback device to the electronic device.
For example, when the bluetooth communication connection is initially established between the mobile phone and the bluetooth headset, the bluetooth headset may report the bluetooth audio codec type and the bluetooth sampling mode that the bluetooth headset can support to the mobile phone, where the bluetooth sampling mode includes a bluetooth sampling frequency and a bluetooth sampling bit number. The mobile phone can store the Bluetooth audio codec types and Bluetooth sampling modes which can be supported by the Bluetooth earphone reported by the Bluetooth earphone in the local mobile phone.
In another possible implementation, when the electronic device and the target playback device are initially connected, the electronic device and the target playback device negotiate a bluetooth sampling mode, and the target playback device does not report the sampling mode support capability of the target playback device to the electronic device. When the audio to be played is played, the electronic device and the target playing device renegotiate a Bluetooth sampling mode.
For example, when the bluetooth communication connection is initially established between the mobile phone and the bluetooth headset, the bluetooth headset does not report the type of the bluetooth audio codec that the bluetooth headset can support, and the sampling frequency and the sampling number of bits of the bluetooth to the mobile phone. When the audio to be played is played, the mobile phone identifies the sampling frequency and the sampling digit of the audio, designates the type of a Bluetooth audio codec and the Bluetooth sampling mode, and sends a reconfiguration request to the Bluetooth headset, the reconfiguration request is used for requesting the Bluetooth headset to support the Bluetooth audio codec type and the Bluetooth sampling mode designated by the mobile phone, the Bluetooth headset sends a reconfiguration response to the mobile phone, the reconfiguration response is used for indicating whether the Bluetooth headset supports the Bluetooth audio codec type and the Bluetooth sampling mode designated by the mobile phone, if the reconfiguration response indicates that the Bluetooth headset does not support the Bluetooth audio codec type and the Bluetooth sampling mode designated by the mobile phone, the mobile phone reselects the Bluetooth audio codec type and the Bluetooth sampling mode according to a similar principle, namely selects the Bluetooth sampling mode close to the sampling mode of the audio to be played and the corresponding Bluetooth audio codec type, and sends the reconfiguration request to the Bluetooth headset again until the reconfiguration response sent by the Bluetooth headset indicates that the Bluetooth audio codec type and the Bluetooth sampling mode designated by the mobile phone are supported by the Bluetooth headset, and the negotiation is completed.
In the embodiment of the application, the sampling mode support capability of the target playing device is obtained when the Bluetooth communication connection is established between the electronic device and the target playing device, the negotiation time of the electronic device and the target playing device can be reduced, and the audio playing efficiency is improved.
On the basis of the foregoing embodiment, to more clearly describe the technical solution provided in the embodiment of the present application, please refer to fig. 7 and fig. 9 exemplarily, and fig. 9 shows a flowchart of a bluetooth sampling mode switching method provided in the embodiment of the present application, where the method may include: s901: the music player plays music with the audio sampling mode A1.
The mobile phone receives the operation that the music player plays the music with the audio sampling mode A1.
S902: the Bluetooth of the mobile phone uses the Bluetooth sampling mode of C1 to encode the audio data of the music with the audio sampling mode of A1 and then sends the audio data to the Bluetooth earphone for decoding and playing. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
S903: and the mobile phone detects that the music player switches the music and judges whether the audio sampling mode of the switched music is A1 or not.
In possible implementation, an audio sampling mode of the switched music is obtained, and a code identification module in the mobile phone identifies whether the audio sampling mode is A1. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
When it is determined whether the audio sampling mode of the music after switching is A1, performing step S904a; when it is determined that the audio sampling method of the switched music is not A1, step S904b is performed.
S904a: and the Bluetooth of the mobile phone continuously uses the Bluetooth sampling mode of C1 to encode the audio data of the switched music and then sends the audio data to the Bluetooth earphone for decoding and playing. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
S904b: the Bluetooth sampling mode of the mobile phone is switched, and the switched Bluetooth sampling mode is the same as the audio sampling mode of the switched music. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
S905: and ending the music playing.
If the music is to be played continuously, the above steps S901 to S905 may be repeated.
In the embodiment of the application, some Bluetooth codec types can support various Bluetooth sampling modes, the Bluetooth codec types can be switched without switching when the equipment uses the Bluetooth codec, and the Bluetooth sampling modes can be correspondingly switched according to the audio sampling modes of the switched music, so that the sound source content is matched with the transmission link, and the tone quality experience is effectively improved.
For example, please refer to fig. 8 and fig. 10, fig. 10 is a flowchart illustrating a bluetooth sampling mode switching method according to an embodiment of the present application, where the method includes:
s1001: the music player plays music with the audio sampling mode A1.
The mobile phone receives the operation that the music player plays the music with the audio sampling mode A1.
S1002: the Bluetooth of the mobile phone uses the Bluetooth sampling mode of C1 to encode the audio data of the music with the audio sampling mode of A1 and then sends the audio data to the Bluetooth earphone for decoding and playing. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
S1003: and the mobile phone detects that the music player switches the music and judges whether the audio sampling mode of the switched music is A1 or not.
In possible implementation, an audio sampling mode of the switched music is obtained, and a code identification module in the mobile phone identifies whether the audio sampling mode is A1. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
The steps S901 to S903 are the same as or similar to the steps S1001 to S1003.
When it is determined whether the audio sampling mode of the music after switching is A1, performing step S1004a; when it is determined that the audio sampling method of the music after switching is not A1, step S1004b is performed.
S1004a: and the Bluetooth of the mobile phone continuously uses the Bluetooth sampling mode of C1 to encode the audio data of the switched music and then sends the audio data to the Bluetooth earphone for decoding and playing. This step is the same as or similar to step S904a described above.
S1004b: and judging whether the Bluetooth codec type used by the mobile phone supports the audio sampling mode of the switched music.
In possible implementation, whether a bluetooth sampling mode which is the same as the audio sampling mode of the switched music exists in the bluetooth sampling modes corresponding to the types of the bluetooth codecs used by the mobile phone is judged. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
If it is determined that the type of the bluetooth codec being used by the mobile phone supports the audio sampling mode of the music after switching, step S1005a is performed; if it is determined that the type of the bluetooth codec being used by the mobile phone does not support the audio sampling mode of the switched music, the steps S1005b to S1006b are performed.
S1005a: the Bluetooth sampling mode of the mobile phone is switched, and the switched Bluetooth sampling mode is the same as the audio sampling mode of the switched music. This step is the same as or similar to step S904b described above.
S1005b: the bluetooth codec type of the handset is switched to a higher order.
Illustratively, the type of bluetooth codec being used by the mobile phone is sbc, which is switched to aac. For specific implementation, reference may be made to the foregoing embodiments, which are not described in detail herein.
S1006b: and selecting a corresponding Bluetooth sampling mode from the Bluetooth sampling modes corresponding to the switched Bluetooth codec types, and switching the Bluetooth sampling mode of the C1 into the selected Bluetooth sampling mode. For specific implementation, reference may be made to the above embodiments, which are not described herein again.
S1007: and the music playing is finished.
If the music is to be played continuously, the above steps S1001 to S1007 can be repeated.
In the embodiment of the application, when the quality of the played music content exceeds the range of the Bluetooth sampling mode corresponding to the Bluetooth codec type, the Bluetooth codec type switching process is added, and the corresponding Bluetooth sampling mode is selected in the corresponding Bluetooth codec capability range, namely, the Bluetooth codec type and the Bluetooth sampling mode are correspondingly switched according to the audio sampling mode of the switched music, so that the sound source content is matched with the transmission link, and the sound quality experience is effectively improved.
For more clearly describing the method of the embodiment of the present application, the following description continues with an example in which the electronic device is a mobile phone and the target playback device is a bluetooth headset, and it is understood that this example does not constitute a limitation to the embodiment of the present application.
Exemplarily, fig. 11 shows a flowchart of an audio playing method provided in an embodiment of the present application. As shown in fig. 11, the application of the mobile phone notifies the audio unit that the playing is started; the method comprises the steps that a coding mode configuration module of an audio unit determines the sampling frequency and the sampling digit of an audio to be played and sends the sampling frequency and the sampling digit of the audio to be played to an audio coding module; the audio coding module configures a coding mode based on the sampling frequency and the sampling bit number of the audio to be played and sends the coding mode to the coding mode identification module; the encoding mode identification module judges a sampling mode of the audio to be played based on the encoding mode, designates a corresponding Bluetooth coding and decoding mode and sends the Bluetooth coding and decoding mode to the Bluetooth module, wherein the Bluetooth coding and decoding mode can comprise a Bluetooth audio codec type and a Bluetooth sampling mode; the Bluetooth module determines a target sampling mode based on a Bluetooth coding and decoding mode and the sampling mode supporting capacity of the Bluetooth headset, and sends a reconfiguration request to the Bluetooth headset, wherein the reconfiguration request can include the target sampling mode; the method comprises the steps that a Bluetooth headset receives a reconfiguration request sent by a Bluetooth module in a mobile phone and sends a reconfiguration response to the mobile phone; and the Bluetooth module in the mobile phone receives the reconfiguration response sent by the Bluetooth headset and sends the reconfiguration response to the coding pattern recognition module. In one implementation, the encoding pattern recognition module also receives a reconfiguration response from the bluetooth headset through the bluetooth module. The encoding mode configuration module receives audio data of audio to be played from an application, converts the audio data into a PCM data packet, and sends the PCM data packet to the encoding mode identification module, and the encoding mode identification module encodes the PCM data packet according to a Bluetooth encoding and decoding mode to obtain a compressed data packet (encoded audio data), and sends the compressed data packet to the Bluetooth headset through the Bluetooth module.
It can be understood that the bluetooth encoding mode adopted by the encoding and decoding mode recognition module in the electronic device corresponds to the bluetooth decoding mode adopted by the target playing device, for example, the mobile phone encodes the PCM data packet in a manner that the bluetooth audio codec type is LDAC, the sampling frequency of bluetooth is 44.1kHz, and the sampling bit number of bluetooth is 16 bits, and correspondingly, the bluetooth headset also decodes the compressed data packet in a manner that the bluetooth audio codec type is LDAC, the sampling frequency is 44.1kHz, and the sampling bit number is 16 bits.
In the embodiment of the application, the coding mode recognition module is added, the audio codec to be played can be selectively processed according to the sampling mode of the audio to be played and the sampling mode support capability of the target playing device, so that the sampling mode of the audio to be played and the sampling mode adopted when the audio to be played is coded and decoded are matched, and the tone quality experience is effectively improved.
Illustratively, fig. 12 shows an interaction diagram of audio playing provided by an embodiment of the present application. As shown in fig. 12, the mobile phone (source) may include a media storage (media storage), a waveform audio driver (waveform audio driver), a bluetooth protocol stack, where the media storage may be understood as an audio playing application, the media storage may include one or more digital audio files, the bluetooth protocol stack 1002 may include a code recognition module 1003, a Service Discovery Protocol (SDP), a logical link control and adaptation protocol (L2 CAP), a Link Manager Protocol (LMP), an A2DP, an audio/video remote control protocol (rcp), an audio/video distribution transport protocol (AVDTP), a serial video simulation protocol (rfm). The headset (receiver) may include a bluetooth protocol stack, an A2DP plug-in (A2 DP plug-in), a media player (media player), an audio driver, and an audio output speaker (audio output speakers). The interaction between the mobile phone and the earphone comprises Bluetooth AVRCP connection and Bluetooth A2DP connection.
In the embodiment of the application, the code identification module identifies the sampling mode of the digital audio file in the media storage, and specifies the Bluetooth coding and decoding mode according to the identified sampling mode, including the type of the Bluetooth coder and decoder, the sampling frequency and the sampling mode of the Bluetooth. The coding identification module sends the Bluetooth coding and decoding mode to the earphone through A2DP, and the earphone can execute audio playing according to the Bluetooth coding and decoding mode.
The method provided by the embodiment of the present application is explained above with reference to fig. 5 to 12, and the apparatus provided by the embodiment of the present application for performing the method is described below. Referring to fig. 13, fig. 13 is a schematic structural diagram of an audio playing apparatus provided in the embodiment of the present application, where the audio playing apparatus may be an electronic device in the embodiment of the present application, and may also be a chip or a chip system in the electronic device.
As shown in fig. 13, an audio playback apparatus 1300 may be used in a communication device, circuit, hardware component, or chip, the audio playback apparatus comprising: a processing unit 1301, a communication unit 1302, and a display unit 1303.
The processing unit 1301 is configured to control and manage actions of the audio playback apparatus 1300. For example, may be used to perform processing steps associated with the encoding mode identification module and encoding mode configuration module in the embodiments described above, and/or processing steps associated with the audio encoding module, and/or other processes for the techniques described herein.
The communication unit 1302 is configured to support communication between the audio playback apparatus 1300 and other network entities. For example, the method may be used to perform the steps related to the source sending bluetooth packets to the sink, and/or the steps related to the source and the sink interacting with messages, and/or other processes for the techniques described herein.
The display unit 1303 may be used for interface display in which a sampling manner is set in advance.
In one possible implementation manner, the audio playing apparatus 1300 may further include: a storage unit 1304. The storage unit 1304 may include one or more memories, which may be devices in one or more devices or circuits for storing programs or data.
The storage unit 1304 may be separate and connected to the processing unit 1301 via a communication bus. The memory unit 1304 may also be integrated with the processing unit 1301.
Taking the audio playing apparatus 1300 may be a chip or a chip system of the electronic device in this embodiment as an example, the storage unit 1304 may store computer-executable instructions of the method of the electronic device, so that the processing unit 1301 executes the method of the electronic device in the above embodiment. The storage unit 1304 may be a register, a cache, a Random Access Memory (RAM), or the like, and the storage unit 1304 may be integrated with the processing unit 1301. Storage unit 1304 may be a read-only memory (ROM) or other type of static storage device that may store static information and instructions, and storage unit 1304 may be separate from processing unit 1301.
The apparatus of this embodiment may be correspondingly used to perform the steps performed in the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 14 is a schematic hardware structure diagram of another electronic device according to an embodiment of the present disclosure, and as shown in fig. 14, the electronic device includes a processor 1401, a communication line 1404, and at least one communication interface (an example of the communication interface 1403 in fig. 14 is illustrated as an example).
Processor 1401 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more ics for controlling the execution of programs in accordance with the teachings of the present disclosure.
The communication line 1404 may include circuitry to communicate information between the above-described components.
Communication interface 1403, using any transceiver or the like, for communicating with other devices or communication networks, such as ethernet, wireless Local Area Networks (WLAN), etc.
Possibly, the electronic device may further comprise a memory 1402.
The memory 1402 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disk read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these. The memory may be separate and coupled to the processor via a communication line 1404. The memory may also be integral to the processor.
The memory 1402 is used for storing computer-executable instructions for executing the present invention, and is controlled by the processor 1401 for execution. The processor 1401 is configured to execute computer-executable instructions stored in the memory 1402, thereby implementing the methods provided by the embodiments of the present application.
Possibly, the computer executed instructions in the embodiments of the present application may also be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
In particular implementations, process 1401 may include one or more CPUs, such as CPU0 and CPU1 of FIG. 14, as an embodiment.
In particular implementations, an electronic device may include multiple processors, such as processor 1401 and processor 1405 in fig. 14, for example, as an embodiment. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
Exemplarily, fig. 15 is a schematic structural diagram of a chip provided in an embodiment of the present application. Chip 1500 includes one or more (including two) processors 1502 and a communication interface 1503.
In some implementations, the memory 1504 stores the following elements: an executable module or a data structure, or a subset thereof, or an expanded set thereof.
In an embodiment of the present application, the memory 1504 may include both read-only memory and random-access memory, and provides instructions and data to the processor 1502. The portion of the memory 1504 may also include non-volatile random access memory (NVRAM).
In the illustrated embodiment, the memory 1504, communication interface 1503 and processor 1502 are coupled via a bus system 1501. The bus system 1501 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. For ease of description, the various buses are labeled as bus system 1501 in FIG. 15.
The method described in the embodiments of the present application may be applied to the processor 1502 or implemented by the processor 1502. The processor 1502 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by instructions in the form of hardware, integrated logic circuits, or software in the processor 1502. The processor 1502 may be a general-purpose processor (e.g., a microprocessor or a conventional processor), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate, transistor logic device or discrete hardware component, and the processor 1502 may implement or execute the methods, steps and logic blocks disclosed in the embodiments of the present invention.
The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium mature in the field, such as a random access memory, a read only memory, a programmable read only memory, or a charged erasable programmable memory (EEPROM). The storage medium is located in the memory 1504, and the processor 1502 reads the information in the memory 1504 and performs the steps of the above method in combination with the hardware thereof.
In the above embodiments, the instructions stored by the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be written in the memory in advance, or may be downloaded in the form of software and installed in the memory.
The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optics, digital Subscriber Line (DSL), or wireless (e.g., infrared, wireless, microwave, etc.) computer-readable storage media may be any available media that a computer can store or a data storage device including one or more servers, data centers, etc. integrated with available media.
The embodiment of the application also provides a computer readable storage medium. The methods described in the above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may include any medium that can communicate a computer program from one place to another. A storage medium may be any target medium that can be accessed by a computer.
As one possible design, the computer-readable medium may include a compact disk read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disk storage; the computer readable medium may include a disk memory or other disk storage device. Also, any connecting line may also be properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers.
Combinations of the above should also be included within the scope of computer-readable media. The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present invention, and shall cover the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An audio playing method is applied to an electronic device, and the method comprises the following steps:
detecting that the music player switches music, and judging whether the audio sampling mode of the switched music is the same as the audio sampling mode of the music before switching; the switched music is audio to be played;
if the audio file is different from the audio file to be played, analyzing the audio file to be played to obtain a sampling mode of the audio to be played, wherein the sampling mode comprises sampling frequency and sampling digit; determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode supporting capacity of the target playing equipment;
coding the audio to be played based on the target sampling mode to obtain coded audio data;
and sending the encoded audio data to the target playing device, wherein the target playing device is used for decoding and playing the encoded audio data based on the target sampling mode.
2. The method according to claim 1, wherein the determining a target sampling mode according to the sampling mode of the audio to be played and the sampling mode support capability of the target playback device comprises:
when the sampling mode of the audio to be played is supported by the target playing device is determined according to the sampling mode supporting capacity of the target playing device, the target sampling mode is obtained, and the target sampling mode is the sampling mode of the audio to be played;
alternatively, the first and second electrodes may be,
when the target playing device does not support the sampling mode of the audio to be played according to the sampling mode support capability of the target playing device, obtaining the target sampling mode, wherein the target sampling mode comprises the following steps: the electronic device and the target playing device negotiate a sampling mode in advance, or a sampling mode preset by a user.
3. The method according to claim 2, wherein the sampling modes pre-negotiated by the electronic device and the target playback device include higher-order sampling modes that can be supported by the target playback device.
4. The method according to any one of claims 1-3, further comprising:
and when the sampling mode of the audio to be played is the same as the sampling mode of the audio data historically played by the electronic equipment, determining the target sampling mode, wherein the target sampling mode is the sampling mode adopted when the audio data historically played by the electronic equipment is played.
5. The method according to any one of claims 1 to 3, wherein the analyzing the audio file of the audio to be played to obtain the sampling mode of the audio to be played comprises:
responding to the playing triggering operation of the audio to be played in the audio playing application, analyzing an audio file of the audio to be played, and acquiring a sampling mode of the audio to be played.
6. The method according to any one of claims 1 to 3, wherein before encoding the audio to be played based on the target sampling manner and obtaining encoded audio data, the method further comprises:
sending a reconfiguration request to the target playing device, wherein the reconfiguration request comprises the target sampling mode;
and receiving a reconfiguration response from the target playing device.
7. The method of claim 1, wherein a bluetooth module is disposed in the electronic device, and the bluetooth module is configured to determine the target sampling manner, obtain the encoded audio data, and send the encoded audio data to the target playback device.
8. The method according to claim 7, wherein the sampling mode support capability of the target playback device is obtained by the electronic device when a bluetooth communication connection is established with the target playback device.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, causes the electronic device to perform the method of any of claims 1-8.
10. A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes a computer to carry out the method according to any one of claims 1 to 8.
CN202210683076.3A 2022-06-17 2022-06-17 Audio playing method, device and storage medium Active CN114783452B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210683076.3A CN114783452B (en) 2022-06-17 2022-06-17 Audio playing method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210683076.3A CN114783452B (en) 2022-06-17 2022-06-17 Audio playing method, device and storage medium

Publications (2)

Publication Number Publication Date
CN114783452A CN114783452A (en) 2022-07-22
CN114783452B true CN114783452B (en) 2022-12-13

Family

ID=82422107

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210683076.3A Active CN114783452B (en) 2022-06-17 2022-06-17 Audio playing method, device and storage medium

Country Status (1)

Country Link
CN (1) CN114783452B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286770A (en) * 2007-04-09 2008-10-15 艾威梯软件技术(北京)有限公司 Method and system for automatically configuring audio encoding format transmitted by bluetooth A2DP
CN105242900A (en) * 2015-08-04 2016-01-13 美国掌赢信息科技有限公司 Audio parameter adjustment method and device for mobile device
CN109003618A (en) * 2018-08-14 2018-12-14 Oppo广东移动通信有限公司 Coding control method, device, electronic equipment and storage medium
CN109273017A (en) * 2018-08-14 2019-01-25 Oppo广东移动通信有限公司 Coding control method, device and electronic equipment
CN111199743A (en) * 2020-02-28 2020-05-26 Oppo广东移动通信有限公司 Audio coding format determining method and device, storage medium and electronic equipment
CN112313929A (en) * 2018-12-27 2021-02-02 华为技术有限公司 Method for automatically switching Bluetooth audio coding modes and electronic equipment
CN112738732A (en) * 2019-10-28 2021-04-30 成都鼎桥通信技术有限公司 Audio playing method and device
CN113689864A (en) * 2021-10-27 2021-11-23 北京百瑞互联技术有限公司 Audio data processing method and device and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2011239270A1 (en) * 2005-10-21 2011-11-10 The Nielsen Company (Us), Llc Methods and apparatus for metering portable media players
JP2008140434A (en) * 2006-11-30 2008-06-19 Alpine Electronics Inc Digital audio device and its sample rate changing method
CN101034549A (en) * 2007-03-30 2007-09-12 深圳万利达电子工业有限公司 Sound recording and storing method and video/audio device
CN101217038B (en) * 2008-01-17 2011-06-22 中兴通讯股份有限公司 An encoding method of audio data SBC algorithm and Bluetooth stereo subsystem
CN105869647B (en) * 2016-05-05 2019-10-08 西安睿芯微电子有限公司 A kind of primary DSD audio-frequency decoding method of smart phone, system and smart phone
CN107105096A (en) * 2017-04-28 2017-08-29 努比亚技术有限公司 A kind of audio-frequency processing method, terminal and storage medium
CN112530444B (en) * 2019-09-18 2023-10-03 华为技术有限公司 Audio coding method and device
CN111798858A (en) * 2020-07-03 2020-10-20 腾讯科技(深圳)有限公司 Audio playing method and device, electronic equipment and storage medium
US20210168187A1 (en) * 2020-12-23 2021-06-03 Intel Corporation Apparatus, system and method of communicating audio traffic over a bluetooth link

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286770A (en) * 2007-04-09 2008-10-15 艾威梯软件技术(北京)有限公司 Method and system for automatically configuring audio encoding format transmitted by bluetooth A2DP
CN105242900A (en) * 2015-08-04 2016-01-13 美国掌赢信息科技有限公司 Audio parameter adjustment method and device for mobile device
CN109003618A (en) * 2018-08-14 2018-12-14 Oppo广东移动通信有限公司 Coding control method, device, electronic equipment and storage medium
CN109273017A (en) * 2018-08-14 2019-01-25 Oppo广东移动通信有限公司 Coding control method, device and electronic equipment
CN112313929A (en) * 2018-12-27 2021-02-02 华为技术有限公司 Method for automatically switching Bluetooth audio coding modes and electronic equipment
CN112738732A (en) * 2019-10-28 2021-04-30 成都鼎桥通信技术有限公司 Audio playing method and device
CN111199743A (en) * 2020-02-28 2020-05-26 Oppo广东移动通信有限公司 Audio coding format determining method and device, storage medium and electronic equipment
CN113689864A (en) * 2021-10-27 2021-11-23 北京百瑞互联技术有限公司 Audio data processing method and device and storage medium

Also Published As

Publication number Publication date
CN114783452A (en) 2022-07-22

Similar Documents

Publication Publication Date Title
JP7222112B2 (en) Singing recording methods, voice correction methods, and electronic devices
WO2021147415A1 (en) Method for implementing stereo output and terminal
CN112399390B (en) Bluetooth connection method and related device
WO2023029967A1 (en) Audio playback method, and electronic device
CN109286725B (en) Translation method and terminal
US20220159453A1 (en) Method for Using Remote SIM Module and Electronic Device
WO2022222713A1 (en) Codec negotiation and switching method
WO2022143258A1 (en) Voice interaction processing method and related apparatus
CN114422710A (en) Video recording control method for electronic equipment, electronic equipment and readable medium
CN113488042B (en) Voice control method and electronic equipment
CN113126948A (en) Audio playing method and related equipment
CN114783452B (en) Audio playing method, device and storage medium
WO2023273904A1 (en) Method for storing audio data and related device thereof
WO2022211389A1 (en) Electronic device for supporting audio sharing
CN113380240B (en) Voice interaction method and electronic equipment
CN115643339A (en) Method for adjusting volume, electronic device and computer readable storage medium
CN116828102B (en) Recording method, recording device and storage medium
CN114640742A (en) Vibration method, device, electronic equipment and readable storage medium
CN117499850B (en) Audio data playing method and electronic equipment
CN114006969B (en) Window starting method and electronic equipment
CN116744244B (en) Communication method, storage medium and electronic equipment
US11120810B2 (en) Recording device
CN114173315B (en) Bluetooth reconnection method and terminal equipment
RU2777617C1 (en) Song recording method, sound correction method and electronic device
WO2023130956A1 (en) Enhanced vibration prompting method and electronic device

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