WO2022228013A1 - 一种投音方法及计算机可读存储介质 - Google Patents

一种投音方法及计算机可读存储介质 Download PDF

Info

Publication number
WO2022228013A1
WO2022228013A1 PCT/CN2022/084147 CN2022084147W WO2022228013A1 WO 2022228013 A1 WO2022228013 A1 WO 2022228013A1 CN 2022084147 W CN2022084147 W CN 2022084147W WO 2022228013 A1 WO2022228013 A1 WO 2022228013A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
audio
audio data
transmission channel
channel
Prior art date
Application number
PCT/CN2022/084147
Other languages
English (en)
French (fr)
Inventor
徐露
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022228013A1 publication Critical patent/WO2022228013A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/008Multichannel audio signal coding or decoding using interchannel correlation to reduce redundancy, e.g. joint-stereo, intensity-coding or matrixing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/20Arrangements for obtaining desired frequency or directional characteristics
    • H04R1/32Arrangements for obtaining desired frequency or directional characteristics for obtaining desired directional characteristic only
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/70Services for machine-to-machine communication [M2M] or machine type communication [MTC]
    • 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
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Definitions

  • the present application relates to the technical field of terminals, and in particular, to a sound projection method and a computer-readable storage medium.
  • Sound projection (also called sound transmission) enables the first electronic device to play audio data using the playback capability of the second electronic device, thereby providing a better listening experience for the user, and is widely used.
  • One-touch sound projection also called one-touch sound transmission
  • the first electronic device and the second electronic device can be in contact or not contact
  • find the other party find the other party, and establish a short-distance wireless communication channel; through the channel, transmit audio data or link address, the second electronic device plays based on the audio data, or the second electronic device obtains the audio data based on the link address and play.
  • a quick and convenient user experience can be provided to the user.
  • how to further improve the above-mentioned sound projection method to provide users with a better experience has become our demand.
  • the present application provides a sound projection method, a first electronic device, a second electronic device and a computer-readable storage medium.
  • the technical solution provided by this application is aimed at the situation that audio data is transmitted from a first electronic device to a second electronic device and played by the second electronic device, through the perspectives of low latency and high-quality audio, combined with short-distance wireless communication
  • the different characteristics of the sound projection taking into account the sound projection response speed and sound projection quality as much as possible, provide users with a better listening experience; enable users to hear audio data faster and hear high-quality audio data earlier.
  • a sound projection method is provided, which is applied to a second electronic device, and the second electronic device and the first electronic device form a sound projection system.
  • the method includes: in response to the first electronic device and the second electronic device touching each other, the second electronic device discovers the first electronic device through near field communication NFC; in response to the first electronic device between the first electronic device and the second electronic device The transmission channel is established successfully, and the second electronic device receives audio data through the first transmission channel; the second electronic device plays the first audio, and the first audio is the audio data received by the second electronic device through the first transmission channel; in response to the first electronic device The second transmission channel between the device and the second electronic device is successfully established, and the second electronic device receives audio data through the second transmission channel; the second electronic device switches the played audio data from the first audio to the second audio, and the second The audio is audio data received by the second electronic device through the second transmission channel.
  • the sound is projected through the first transmission channel, which can reduce the delay of sound projection; after the establishment of the second transmission channel, the sound projection through the first transmission channel is stopped, and the Two transmission channel sound projection, can ensure better playback effect of high-quality audio.
  • the characteristics of the first transmission channel establishing a small delay low-latency audio delivery is guaranteed; in a short time before the second transmission channel is successfully established, the smart speaker has a poor effect of playing audio; if the second transmission channel is successfully established, the smart speaker After the second audio is played, a better playback effect of the high-quality audio can be guaranteed; both low-latency and high-quality audio are taken into account, providing users with a better sound projection playback experience.
  • the method before the second electronic device switches the played audio data from the first audio to the second audio, the method further includes: the second electronic device determines that the set condition is satisfied.
  • the setting condition includes that the second electronic device buffers the second audio of a preset duration; in another implementation, the setting condition includes that the second electronic device receives audio data from the second transmission channel .
  • the method before the second electronic device switches the played audio data from the first audio to the second audio, the method further includes: The electronic device receives a first message, where the first message is used to instruct the second electronic device to switch the played audio data from the first audio to the second audio. In this way, the first electronic device triggers the second electronic device to switch the played audio data from the first audio to the second audio. In an implementation manner, the first electronic device determines that the second transmission channel is successfully established, and then determines that the second electronic device switches the played audio data from the first audio to the second audio.
  • the first electronic device when the first electronic device receives from the second electronic device an instruction message (second message) to stop transmitting audio data through the first transmission channel, it is determined that the audio data to be played by the second electronic device is from the first transmission channel. One audio is switched to the second audio.
  • second message an instruction message
  • the method further includes: the second electronic device determines the first display timestamp PTS according to the first audio data packet of the currently played first audio, and according to the first The PTS determines the second audio data packet of the second audio; the second electronic device stops playing the first audio at the moment indicated by the first PTS, and starts to play the second audio data packet of the second audio.
  • the first electronic device sends the audio data
  • the same PTS is applied to the first audio data packet and the second audio data packet. In this way, by acquiring the corresponding second audio data packet according to the PTS of the first audio data packet, smooth switching of audio data can be realized.
  • the second electronic device determining the first display timestamp PTS according to the currently played first audio includes: the second electronic device converts the currently played first audio data packet The PTS value of the next audio data packet is determined as the first PTS.
  • the method further includes: the second electronic device resampling the received first audio at the first sampling rate and the first bit depth; the second electronic device The received second audio is resampled at the first sampling rate and the first bit depth.
  • the first audio data packet and the second audio data packet can be saved in the same format.
  • the PTS value in the first audio data packet is obtained from the corresponding second audio data packet; the seamless switching of the played audio data is ensured.
  • the method further includes: the second electronic device sends a second message to the first electronic device, where the second message is used to notify the first electronic device to stop using the first electronic device
  • the transmission channel transmits audio data.
  • the first electronic device stops transmitting audio data through the first transmission channel. In this way, redundant data transmission can be avoided, processing efficiency can be improved, and power consumption can be saved.
  • the second electronic device notifies the first electronic device to stop transmitting the audio data through the first transmission channel, so as to avoid stopping the transmission of the audio data through the first transmission channel before the second electronic device switches the played audio data from the first audio to the second audio Playback freezes caused by audio data.
  • the method further includes: the second message includes indication information, where the indication information is used to instruct the first electronic device to stop transmitting audio data through the first transmission channel.
  • the first transmission channel is a Bluetooth channel
  • the second transmission channel is a Wi-Fi channel
  • a second electronic device in a second aspect, includes: a processor; a memory; and a computer program, wherein the computer program is stored on the memory and, when executed by the processor, causes the second electronic device to perform the following steps: in response to the first electronic device and the second electronic device When the electronic devices touch, the second electronic device discovers the first electronic device through NFC; in response to the successful establishment of the first transmission channel between the first electronic device and the second electronic device, the second electronic device uses the first transmission The channel receives audio data; the second electronic device plays the first audio, and the first audio is the audio data received by the second electronic device through the first transmission channel; in response to the second transmission channel between the first electronic device and the second electronic device If the establishment is successful, the second electronic device receives audio data through the second transmission channel; the second electronic device switches the played audio data from the first audio to the second audio, and the second audio is received by the second electronic device through the second transmission channel audio data.
  • the second electronic device before the second electronic device switches the played audio data from the first audio to the second audio, the second electronic device further performs: determining that the set condition is satisfied.
  • the second electronic device further performs: the second electronic device buffers the second audio of a preset duration.
  • the second electronic device before the second electronic device switches the played audio data from the first audio to the second audio, the second electronic device further executes: from the first electronic device A first message is received, where the first message is used to instruct the second electronic device to switch the played audio data from the first audio to the second audio.
  • the second electronic device before the second electronic device switches the played audio data from the first audio to the second audio, the second electronic device further executes: according to the currently playing first audio data An audio determines the first display time stamp PTS, and determines the second audio data packet of the second audio based on the first PTS; stops playing the first audio at the time indicated by the first PTS, and starts playing the second audio data packet of the second audio.
  • the second electronic device further performs: determining the PTS value of the next first audio data packet of the currently playing first audio data packet as the first PTS.
  • the second electronic device further performs: re-sampling the received first audio at the first sampling rate and the first bit depth; The first bit depth resamples the received second audio.
  • the second electronic device further performs: sending a second message to the first electronic device, where the second message is used to notify the first electronic device to stop passing the first transmission channel Transmit audio data.
  • the second electronic device further performs: sending a second message including indication information to the first electronic device, where the indication information is used to instruct the first electronic device to stop using the The moment when a transmission channel transmits audio data.
  • a sound projection method is provided, which is applied to a first electronic device.
  • the method includes: in response to the first electronic device and the second electronic device touching each other, the first electronic device discovers the second electronic device through near field communication (NFC); in response to the first electronic device and the second electronic device The transmission channel is successfully established, and the first electronic device transmits audio data to the second electronic device through the first transmission channel; in response to the successful establishment of the second transmission channel between the first electronic device and the second electronic device, the first electronic device transmits audio data through the first electronic device.
  • the second transmission channel transmits audio data to the second electronic device.
  • the sound is projected through the first transmission channel, which can reduce the delay of sound projection; after the establishment of the second transmission channel, the sound projection through the first transmission channel is stopped, and the Two transmission channel sound projection, can ensure better playback effect of high-quality audio.
  • the characteristics of the first transmission channel establishing a small delay the low-latency audio is guaranteed; transmitting the audio through the second transmission channel can ensure a better playback effect of high-quality audio; taking into account both low-latency and high-quality audio, it is Provides users with a better sound projection playback experience.
  • the method further includes: the first electronic device sends a first message to the second electronic device, where the first message is used to indicate The second electronic device switches the played audio data from the first audio to the second audio.
  • the first electronic device triggers the second electronic device to switch the played audio data from the first audio to the second audio.
  • the first electronic device determines that the second transmission channel is successfully established, and then determines that the second electronic device switches the played audio data from the first audio to the second audio.
  • the first electronic device when the first electronic device receives from the second electronic device an instruction message (second message) to stop transmitting audio data through the first transmission channel, it is determined that the audio data to be played by the second electronic device is from the first transmission channel. One audio is switched to the second audio.
  • second message an instruction message
  • the method further includes: the first electronic device stops transmitting audio data through the first transmission channel. In this way, redundant data transmission can be avoided, processing efficiency can be improved, and power consumption can be saved.
  • the first electronic device stops transmitting audio data through the first transmission channel, which can avoid the playback card caused by stopping the transmission of audio data through the first transmission channel before the second electronic device switches the played audio data from the first audio to the second audio. pause.
  • the method before the first electronic device stops transmitting audio data through the first transmission channel, the method further includes: the first electronic device receives the second electronic device from the second electronic device message, and the second message is used to notify the first electronic device to stop transmitting audio data through the first transmission channel.
  • the second electronic device notifies the first electronic device to stop transmitting the audio data through the first transmission channel, so as to avoid stopping the transmission of the audio data through the first transmission channel before the second electronic device switches the played audio data from the first audio to the second audio Playback caused by audio data
  • the method further includes: the second message includes indication information, where the indication information is used to instruct the first electronic device to stop transmitting the audio data through the first transmission channel.
  • the stopping of the first electronic device from transmitting the audio data through the first transmission channel includes: the first electronic device stops transmitting the audio data through the first transmission channel at the moment indicated by the indication information.
  • the first transmission channel is a Bluetooth channel
  • the second transmission channel is a Wi-Fi channel
  • a first electronic device in a fourth aspect, includes: a processor; a memory; and a computer program, the computer program being stored on the memory and, when executed by the processor, causes the first electronic device to perform the following steps: in response to the first electronic device and the second electronic device When the devices touch, the first electronic device discovers the second electronic device through NFC; in response to the successful establishment of the first transmission channel between the first electronic device and the second electronic device, the first electronic device passes the first transmission channel transmitting audio data to the second electronic device; in response to the successful establishment of the second transmission channel between the first electronic device and the second electronic device, the first electronic device transmits the audio data to the second electronic device through the second transmission channel.
  • the first electronic device further executes: sending a first message to the second electronic device, where the first message is used to instruct the second electronic device to play the audio
  • the audio data is switched from the first audio to the second audio.
  • the first electronic device further performs: stopping the transmission of audio data through the first transmission channel.
  • the first electronic device before the first electronic device stops transmitting the audio data through the first transmission channel, the first electronic device further performs: receiving the second message from the second electronic device, The second message is used to notify the first electronic device to stop transmitting audio data through the first transmission channel.
  • the first electronic device further performs: receiving a second message including indication information from the second electronic device, where the indication information is used to instruct the first electronic device to stop using the The moment when a transmission channel transmits audio data.
  • the stopping of the first electronic device from transmitting the audio data through the first transmission channel includes: the first electronic device stops transmitting the audio data through the first transmission channel at the moment indicated by the indication information.
  • a computer-readable storage medium stores a computer program (also referred to as instructions or codes), which, when executed by the second electronic device, causes the second electronic device to execute the first aspect or any one of the implementations of the first aspect Methods.
  • a computer-readable storage medium stores a computer program (also referred to as instructions or codes), which, when executed by the first electronic device, causes the first electronic device to execute the third aspect or any one of the implementations of the third aspect Methods.
  • a computer program product when run on the second electronic device, causes the second electronic device to perform the method of the first aspect or any one of the embodiments of the first aspect.
  • a computer program product When running on the first electronic device, the computer program product causes the first electronic device to perform the method of the third aspect or any one of the embodiments of the third aspect.
  • a circuit system in a ninth aspect, includes processing circuitry configured to perform the method of the first aspect or any one of the embodiments of the first aspect.
  • a tenth aspect provides a circuit system.
  • the circuitry includes a processing circuit configured to perform the method of the third aspect or any one of the embodiments of the third aspect.
  • a chip system in an eleventh aspect, includes a processor and interface circuits.
  • the interface circuit is used to perform transceiver functions and send instructions to the processor.
  • the instructions when executed by the processor, cause the processor to perform the method of the first aspect or any one of the embodiments of the first aspect.
  • a twelfth aspect provides a chip system.
  • the chip system includes a processor and interface circuits.
  • the interface circuit is used to perform transceiver functions and send instructions to the processor.
  • the instructions when executed by the processor, cause the processor to perform the method of the third aspect or any one of the embodiments of the third aspect.
  • Fig. 1 is the scene schematic diagram of a kind of sound projection method provided
  • 2A is a schematic diagram of user operations and prompts provided by the sound projection method in the first manner
  • 2B is a schematic diagram of user operations and prompts provided by the voice projection method in the second manner
  • FIG. 3 is a schematic diagram of a communication mode between a first electronic device and a second electronic device involved in a sound projection method provided by an embodiment of the present application;
  • FIG. 4 is a schematic diagram of a hardware structure of a first electronic device provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a hardware structure of a second electronic device provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of the principle of a sound projection method provided by an embodiment of the present application.
  • FIGS. 7A-7C are schematic diagrams of principles of a sound projection method provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a sound projection method provided by an embodiment of the present application.
  • 9A is a schematic diagram of user operations and prompts of a sound projection method provided by an embodiment of the present application.
  • 9B is a schematic diagram of the correspondence between two audio data packets in the sound projection method provided by the embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a first electronic device according to an embodiment of the application.
  • FIG. 11 is a schematic structural diagram of a second electronic device according to an embodiment of the present application.
  • references in this specification to "one embodiment” or “some embodiments” and the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variants mean “including but not limited to” unless specifically emphasized otherwise.
  • the term “connected” includes both direct and indirect connections unless otherwise specified.
  • first and second are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
  • words such as “exemplarily” or “for example” are used to represent examples, illustrations or illustrations. Any embodiment or design described in the embodiments of the present application as “exemplarily” or “such as” should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as “exemplarily” or “such as” is intended to present the related concepts in a specific manner.
  • One-touch sound projection also called one-touch sound transmission
  • the first electronic device and the second electronic device also called “touching”; the first electronic device and the second electronic device can be in contact or not contact
  • find the other party and establish a short-distance wireless communication channel; through the channel, transmit audio data or link address, the second electronic device plays based on the audio data, or the second electronic device obtains the audio data based on the link address and play.
  • the "touching" of the first electronic device and the second electronic device in this application means that the first electronic device and the second electronic device are close to each other, and the distance between the first electronic device and the second electronic device is less than A certain distance enables the first electronic device and the second electronic device to discover each other; it is not limited that the two devices meet.
  • the first electronic device is a mobile phone
  • the second electronic device is a smart speaker
  • the proximity discovery between the first electronic device and the second electronic device is realized through NFC for description.
  • first electronic device and the second electronic device may be other electronic devices.
  • the proximity discovery between the first electronic device and the second electronic device may also be implemented by other short-range wireless communication methods or other methods. This application does not limit this.
  • both the mobile phone and the smart speaker support NFC.
  • the mobile phone 100 is close to the smart speaker 200, and the mobile phone 100 and the smart speaker 200 discover each other through NFC to establish a transmission channel.
  • the transmission channel may be a Bluetooth transmission channel or a Wi-Fi transmission channel. This application does not limit this.
  • the audio data of the mobile phone 100 is delivered to the smart speaker 200 through the transmission channel, and played by the smart speaker 200 .
  • the mobile phone 100 establishes a first transmission channel with the smart speaker 200 through NFC.
  • the smart phone 100 puts audio data into the smart speaker 200 through the Bluetooth channel for playback.
  • the user uses the mobile phone 100 to approach the smart speaker 200 ; in response to the above approach, a window 102 pops up on the interface 101 of the mobile phone 100 .
  • Window 102 includes a "Cancel” button 103 and a "Connect” button 104 . The user can click the "Cancel" button 103 to confirm that the phone and the smart speaker are not to be tapped to project sound.
  • the user can also click the "connect" button 104 to confirm the one-touch projection of the mobile phone and the smart speaker.
  • the smart speaker 200 in response to the user's click operation on the "connect" button 104, the smart speaker 200 establishes a Bluetooth connection with the mobile phone 100, and establishes a Bluetooth channel.
  • the audio data of the mobile phone 100 is put into the smart speaker 200 for playback through the Bluetooth channel.
  • the Bluetooth transport protocol supports a low sample rate and bit depth (representing the dynamic range of the audio) of the transmitted audio stream.
  • AAC advanced audio coding
  • LDAC wireless audio coding technology developed by Sony that allows audio to be transmitted at a speed of up to 990kbit/s through a Bluetooth channel
  • LDAC supports a sampling rate of 96KHz and a bit depth of 24bit.
  • high-quality audio such as high-resolution audio (Hi-Res) and direct stream digital (DSD) will be resampled and resampled during the process of delivering to the smart speaker through the Bluetooth channel. After sampling, the quality of the audio is reduced. In this way, high-quality audio cannot be delivered through the Bluetooth channel.
  • the Bluetooth channel establishment delay is small, and the sound projection response is fast.
  • the mobile phone 100 establishes a second transmission channel with the smart speaker 200 through NFC.
  • the wireless fidelity (Wi-Fi) channel as the second transmission channel as an example
  • the mobile phone 100 puts the audio to the smart speaker 200 through the Wi-Fi channel for playback.
  • the user uses the mobile phone 100 to approach the smart speaker 200; in response to the mobile phone 100 approaching the smart speaker 200, a window 202 pops up on the interface 201 of the mobile phone 100, and the window 202 is used to prompt the user to confirm whether to connect the mobile phone to the smart speaker.
  • Window 202 includes a "Cancel" button 203 and a "Connect” button 204 .
  • the user can click the "Cancel” button 203 to confirm that the phone and the smart speaker are not to be tapped to project sound.
  • the user can also click the "connect” button 204 to confirm the one-touch projection of the mobile phone and the smart speaker.
  • the smart speaker 200 in response to the user's click operation on the "connect" button 204, the smart speaker 200 establishes a Wi-Fi connection with the mobile phone 100, and establishes a Wi-Fi channel.
  • the audio data of the mobile phone 100 is delivered to the smart speaker 200 for playback through the Wi-Fi channel. Through Wi-Fi channel projection, high-quality audio can be transmitted without loss.
  • Wi-Fi Wi-Fi channel scanning
  • wireless network connection wireless network connection
  • DHCP dynamic host configuration protocol
  • TCP transmission control protocol
  • the above-mentioned first transmission channel is not limited to a Bluetooth channel
  • the above-mentioned second transmission channel is not limited to a Wi-Fi channel.
  • the first transmission channel and the second transmission channel may be other short-range wireless communication channels.
  • the establishment of the first transmission channel takes a short time, and the data transmitted through the first transmission channel will be resampled and the resampling rate is low, resulting in loss of a certain amount of data, thereby reducing audio quality.
  • the establishment time of the second transmission channel is longer than the establishment time of the first transmission channel.
  • the data transmitted through the second transmission channel is not resampled, or the resampling sampling rate is high, resulting in no data loss or less data loss , so that the audio quality is not degraded or less degraded.
  • the Bluetooth channel is used as the first transmission channel and the Wi-Fi channel is used as the second transmission channel for exemplary description.
  • Embodiments of the present application provide a sound projection method, a first electronic device, a second electronic device, and a computer-readable storage medium.
  • the first electronic device and the second electronic device discover each other through "touching", and then establish a Bluetooth channel and a Wi-Fi channel synchronously and independently of each other.
  • the establishment of the Bluetooth channel takes less time.
  • the first electronic device starts to project sound.
  • the first electronic device transmits audio data to the second electronic device based on the rapidly established Bluetooth channel.
  • the second electronic device plays the audio data received from the Bluetooth channel.
  • the establishment of the Wi-Fi channel takes longer than the establishment of the Bluetooth channel.
  • the first electronic device transmits audio data to the second electronic device in parallel through the Wi-Fi channel and the Bluetooth channel.
  • the second electronic device switches the audio source for playback, that is, the audio data received from the Bluetooth channel, to the audio data received from the Wi-Fi channel. Since the establishment of the Bluetooth channel takes a short time, after the Bluetooth channel is successfully established, the sound is projected through the Bluetooth channel, which can make the delay of the sound projection smaller. After a period of time (for example, 3 seconds), the establishment of the Wi-Fi channel is completed, and it is switched to project audio through the Wi-Fi channel to ensure high-quality audio playback.
  • both the sound projection response speed and the sound projection quality are taken into consideration to provide users with a better listening experience; after a low delay, the user can hear the audio data, and after a period of time, the user can hear the high-quality audio data. It takes into account low-latency and high-quality audio, providing users with a better one-touch sound projection playback experience.
  • FIG. 3 shows a system architecture to which the sound projection method provided by the embodiment of the present application is applicable.
  • the system includes a first electronic device 100 and a second electronic device 200 .
  • the first electronic device 100 and the second electronic device 200 support the NFC function, the Bluetooth function, and the Wi-Fi function, respectively.
  • the first electronic device 100 and the second electronic device 200 discover each other through "touching", and establish a Bluetooth channel and a Wi-Fi channel. In this way, the first electronic device 100 can deliver audio data to the second electronic device 200 for playback through a Bluetooth channel or a Wi-Fi channel.
  • the first electronic device 100 may be an electronic device supporting NFC, Bluetooth and Wi-Fi, and the electronic device may include portable mobile devices (such as mobile phones, etc.), handheld computers, tablet computers, notebook computers, netbooks, personal computers (personal computers, etc.) computer, PC), smart home devices (such as smart TVs, etc.), personal digital assistants (PDAs), wearable electronic devices (such as smart watches, smart bracelets, etc.), augmented reality (AR) ) ⁇ Virtual reality (virtual reality, VR) equipment, car computer, etc.
  • the above-mentioned electronic device may also be other portable mobile devices, such as a laptop computer (Laptop) and the like. It should also be understood that, in some other embodiments, the above-mentioned electronic device may not be a portable mobile device, but a fixed device.
  • the specific form of the first electronic device 100 is not particularly limited in this embodiment of the present application.
  • the above-mentioned second electronic device 200 may be an electronic device supporting NFC, Bluetooth and Wi-Fi, and the electronic device may include smart home devices (such as smart speakers, smart lights, smart washing machines, smart air conditioners, etc.), wearable devices (such as , smart watches, smart bracelets, etc.), augmented reality (AR) ⁇ virtual reality (virtual reality, VR) devices, car computers, portable mobile devices (such as mobile phones, etc.), handheld computers, tablet computers, laptops, Netbooks, personal computers (PCs), etc.
  • AR ⁇ virtual reality (virtual reality, VR) devices
  • car computers portable mobile devices (such as mobile phones, etc.), handheld computers, tablet computers, laptops, Netbooks, personal computers (PCs), etc.
  • the above-mentioned electronic device may also be other portable mobile devices, such as a laptop computer (Laptop) and the like. It should also be understood that, in some other embodiments, the above-mentioned electronic device may not be a portable mobile device, but a fixed device.
  • FIG. 4 shows a schematic structural diagram of a first electronic device 100 .
  • the first electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a display screen 140, a mobile communication module 150, a wireless communication module 160, a SIM card interface 170, a power module 180, and the like.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the first electronic device 100 .
  • the first electronic device 100 may include more or less components than shown, or some components are combined, or some components are separated, or different components are arranged.
  • 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.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (ISP), a controller, a video Codec, digital signal processor (DSP), and/or neural-network processing unit (NPU), etc.
  • AP application processor
  • modem processor graphics processor
  • ISP image signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • different processing units can be independent components, and can also be integrated in one or more processors.
  • the first electronic device 100 may also include one or more processors 110 .
  • the application processor may run the operating system of the first electronic device 100 for managing hardware and software resources of the first electronic device 100 . For example, managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating networks, managing file systems, managing drivers, etc.
  • the operating system can also be used to provide an operating interface for the user to interact with the system.
  • various types of software can be installed in the operating system, for example, a driver program, an application program (application, App), and the like.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM card interface, and/or USB interface, etc.
  • I2C inter-integrated circuit
  • I2S inter-integrated circuit sound
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous receiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM card interface SIM card interface
  • USB interface etc.
  • the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the first electronic device 100 .
  • the first electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the first electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. Such as saving audio, video etc files in external memory card.
  • Internal memory 121 may be used to store one or more computer programs including instructions.
  • the processor 110 may execute the above-mentioned instructions stored in the internal memory 121, thereby causing the first electronic device 100 to execute the methods provided in some embodiments of the present application, as well as various applications and data management.
  • the internal memory 121 may include a code storage area and a data storage area.
  • the first electronic device 100 implements a display function through a GPU, a display screen 140, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 140 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 140 is used to display images, videos, and the like.
  • the display screen 140 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the first electronic device 100 may include 1 or N display screens 140 , where N is a positive integer greater than 1.
  • the display screen 140 may display a window for prompting the user to confirm whether to perform one-touch sound projection, and receive the user's operation on the interface of the electronic device.
  • the wireless communication function of the first electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, and the like.
  • the mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G etc. applied on the first electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • the wireless communication module 160 can provide applications on the first electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global Navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication (near field communication, NFC), infrared (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global Navigation satellite system
  • frequency modulation frequency modulation, FM
  • NFC near field communication
  • infrared infrared
  • IR infrared
  • 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 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the wireless communication module 160 is configured to perform a Bluetooth connection and a Wi-Fi connection, establish a transmission channel, and deliver audio data through the transmission channel.
  • the antenna 1 of the first electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the first electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi-zenith) satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the SIM card interface 170 is used to connect a SIM card.
  • the power module 180 may be used to supply power to various components included in the first electronic device 100 .
  • the power module 180 may be a battery, such as a rechargeable battery.
  • FIG. 5 shows a schematic structural diagram of a second electronic device 200 .
  • the second electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, an audio module 230, a speaker 230A, a microphone 230B, an earphone interface 230C, a wireless communication module 260, a power supply module 280, and the like.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the second electronic device 200 .
  • the second electronic device 200 may include more or less components than shown, or some components may be combined, or some components may be separated, or different component arrangements.
  • the illustrated components may be implemented in hardware, software or a combination of software and hardware.
  • Processor 210 may include one or more processing units.
  • the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP) , and/or a neural network processor (NPU), etc.
  • AP application processor
  • GPU graphics processor
  • ISP image signal processor
  • DSP digital signal processor
  • NPU neural network processor
  • different processing units may be independent components, or may be integrated in one or more processors.
  • the second electronic device 200 may also include one or more processors 210 .
  • the controller is the nerve center and command center of the second electronic device 200 .
  • the operation control signal can be generated according to the instruction operation code and the timing signal to complete the control of fetching and executing the instruction.
  • An operating system of the second electronic device 200 may be run on the application processor to manage hardware and software resources of the second electronic device 200 . For example, managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating networks, managing file systems, managing drivers, etc.
  • the operating system can also be used to provide an operating interface for the user to interact with the system.
  • various types of software can be installed in the operating system, for example, a driver program, an application program (application, App), and the like.
  • a memory may also be provided in the processor 210 for storing instructions and data.
  • the memory in processor 210 is cache memory.
  • the memory may hold instructions or data that have just been used or recycled by the processor 210 . If the processor 210 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided, and the waiting time of the processor 210 is reduced, thereby improving the efficiency of the system.
  • the processor 210 may include one or more interfaces. Interfaces may include Inter-Integrated Circuit (I2C) interface, Inter-Integrated Circuit Audio (I2S) interface, Pulse Code Modulation (PCM) interface, Universal Asynchronous Receiver Transmitter (UART) interface, Mobile Industry Processor Interface (MIPI), Universal Input Output (GPIO) interface, SIM card interface, and/or USB interface, etc.
  • I2C Inter-Integrated Circuit
  • I2S Inter-Integrated Circuit Audio
  • PCM Pulse Code Modulation
  • UART Universal Asynchronous Receiver Transmitter
  • MIPI Mobile Industry Processor Interface
  • GPIO Universal Input Output
  • SIM card interface SIM card interface
  • USB interface etc.
  • the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the second electronic device 200 .
  • the second electronic device 200 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the second electronic device 200.
  • the external memory card communicates with the processor 210 through the external memory interface 220 to realize the data storage function. Such as saving audio, video etc files in external memory card.
  • Internal memory 221 may be used to store one or more computer programs including instructions.
  • the processor 210 may execute the above-mentioned instructions stored in the internal memory 221, thereby causing the second electronic device 200 to execute the methods provided in some embodiments of the present application, as well as various applications and data management.
  • the internal memory 221 may include a code storage area and a data storage area.
  • the second electronic device 200 may implement audio functions through an audio module 230, a speaker 230A, a microphone 230B, an earphone interface 230C, an application processor, and the like. Such as audio playback, recording, etc.
  • the audio module 230 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 230 may also be used to encode and decode audio signals. In some embodiments, the audio module 230 may be provided in the processor 210 , or some functional modules of the audio module 230 may be provided in the processor 210 .
  • Speaker 230A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the speaker 230A is used to convert the received audio electrical signal into a sound signal for output.
  • the microphone 230B also called “microphone” or “microphone” is used to convert sound signals into electrical signals. The user can make a sound by approaching the microphone 230B through the human mouth, and input the sound signal to the microphone 230B.
  • the earphone jack 230C is used to connect wired earphones.
  • the earphone interface 230C may be a USB interface, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the wireless communication function of the second electronic device 200 may be implemented by the antenna and the wireless communication module 260 .
  • the wireless communication module 260 can provide wireless local area network (WLAN) (such as Wi-Fi network), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), short-range wireless network applied on the second electronic device 200 Communication (NFC), Infrared (IR) and other wireless communication solutions.
  • the wireless communication module 260 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 260 receives electromagnetic waves via the antenna, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210 .
  • the wireless communication module 260 can also receive the signal to be sent from the processor 210, frequency-modulate the signal, amplify the signal, and radiate it into electromagnetic waves through the antenna.
  • the wireless communication module 260 is configured to perform a Bluetooth connection and a Wi-Fi connection, establish a transmission channel, and receive audio data through the transmission channel.
  • the antenna of the second electronic device 200 is coupled with the wireless communication module 260, so that the second electronic device 200 can communicate with the network and other devices through wireless communication technology.
  • Wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA) , Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc.
  • GNSS may include Global Positioning Satellite System (GPS), Global Navigation Satellite System (GLONASS), Beidou Satellite Navigation System (BDS), Quasi-Zenith Satellite System (QZSS) and/or Satellite Based Augmentation System (SBAS).
  • GPS Global Positioning Satellite System
  • GLONASS Global Navigation Satellite System
  • BDS Beidou Satellite Navigation System
  • QZSS Quasi-Zenith Satellite System
  • SBAS Satellite Based Augmentation System
  • the power module 280 can be used to supply power to various components included in the second electronic device 200 .
  • the power module 280 may be a battery, such as a rechargeable battery.
  • the first electronic device and the second electronic device can initiate the establishment of a Bluetooth channel and a Wi-Fi channel through NFC through "touching".
  • the establishment of the Bluetooth channel takes a short time and is completed first; the establishment of the Wi-Fi channel takes a long time, and then the establishment is completed.
  • the Bluetooth channel is established first, the first electronic device starts to project audio, and the audio data is released to the second electronic device through the Bluetooth channel.
  • the second electronic device plays the audio data received through the Bluetooth channel.
  • the Wi-Fi channel is subsequently established, and the first electronic device also transmits audio data through the Wi-Fi channel.
  • the establishment of the Bluetooth channel and the establishment of the Wi-Fi channel are independent of each other and are performed synchronously.
  • the first electronic device transmits audio data in parallel and independently of each other through the Bluetooth channel and the Wi-Fi channel.
  • the second electronic device receives audio data through the Bluetooth channel and the Wi-Fi channel, respectively.
  • the audio data received by the second electronic device through the Bluetooth channel is referred to as Bluetooth audio
  • the audio data received through the Wi-Fi channel is referred to as Wi-Fi audio.
  • the first electronic device stops transmitting audio through the Bluetooth channel data.
  • the first electronic device only delivers audio data through the Wi-Fi channel.
  • the first electronic device stops transmitting audio data through the Bluetooth channel, and only delivers audio data through the Wi-Fi channel. That is to say, the sound projection method provided by the embodiment of the present application may not include the process shown in (b) of FIG. 6 .
  • the first electronic device delivers audio data through the Wi-Fi channel, and does not stop transmitting audio data through the Bluetooth channel. That is to say, the sound projection method provided by the embodiment of the present application may not include the process shown in (c) of FIG. 6 .
  • the audio data played by the second electronic device is switched.
  • the second electronic device stops playing the audio data received from the Bluetooth channel, and instead plays the audio data received from the Wi-Fi channel.
  • the establishment of the Bluetooth channel takes a short time, and after the Bluetooth channel is successfully established, sound is projected through the Bluetooth channel, which can make the sound projection delay smaller.
  • the high-quality audio will be resampled and the resampling rate is low during the process of delivering high-quality audio to the smart speaker through the Bluetooth channel, and some data will be lost, thereby reducing the audio quality, resulting in a lower audio effect played by the smart speaker. Difference.
  • the Wi-Fi channel After the Wi-Fi channel is established, it will stop projecting sound through the Bluetooth channel, and switch to projecting sound through the Wi-Fi channel.
  • the smart speaker plays the original audio or audio that is closer to the original audio, which can ensure better playback of the high-quality audio. Effect.
  • the establishment of the Bluetooth channel takes a short time to ensure low latency of audio delivery; in a short time before the Wi-Fi channel is successfully established, the smart speaker has a poor effect of playing audio; but soon Wi-Fi - The Fi channel is successfully established. After the smart speaker plays Wi-Fi audio, it can ensure a better playback effect of high-quality audio; taking into account both low-latency and high-quality audio, it provides users with a better sound projection playback experience.
  • FIGS. 7A-7C show a specific implementation of the sound projection method provided by the embodiment of the present application.
  • the mobile phone 100 includes a first Bluetooth module 710, a first Wi-Fi module 720, and the like.
  • the smart speaker 200 includes a second Bluetooth module 730, a second Wi-Fi module 740, a Bluetooth cache 760, a Wi-Fi cache 770, and the like.
  • An audio player 750 runs on the smart speaker 200 .
  • the mobile phone 100 and the smart speaker 200 can discover each other through NFC through "touch"; the second Bluetooth module 730 of the smart speaker 200 establishes a Bluetooth connection with the first Bluetooth module 710 of the mobile phone 100 and establishes a Bluetooth channel.
  • the second Wi-Fi module 740 of the smart speaker 200 establishes a Wi-Fi connection with the first Wi-Fi module 720 of the mobile phone 100 and establishes a Wi-Fi channel.
  • the mobile phone 100 transmits audio data to the smart speaker 200 through the Bluetooth channel, and the smart speaker 200 resamples the received audio data and saves it to the Bluetooth cache 760 .
  • the audio player 750 acquires audio data from the Bluetooth cache 760 for playback.
  • the Wi-Fi channel is quickly established successfully.
  • the mobile phone 100 transmits audio data to the smart speaker 200 through the Bluetooth channel and the Wi-Fi channel, respectively.
  • the smart speaker 200 resamples the audio data received from the Bluetooth channel (with a lower resampling rate), and saves the resampled audio data to the Bluetooth cache 760 .
  • the smart speaker 200 does not perform over-sampling on the audio data received from the Wi-Fi channel, or performs resampling but with a high resampling rate, and saves it to the Wi-Fi cache 770 .
  • the smart speaker 200 After the smart speaker 200 determines that a preset condition is met (for example, Wi-Fi audio for 40 milliseconds (ms) is stored in the Wi-Fi cache 770 ), it notifies the mobile phone 100 to stop transmitting audio data through the Bluetooth channel. As shown in FIG. 7C , the mobile phone 100 stops transmitting audio data through the Bluetooth channel, and the audio data is only transmitted through the Wi-Fi channel. The smart speaker 200 switches the played audio data from Bluetooth audio to Wi-Fi audio.
  • a preset condition for example, Wi-Fi audio for 40 milliseconds (ms) is stored in the Wi-Fi cache 770 .
  • the sound projection method provided by the embodiment of the present application will be described in detail by taking the first electronic device as a mobile phone and the second electronic device as a smart speaker as an example.
  • the sound projection method provided by the embodiment of the present application includes:
  • both cell phones and smart speakers support NFC.
  • the phone and the smart speaker touch, and the two discover each other through NFC.
  • the Bluetooth and Wi-Fi switches of the phone and smart speaker were turned on respectively before the phone and smart speaker touched each other.
  • the phone and the smart speaker touch each other, discover each other via NFC, and turn on their respective Bluetooth and Wi-Fi switches.
  • the user confirms whether to activate the one-touch sound projection.
  • the user touches the speaker 200 using the mobile phone 100 .
  • the one-touch sound projection connection window 902 pops up on the desktop 901 of the mobile phone 100, and the one-touch sound projection connection window 902 includes prompt information: "click to connect, Bluetooth and WLAN will be automatically turned on for sound projection", and the prompt information is used to prompt the user to confirm the operation. Tone.
  • the one-touch casting connection window 902 also includes a "Cancel" button 903 and a "Connect” button 904 .
  • the user can click the "Cancel” button 903 to confirm not to perform sound projection, and the user can also click the "Connect” button 904 to confirm the sound projection.
  • the mobile phone receives the user's confirmation of the voice casting operation, starts the one-touch voice casting, and executes the next steps. For example, in response to the user's click operation on the "connect” button 904, the mobile phone and the smart speaker activate one-touch sound projection.
  • the mobile phone starts the Wi-Fi hotspot.
  • the Wi-Fi module of the mobile phone turns on the wireless access point (access point, AP) mode, that is, starts the Wi-Fi hotspot.
  • the smart speaker can access the Wi-Fi hotspot of the mobile phone and establish a Wi-Fi connection with the mobile phone.
  • the establishment of a Wi-Fi connection between the smart speaker and the mobile phone is based on WLAN, and the smart speaker is connected to the network provided by the mobile phone.
  • the mobile phone sends Wi-Fi hotspot information and Bluetooth connection information to the smart speaker.
  • Wi-Fi hotspot information is used to establish a Wi-Fi connection between the smart speaker and the mobile phone.
  • the Wi-Fi hotspot information includes at least one of a service set identifier (SSID), a password, a channel identifier, an encryption method, and the like.
  • the Bluetooth connection information is used to establish a Bluetooth connection between the smart speaker and the mobile phone.
  • the Bluetooth connection information includes a media access control (media access control, MAC) address of the mobile phone, and the like.
  • the embodiment of the present application does not limit the execution order of S802 and S803.
  • the mobile phone starts the Wi-Fi hotspot first, and then sends the Wi-Fi hotspot information and Bluetooth connection information to the smart speaker respectively.
  • the mobile phone first sends the Bluetooth connection information to the smart speaker, then activates the Wi-Fi hotspot and sends the Wi-Fi hotspot information to the smart speaker.
  • the mobile phone first starts the Wi-Fi hotspot, then sends the Bluetooth connection information to the smart speaker, and then sends the Wi-Fi hotspot information to the smart speaker. This embodiment of the present application does not limit this.
  • the smart speaker establishes a Bluetooth channel with the mobile phone.
  • the smart speaker after receiving the Wi-Fi hotspot information and the Bluetooth connection information, saves the Wi-Fi hotspot information and the Bluetooth connection information in the NFC module of the smart speaker.
  • the smart speaker can read the saved Wi-Fi hotspot information and Bluetooth connection information from the NFC module.
  • the smart speaker sends a Bluetooth connection request to the mobile phone according to the Bluetooth connection information; the Bluetooth connection request is used to request the establishment of a Bluetooth connection.
  • the smart speaker obtains a MAC address according to the Bluetooth connection information, sends a Bluetooth connection request to the mobile phone corresponding to the MAC address, and requests to establish a Bluetooth connection with the mobile phone.
  • the smart speaker sends a Wi-Fi connection request to the mobile phone according to the Wi-Fi hotspot information; the Wi-Fi connection request is used to request the establishment of a Wi-Fi connection.
  • the Wi-Fi connection request includes at least one of an SSID, a password, a channel identifier, an encryption method, and the like.
  • the mobile phone After the mobile phone receives the Bluetooth connection request, it returns a Bluetooth connection response to the smart speaker.
  • the smart speaker receives a Bluetooth connection response, and the mobile phone and the smart speaker successfully establish a Bluetooth connection.
  • the Bluetooth connection is a Bluetooth low energy (BLE) connection.
  • the Bluetooth channels include a Bluetooth control channel and a Bluetooth data channel.
  • the Bluetooth control channel is used to transmit control signaling; the Bluetooth data channel is used to transmit Bluetooth data.
  • the mobile phone After the mobile phone receives the Wi-Fi connection request, it verifies the information such as the SSID, password, channel identifier, and encryption method in the Wi-Fi connection request. If the verification is passed, the mobile phone returns a Wi-Fi connection response to the smart speaker.
  • the smart speaker receives a Wi-Fi connection response, and the phone and the smart speaker successfully establish a Wi-Fi connection.
  • the Wi-Fi connection is a Wi-Fi peer-to-peer (P2P) connection.
  • the Wi-Fi connection is a wireless access point (access point, AP) plus station (station, STA) mode connection.
  • a Wi-Fi channel is a data transmission channel of KCP (Reliable Transport Layer Automatic Repeat Request Protocol) or a signaling transmission channel of Transmission Control Protocol (TCP) established based on network connection.
  • KCP Reliable Transport Layer Automatic Repeat Request Protocol
  • TCP Transmission Control Protocol
  • S804 and S805 are performed synchronously and independently of each other.
  • the establishment of a Bluetooth channel takes less time. For example, it takes about 1 second (s) from the time when the Bluetooth connection is started to be established to the successful establishment of the Bluetooth channel.
  • Wi-Fi In the process of establishing a Wi-Fi connection, it is necessary to perform Wi-Fi channel scanning, wireless network connection, dynamic host configuration protocol (DHCP) allocation of network protocol addresses, and the establishment of a Wi-Fi connection between the mobile phone and the smart speaker.
  • TCP connection channels, etc. lead to a long time. For example, it takes more than 3 seconds (s) from starting the Wi-Fi connection to the establishment of the Wi-Fi channel.
  • the mobile phone sends audio data to the smart speaker through the Bluetooth channel.
  • the Bluetooth transmission protocol is advanced audio coding (advanced audio coding, AAC) or LDAC or the like. Based on the Bluetooth transmission protocol, high-quality audio in formats such as Hi-Res or DSD will be resampled during Bluetooth transmission.
  • AAC advanced audio coding
  • the Bluetooth transmission protocol is AAC
  • the sampling rate of the Bluetooth audio received by the smart speaker is 44.1KHz
  • the bit depth is 16bit.
  • the Bluetooth transmission protocol is LDAC
  • the sampling rate of the Bluetooth audio received by the smart speaker is 96KHz
  • the bit depth is 24bit.
  • the mobile phone resamples the audio data (for example, using the AAC protocol for transmission, the sampling rate is 44.1KHz, and the bit depth is 16bit), A presentation time stamp (PTS) is added to the data header of each packet of audio data of the sampled audio data, and the PTS is used to indicate the playing time of the packet of audio data.
  • PTS presentation time stamp
  • the audio data of every 10 milliseconds (ms) is resampled as an audio data packet, and PTS is added to the data header of the audio data of the packet.
  • the smart speaker can play the audio data of the package at the time indicated by the PTS according to the PTS of the audio data package.
  • the mobile phone resamples the audio data as one data packet every 10ms of audio.
  • the mobile phone determines to send audio data through the Bluetooth channel, obtain the current system time T 1 (for example, the unit is accurate to milliseconds); package (T 1 +t) as the PTS of the first audio data packet (audio of 0ms to 10ms) to The header of the first audio packet.
  • t> 0; t (for example, in milliseconds) is a preset value, which is determined according to the delay in sending audio data from the mobile phone to the smart speaker.
  • the mobile phone packs (T 1 +t+(w-1)*10ms) as the PTS of the wth audio data packet into the data header of the wth audio data packet.
  • the smart speaker saves the received Bluetooth audio and plays the Bluetooth audio.
  • the smart speaker receives the Bluetooth audio, and plays the corresponding audio data packet at the time indicated by the PTS in each Bluetooth audio data packet.
  • the smart speaker supports audio data with a first sampling rate and a first depth.
  • the smart speaker receives the Bluetooth audio, parses the Bluetooth audio, and obtains each Bluetooth audio data packet.
  • the smart speaker also resamples the audio data received from the Bluetooth channel to PCM audio data with a sampling rate of 96KHz and a bit depth of 32bit; saves the Bluetooth audio data in PCM format.
  • the format in which the audio data is saved may be:
  • PcmInfo represents an audio data packet
  • index is the serial number of the audio data packet
  • pts is the value of the display timestamp PTS of the audio data packet
  • pcmData is used to store audio data
  • 7680 represents the length of the audio data stored in pcmData (ie Audio Packet Length)
  • the maximum value is 7680.
  • the length of the audio data packet is related to the first sampling rate and the first bit depth supported by the smart speaker.
  • the maximum value of 7680 corresponds to the resampling of the 10ms audio data packet at the first sampling rate (96KHz) and the first bit depth (32bit). Understandably, the first sampling rate and/or the first bit depth supported by the smart speaker is different, and the maximum length of the audio data packet is also different.
  • the mobile phone sends audio data to the smart speaker through the Wi-Fi channel.
  • the Wi-Fi channel establishment delay is long, but the audio data is transmitted through the Wi-Fi channel without resampling, which will not reduce the audio quality; or, although resampling is performed, the resampling rate is high, which has a greater impact on the audio quality. Small.
  • the mobile phone After the Wi-Fi channel is successfully established, the mobile phone also sends audio data to the smart speaker through the Wi-Fi channel. In this way, the audio data is sent to the smart speaker through the Wi-Fi channel and the Bluetooth channel respectively.
  • the Wi-Fi channel when the Wi-Fi channel is successfully established, the mobile phone has transmitted n audio data packets to the smart speaker through the Bluetooth channel, starting from the (n+1)th audio data packet, also through the Wi-Fi channel to send.
  • the mobile phone transmits audio data through the Wi-Fi channel
  • PTS is added to the data header of each packet of audio data.
  • the audio data of every 10ms is regarded as an audio data packet
  • PTS is added to the audio data header of the audio data of the packet.
  • the smart speaker can play the audio data of the package at the time indicated by the PTS according to the PTS of the audio data package.
  • the mobile phone determines to transmit audio data through the Wi-Fi channel, it obtains the current system time T 1 (for example, the unit is accurate to milliseconds); the audio data to be sent through the Wi-Fi channel is regarded as a data packet every 10ms of audio frequency.
  • the PTS added during the transmission through the Wi-Fi channel is the same as the PTS added during the transmission through the Bluetooth channel.
  • the smart speaker After the smart speaker receives audio data from the Wi-Fi channel, it saves the Wi-Fi audio data in the smart speaker.
  • the smart speaker supports audio data with a first sampling rate and a first depth. Taking the PCM format audio data with the first sampling rate of 96KHz and the first depth of 32bit supported by the smart speaker as an example, the smart speaker receives the Wi-Fi audio, parses the Wi-Fi audio, and obtains each Wi-Fi audio data packet. The smart speaker also resamples the audio data received from the Wi-Fi channel to PCM audio data with a sampling rate of 96KHz and a bit depth of 32bit; Wi-Fi audio is saved in PCM format.
  • the smart speaker resamples the audio data (Bluetooth audio or Wi-Fi audio) in a PCM format with a sampling rate of 96 KHz and a bit depth of 32 bits. Understandably, smart speakers can also resample audio data in other formats. For example, resampling at a higher sampling rate and bit depth to ensure high audio quality.
  • the smart speaker resamples the Wi-Fi audio and the Bluetooth audio respectively at the same sampling rate and the same bit depth; saves the Wi-Fi audio and the Bluetooth audio in the same format. It is convenient to switch the played audio from the Bluetooth audio to the Wi-Fi audio, according to the parameters in the PCM format audio data packet, to determine the corresponding relationship between the Bluetooth audio data packet and the Wi-Fi audio data packet.
  • the mobile phone stops transmitting audio data through the Bluetooth channel.
  • the smart speaker instructs the mobile phone to stop transmitting audio data through the Bluetooth channel.
  • the smart speaker sends a second message to the mobile phone, where the second message is used to notify the mobile phone to stop transmitting audio data through the Bluetooth channel.
  • the smart speaker determines that audio data is received from the Wi-Fi channel, and sends a second message to the mobile phone; and, for example, the smart speaker caches the Wi-Fi audio for a preset duration (for example, 40 milliseconds (ms)). to send a second message to the phone.
  • a preset duration for example, 40 milliseconds (ms)
  • the smart speaker notifies the mobile phone to stop transmitting audio data through the Bluetooth channel, or the mobile phone notifies the smart speaker to switch the playing audio from Bluetooth audio to Wi-Fi audio, which will cause a delay.
  • the smart speaker caches the preset of Wi-Fi audio. The duration is longer than the message interaction delay, which can ensure the smoothness of playing audio.
  • the mobile phone receives the second message and stops transmitting audio data through the Bluetooth channel.
  • the second message includes indication information, where the indication information is used to indicate the moment to stop transmitting audio data through the Bluetooth channel.
  • the mobile phone receives the second message, obtains the indication information, and stops transmitting audio data through the Bluetooth channel at the moment indicated by the indication information.
  • the mobile phone stops transmitting audio data through the Bluetooth channel according to the second message sent by the smart speaker, which can avoid stopping the transmission of audio data through the Bluetooth channel before switching the source of the played audio data to the audio received through the Wi-Fi channel. Playback freezes caused by transferring audio data.
  • the mobile phone determines that the Wi-Fi channel is successfully established, that is, starts to transmit audio data through the Wi-Fi channel, and stops transmitting audio data through the Bluetooth channel.
  • the smart speaker ensures the smoothness of audio switching, and the implementation on the mobile phone side is simple.
  • the smart speaker switches the played audio from Bluetooth audio to Wi-Fi audio.
  • the smart speaker determines to switch the played audio data to Wi-Fi audio.
  • the smart speaker determines that audio data is received from the Wi-Fi channel, and then determines to switch the played audio data to Wi-Fi audio.
  • the smart speaker determines to cache Wi-Fi audio for a preset duration (for example, 40 milliseconds (ms)), it determines to switch the played audio data to Wi-Fi audio.
  • the mobile phone determines that the smart speaker switches the played audio data to Wi-Fi audio.
  • the mobile phone determines that the Wi-Fi channel is successfully established, it is determined that the smart speaker switches the played audio data to Wi-Fi audio; for another example, the mobile phone receives an instruction message from the smart speaker to stop transmitting audio data through the Bluetooth channel. After (the second message), a first message is sent to the smart speaker to notify the smart speaker to switch the played audio data to Wi-Fi audio. The smart speaker receives the first message and determines to switch the played audio data to Wi-Fi audio.
  • the smart speaker switches the played audio data to Wi-Fi audio at the first moment.
  • the smart speaker determines to switch the played audio data to Wi-Fi audio (for example, when the first message is received; for another example, when it is determined that the Wi-Fi audio with a preset duration is cached)
  • obtain The currently playing Bluetooth audio data packet the PTS (first PTS) of the next Bluetooth audio data packet of the currently playing Bluetooth audio data packet is the first moment.
  • the smart speaker determines the corresponding first Wi-Fi audio data packet according to the first PTS value in the saved Wi-Fi audio data packet.
  • the smart speaker starts playing the first Wi-Fi audio data packet at the first moment, and stops playing the Bluetooth audio data packet.
  • the smart speaker resamples the received Bluetooth audio and Wi-Fi audio into audio data in the same format (such as PCM format), it is possible to determine the corresponding Wi-Fi audio according to the PTS value in the Bluetooth audio data packet.
  • Data packet guarantees seamless switching of played audio data.
  • the smart speaker receives the first message and determines to switch the played audio data to Wi-Fi audio.
  • the smart speaker obtains the currently playing Bluetooth audio data package.
  • the smart speaker searches the Bluetooth cache for the currently playing Bluetooth audio data package according to the current system time. For example, the current system time is 1619686174998 (in milliseconds), and the index of the Bluetooth audio data packet is determined to be 4 according to the PTS value of the Bluetooth audio data packet.
  • the smart speaker obtains the PTS value of the Bluetooth audio data packet whose index is 5 (the next packet of the current Bluetooth audio data packet) is 1619686175008 (1619686174998+10) (unit is millisecond).
  • the smart speaker traverses the saved Wi-Fi audio data packets, and determines that the Wi-Fi audio data packet corresponding to the PTS value of 1619686175008 is the index value of 3 (understandably, the index in the Bluetooth audio data packet and the Wi-Fi audio data packet is value is irrelevant) Wi-Fi audio data packet, that is, the first Wi-Fi audio data packet is obtained.
  • the smart speaker stops playing Bluetooth audio at 1619686175008 (in milliseconds), it starts playing Wi-Fi audio sequentially from the Wi-Fi audio data packet with an index value of 3.
  • the embodiment of the present application does not limit the sequence of execution of S809 and S810.
  • the mobile phone may not stop transmitting audio data through the Bluetooth channel, that is, S809 is not performed.
  • the first electronic device and the second electronic device discover each other through "touching", and start to establish a Bluetooth channel and a Wi-Fi channel.
  • the establishment of the Bluetooth channel takes less time. After the Bluetooth channel is successfully established, the first electronic device starts to project sound.
  • the first electronic device transmits audio data to the second electronic device based on the rapidly established Bluetooth channel, and the second electronic device plays the audio data received from the Bluetooth channel.
  • the establishment of the Wi-Fi channel takes longer than the establishment of the Bluetooth channel.
  • the first electronic device transmits audio data through the Wi-Fi channel and the Bluetooth channel in parallel and independently of each other. After that, the second electronic device switches the played audio data to Wi-Fi audio.
  • the Bluetooth channel Since the establishment of the Bluetooth channel takes a short time, after the Bluetooth channel is successfully established, the audio is projected through the Bluetooth channel (it is understandable that high-quality audio is resampled, and the audio quality will be reduced after resampling, and the playback effect will be poor). Sound delay is low. After a period of time (for example, 3 seconds), the establishment of the Wi-Fi channel is completed, and the second electronic device switches the played audio data to Wi-Fi audio to ensure a better playback effect of high-quality audio.
  • a period of time for example, 3 seconds
  • high-quality audio can be projected in a lossy (larger loss) manner in a short period of time, and after the Wi-Fi channel is established, the audio data to be played can be switched to lossless or low-loss high-quality audio ; Taking into account low latency and high-quality audio, to provide users with a better sound projection playback experience.
  • the embodiment of the present application uses audio delivery as an example for description. It is understandable that the method provided by the embodiments of the present application is not limited to sound projection; the method of the present application may also be applicable to the first electronic device transmitting other types or formats of data (such as video data, etc.) to the second electronic device. That is, this application does not limit the type or format of the delivery data. The delivery of other data is also within the scope of this application.
  • the above-mentioned first electronic device and the second electronic device include corresponding hardware structures and/or software modules for executing each function.
  • the embodiments of the present application can be implemented in hardware or a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present application.
  • each function module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. It should be noted that, the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
  • an embodiment of the present application discloses a first electronic device 1000 , and the first electronic device may be the mobile phone in the foregoing embodiment.
  • the first electronic device 1000 includes: a processing unit 1001 , a storage unit 1002 , a communication unit 1003 and a display unit 1004 .
  • the processing unit 1001 is configured to control and manage the actions of the first electronic device 1000 .
  • the storage unit 1002 is used for storing program codes and data of the first electronic device 1000 .
  • the communication unit 1003 is used to support the communication between the first electronic device 1000 and other electronic devices.
  • the display unit 1004 is used to display the interface of the first electronic device 1000 . For example, a window for prompting the user to confirm whether to perform one-touch sound projection is displayed.
  • the unit modules in the above-mentioned first electronic device 1000 include but are not limited to the above-mentioned processing unit 1001 , storage unit 1002 , communication unit 1003 and display unit 1004 .
  • the first electronic device 1000 may further include a power supply unit and the like.
  • the power supply unit is used to supply power to the first electronic device 1000 .
  • the processing unit 1001 may be a processor or a controller, for example, a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC) ), field programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
  • the storage unit 1002 may be a memory.
  • the communication unit 1003 may be a transceiver, a transceiver circuit, or the like.
  • the display unit 1004 may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode, or an active-matrix organic light-emitting diode (active-matrix organic). light emitting diode, AMOLED) and so on.
  • the processing unit 1001 may be a processor (such as the processor 110 shown in FIG. 4 ), the storage unit 1002 may be a memory (such as the internal memory 121 shown in FIG. 4 ), and the communication unit 1003 may be referred to as a communication interface, including wireless communication module (the wireless communication module 160 shown in FIG. 4 ), the display unit 1004 is a display screen (the display screen 140 shown in FIG. 4 , the display screen 140 may be a touch screen, and a display panel and a touch panel may be integrated in the touch screen ).
  • the first electronic device 1000 provided in this embodiment of the present application may be the first electronic device 100 shown in FIG. 4 .
  • the above-mentioned processor, memory, communication interface, display screen, etc. can be connected together, for example, through a bus connection.
  • processors memories, communication interfaces, etc. can be connected together, for example, connected by a bus.
  • an embodiment of the present application discloses a second electronic device 1100 , and the second electronic device 1100 may be the smart speaker in the foregoing embodiment.
  • the second electronic device 1100 includes: a processing unit 1101 , a storage unit 1102 , a communication unit 1103 and a playback unit 1104 .
  • the processing unit 1101 is the control center of the second electronic device, and controls and manages the actions of the second electronic device 1100 .
  • the storage unit 1102 is used for saving program codes and data of the second electronic device 1100 . For example, it can be used to save Bluetooth audio and Wi-Fi audio.
  • the communication unit 1103 is used to support the communication between the second electronic device 1100 and other electronic devices.
  • the playing unit 1104 is configured to play the data buffered in the second electronic device 1100 . For example, for playing Bluetooth audio or Wi-Fi audio.
  • the unit modules in the above-mentioned second electronic device 1100 include but are not limited to the above-mentioned processing unit 1101 , storage unit 1102 , communication unit 1103 and playback unit 1104 .
  • the second electronic device 1100 may further include a power supply unit and the like. The power supply unit is used to supply power to the second electronic device 1100 .
  • the processing unit 1101 may be a processor or a controller, for example, a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC) ), field programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
  • the storage unit 1102 may be a memory.
  • the communication unit 1103 may be a transceiver, a transceiver circuit, or the like.
  • the playback unit 1104 may be a speaker.
  • the processing unit 1101 is a processor (the processor 210 shown in FIG. 5 ), the storage unit 1102 may be a memory (the internal memory 221 shown in FIG. 5 ), and the communication unit 1103 may be referred to as a communication interface, including wireless communication module (the wireless communication module 260 shown in FIG. 5 ), and the playback unit 1104 is a speaker (the speaker 230A shown in FIG. 5 ).
  • the second electronic device 1100 provided in this embodiment of the present application may be the second electronic device 200 shown in FIG. 5 .
  • the above-mentioned processors, memories, communication interfaces, speakers, etc. can be connected together, for example, through a bus.
  • Embodiments of the present application further provide a computer-readable storage medium, where computer program codes are stored in the computer-readable storage medium.
  • the processor executes the computer program codes
  • the first electronic device executes the methods in the foregoing embodiments.
  • Embodiments of the present application further provide a computer-readable storage medium, where computer program codes are stored in the computer-readable storage medium, and when the processor executes the computer program codes, the second electronic device executes the methods in the foregoing embodiments.
  • Embodiments of the present application also provide a computer program product, which when the computer program product runs on a computer, causes the computer to execute the method in the above-mentioned embodiments.
  • the delivery device 1000, the second electronic device 1100, the computer-readable storage medium, and the computer program product provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved may be as follows: With reference to the beneficial effects in the corresponding methods provided above, details are not repeated here.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be Incorporation may either be integrated into another device, or some features may be omitted, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, and can also be implemented in the form of software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, which are stored in a storage medium , including several instructions to make a device (may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: a U disk, a removable hard disk, a ROM, a magnetic disk, or an optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Health & Medical Sciences (AREA)
  • Otolaryngology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Telephone Function (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请提供一种投音方法及计算机可读存储介质,涉及终端领域。在第一电子设备和第二电子设备靠近发现后,第一电子设备和第二电子设备建立蓝牙通道和Wi-Fi通道。建立蓝牙通道的耗时较短,蓝牙通道建立成功后,第一电子设备通过蓝牙通道投音。Wi-Fi通道的建立耗时较长,Wi-Fi通道建立成功后,第一电子设备通过Wi-Fi通道投音。第二电子设备将播放的音频数据切换为通过Wi-Fi通道接收的音频。在Wi-Fi通道建立成功前,通过蓝牙通道投音,保证低时延投放音频。在Wi-Fi通道建立完成后,播放从Wi-Fi通道接收的音频数据,保证了高品质音频的播放,兼顾了低时延和高品质音频,为用户提供更好的投音播放体验。

Description

一种投音方法及计算机可读存储介质
本申请要求于2021年04月30日提交国家知识产权局、申请号为202110485895.2、申请名称为“一种投音方法及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端技术领域,尤其涉及一种投音方法及计算机可读存储介质。
背景技术
投音(也称传音)能够使得第一电子设备利用第二电子设备的播放能力播放音频数据,从而为用户提供更好的听觉体验,得到广泛应用。一碰投音(也称一碰传音),通过第一电子设备和第二电子设备的彼此靠近(也称“碰一碰”;第一电子设备和第二电子设备可以接触,也可以不接触),发现对方,并建立短距离无线通信通道;通过该通道,传递音频数据或链接地址,第二电子设备基于该音频数据播放,或者,第二电子设备基于该链接地址获取到音频数据并播放。这样,就能给用户提供快捷方便的用户体验。在此基础上,如何进一步完善上述的投音方法,为用户提供更好的体验,成为我们的需求。
发明内容
为了解决上述的技术问题,本申请提供了一种投音方法、第一电子设备、第二电子设备及计算机可读存储介质。本申请提供的技术方案,针对音频数据从第一电子设备传输至第二电子设备上,由第二电子设备播放的情形,通过低时延和高品质音频两个角度,结合短距离无线通信方式的不同特点,尽可能地兼顾投音响应速度和投音质量,为用户提供更好的听觉体验;使得用户能够更快地听到音频数据,并且能够更早地听到高品质的音频数据。
第一方面,提供一种投音方法,应用于第二电子设备,第二电子设备与第一电子设备组成投音系统。该方法包括:响应于第一电子设备和第二电子设备碰一碰,第二电子设备通过近场通信NFC发现第一电子设备;响应于第一电子设备与第二电子设备之间的第一传输通道建立成功,第二电子设备通过第一传输通道接收音频数据;第二电子设备播放第一音频,第一音频为第二电子设备通过第一传输通道接收的音频数据;响应于第一电子设备与第二电子设备之间的第二传输通道建立成功,第二电子设备通过第二传输通道接收音频数据;第二电子设备将播放的音频数据从第一音频切换为第二音频,第二音频为第二电子设备通过第二传输通道接收的音频数据。
这样,第一传输通道建立成功后即通过第一传输通道进行投音,可以使得投音时延较小;第二传输通道建立完成后,即停止通过第一传输通道投音,转而通过第二传输通道投音,可以保证高品质音频较好的播放效果。根据第一传输通道建立时延小的特点,保证低时延投放音频;在第二传输通道建立成功之前短暂的时间内,智能音箱播放音频的效果较差;第二传输通道建立成功,智能音箱播放第二音频之后,即可以 保证高品质音频较好的播放效果;兼顾了低时延和高品质音频,为用户提供更好的投音播放体验。
根据第一方面,在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,该方法还包括:第二电子设备确定满足设定条件。在一种实现方式中,设定条件包括第二电子设备缓存了预设时长的第二音频;在另一种实现方式中,设定条件包括第二电子设备从第二传输通道接收到音频数据。
根据第一方面,或者以上第一方面的任意一种实现方式,在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,该方法还包括:第二电子设备从第一电子设备接收第一消息,第一消息用于指示第二电子设备将播放的音频数据从第一音频切换为第二音频。这样,第一电子设备触发第二电子设备将播放的音频数据从第一音频切换为第二音频。在一种实现方式中,第一电子设备确定第二传输通道建立成功,则确定第二电子设备将播放的音频数据从第一音频切换为第二音频。在另一种实现方式中,第一电子设备从第二电子设备接收到停止通过第一传输通道传输音频数据的指示消息(第二消息),则确定第二电子设备将播放的音频数据从第一音频切换为第二音频。
根据第一方面,或者以上第一方面的任意一种实现方式,该方法还包括:第二电子设备根据当前播放的第一音频的第一音频数据包确定第一显示时间戳PTS,根据第一PTS确定第二音频的第二音频数据包;第二电子设备在第一PTS指示的时刻停止播放第一音频,开始播放第二音频的第二音频数据包。由于第一电子设备在发送音频数据时,对第一音频数据包和第二音频数据包打了相同的PTS。这样,根据第一音频数据包的PTS获取对应的第二音频数据包,可以实现音频数据流畅切换。
根据第一方面,或者以上第一方面的任意一种实现方式,第二电子设备根据当前播放的第一音频确定第一显示时间戳PTS包括:第二电子设备将当前播放的第一音频数据包的下一个音频数据包的PTS值确定为第一PTS。
根据第一方面,或者以上第一方面的任意一种实现方式,该方法还包括:第二电子设备以第一采样率和第一位深度对接收的第一音频进行重采样;第二电子设备以第一采样率和第一位深度对接收的第二音频进行重采样。采用相同的采样率和相同的位深度对接收的第一音频和接收的第二音频进行重采样,可以使得第一音频数据包和第二音频数据包保存为相同的格式,这样,可以实现根据第一音频数据包中的PTS值获取到对应的第二音频数据包;保证播放的音频数据无缝切换。
根据第一方面,或者以上第一方面的任意一种实现方式,该方法还包括:第二电子设备向第一电子设备发送第二消息,第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。在该方法中,第一电子设备停止通过第一传输通道传输音频数据。这样,可以避免传输冗余数据,提高处理效率,节约功耗。由第二电子设备通知第一电子设备停止通过第一传输通道传输音频数据,可以避免在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,停止通过第一传输通道传输音频数据导致的播放卡顿。
根据第一方面,或者以上第一方面的任意一种实现方式,该方法还包括:第二消息包括指示信息,指示信息用于指示第一电子设备停止通过第一传输通道传输音频数 据的时刻。
根据第一方面,或者以上第一方面的任意一种实现方式,第一传输通道为蓝牙通道,第二传输通道为无线保真Wi-Fi通道。
第二方面,提供一种第二电子设备。第二电子设备包括:处理器;存储器;以及计算机程序,其中计算机程序存储在存储器上,当计算机程序被处理器执行时,使得第二电子设备执行以下步骤:响应于第一电子设备和第二电子设备碰一碰,第二电子设备通过近场通信NFC发现第一电子设备;响应于第一电子设备与第二电子设备之间的第一传输通道建立成功,第二电子设备通过第一传输通道接收音频数据;第二电子设备播放第一音频,第一音频为第二电子设备通过第一传输通道接收的音频数据;响应于第一电子设备与第二电子设备之间的第二传输通道建立成功,第二电子设备通过第二传输通道接收音频数据;第二电子设备将播放的音频数据从第一音频切换为第二音频,第二音频为第二电子设备通过第二传输通道接收的音频数据。
根据第二方面,在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,第二电子设备还执行:确定满足设定条件。
根据第二方面,或者以上第二方面的任意一种实现方式,第二电子设备还执行:第二电子设备缓存了预设时长的第二音频。
根据第二方面,或者以上第二方面的任意一种实现方式,在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,第二电子设备还执行:从第一电子设备接收第一消息,第一消息用于指示第二电子设备将播放的音频数据从第一音频切换为第二音频。
根据第二方面,或者以上第二方面的任意一种实现方式,在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,第二电子设备还执行:根据当前播放的第一音频确定第一显示时间戳PTS,根第一PTS确定第二音频的第二音频数据包;在第一PTS指示的时刻停止播放第一音频,开始播放第二音频的第二音频数据包。
根据第二方面,或者以上第二方面的任意一种实现方式,第二电子设备还执行:将当前播放的第一音频数据包的下一个第一音频数据包的PTS值确定为第一PTS。
根据第二方面,或者以上第二方面的任意一种实现方式,第二电子设备还执行:以第一采样率和第一位深度对接收的第一音频进行重采样;以第一采样率和第一位深度对接收的第二音频进行重采样。
根据第二方面,或者以上第二方面的任意一种实现方式,第二电子设备还执行:向第一电子设备发送第二消息,第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。
根据第二方面,或者以上第二方面的任意一种实现方式,第二电子设备还执行:向第一电子设备发送包括指示信息的第二消息,指示信息用于指示第一电子设备停止通过第一传输通道传输音频数据的时刻。
第二方面以及第二方面中任意一种实现方式所对应的技术效果,可参见上述第一方面及第一方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第三方面,提供一种投音方法,应用于第一电子设备。该方法包括:响应于第一电子设备和第二电子设备碰一碰,第一电子设备通过近场通信NFC发现第二电子设备; 响应于第一电子设备与第二电子设备之间的第一传输通道建立成功,第一电子设备通过第一传输通道向第二电子设备传输音频数据;响应于第一电子设备与第二电子设备之间的第二传输通道建立成功,第一电子设备通过第二传输通道向第二电子设备传输音频数据。
这样,第一传输通道建立成功后即通过第一传输通道进行投音,可以使得投音时延较小;第二传输通道建立完成后,即停止通过第一传输通道投音,转而通过第二传输通道投音,可以保证高品质音频较好的播放效果。根据第一传输通道建立时延小的特点,保证低时延投放音频;通过第二传输通道传输音频,即可以保证高品质音频较好的播放效果;兼顾了低时延和高品质音频,为用户提供更好的投音播放体验。
根据第三方面,在第一电子设备通过第二传输通道向第二电子设备传输音频数据之后,该方法还包括:第一电子设备向第二电子设备发送第一消息,第一消息用于指示第二电子设备将播放的音频数据从第一音频切换为第二音频。这样,第一电子设备触发第二电子设备将播放的音频数据从第一音频切换为第二音频。在一种实现方式中,第一电子设备确定第二传输通道建立成功,则确定第二电子设备将播放的音频数据从第一音频切换为第二音频。在另一种实现方式中,第一电子设备从第二电子设备接收到停止通过第一传输通道传输音频数据的指示消息(第二消息),则确定第二电子设备将播放的音频数据从第一音频切换为第二音频。
根据第三方面,或者以上第三方面的任意一种实现方式,该方法还包括:第一电子设备停止通过第一传输通道传输音频数据。这样,可以避免传输冗余数据,提高处理效率,节约功耗。第一电子设备停止通过第一传输通道传输音频数据,可以避免在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,停止通过第一传输通道传输音频数据导致的播放卡顿。
根据第三方面,或者以上第三方面的任意一种实现方式,在第一电子设备停止通过第一传输通道传输音频数据之前,该方法还包括:第一电子设备从第二电子设备接收第二消息,第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。由第二电子设备通知第一电子设备停止通过第一传输通道传输音频数据,可以避免在第二电子设备将播放的音频数据从第一音频切换为第二音频之前,停止通过第一传输通道传输音频数据导致的播放卡顿
根据第三方面,或者以上第三方面的任意一种实现方式,该方法还包括:第二消息包括指示信息,指示信息用于指示第一电子设备停止通过第一传输通道传输音频数据的时刻。第一电子设备停止通过第一传输通道传输音频数据包括:第一电子设备在指示信息指示的时刻停止通过第一传输通道传输音频数据。
根据第三方面,或者以上第三方面的任意一种实现方式,第一传输通道为蓝牙通道,第二传输通道为无线保真Wi-Fi通道。
第四方面,提供一种第一电子设备。第一电子设备包括:处理器;存储器;以及计算机程序,计算机程序存储在存储器上,当计算机程序被处理器执行时,使得第一电子设备执行以下步骤:响应于第一电子设备和第二电子设备碰一碰,第一电子设备通过近场通信NFC发现第二电子设备;响应于第一电子设备与第二电子设备之间的第一传输通道建立成功,第一电子设备通过第一传输通道向第二电子设备传输音频数据; 响应于第一电子设备与第二电子设备之间的第二传输通道建立成功,第一电子设备通过第二传输通道向第二电子设备传输音频数据。
根据第四方面,通过第二传输通道向第二电子设备传输音频数据之后,第一电子设备还执行:向第二电子设备发送第一消息,第一消息用于指示第二电子设备将播放的音频数据从第一音频切换为第二音频。
根据第四方面,或者以上第四方面的任意一种实现方式,第一电子设备还执行:停止通过第一传输通道传输音频数据。
根据第四方面,或者以上第四方面的任意一种实现方式,在第一电子设备停止通过第一传输通道传输音频数据之前,第一电子设备还执行:从第二电子设备接收第二消息,第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。
根据第四方面,或者以上第四方面的任意一种实现方式,第一电子设备还执行:从第二电子设备接收包括指示信息的第二消息,指示信息用于指示第一电子设备停止通过第一传输通道传输音频数据的时刻。第一电子设备停止通过第一传输通道传输音频数据包括:第一电子设备在指示信息指示的时刻停止通过第一传输通道传输音频数据。
第四方面以及第四方面中任意一种实现方式所对应的技术效果,可参见上述第三方面及第三方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第五方面,提供一种计算机可读存储介质。计算机可读存储介质存储有计算机程序(也可称为指令或代码),当该计算机程序被第二电子设备执行时,使得第二电子设备执行第一方面或第一方面中任意一种实施方式的方法。
第五方面以及第五方面中任意一种实现方式所对应的技术效果,可参见上述第一方面及第一方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第六方面,提供一种计算机可读存储介质。计算机可读存储介质存储有计算机程序(也可称为指令或代码),当该计算机程序被第一电子设备执行时,使得第一电子设备执行第三方面或第三方面中任意一种实施方式的方法。
第六方面以及第六方面中任意一种实现方式所对应的技术效果,可参见上述第三方面及第三方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第七方面,提供一种计算机程序产品。当计算机程序产品在第二电子设备上运行时,使得第二电子设备执行第一方面或第一方面中任意一种实施方式的方法。
第七方面以及第七方面中任意一种实现方式所对应的技术效果,可参见上述第一方面及第一方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第八方面,提供一种计算机程序产品。当计算机程序产品在第一电子设备上运行时,使得第一电子设备执行第三方面或第三方面中任意一种实施方式的方法。
第八方面以及第八方面中任意一种实现方式所对应的技术效果,可参见上述第三方面及第三方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第九方面,提供一种电路系统。电路系统包括处理电路,处理电路被配置为执行第一方面或第一方面中任意一种实施方式的方法。
第九方面以及第九方面中任意一种实现方式所对应的技术效果,可参见上述第一方面及第一方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第十方面,提供一种电路系统。电路系统包括处理电路,处理电路被配置为执行第三方面或第三方面中任意一种实施方式的方法。
第十方面以及第十方面中任意一种实现方式所对应的技术效果,可参见上述第三方面及第三方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第十一方面,提供一种芯片系统。芯片系统包括处理器和接口电路。接口电路用于执行收发功能,并将指令发送给处理器。当指令被处理器执行时,使得处理器执行第一方面或第一方面中任意一种实施方式的方法。
第十一方面以及第十一方面中任意一种实现方式所对应的技术效果,可参见上述第一方面及第一方面中任意一种实现方式所对应的技术效果,此处不再赘述。
第十二方面,提供一种芯片系统。芯片系统包括处理器和接口电路。接口电路用于执行收发功能,并将指令发送给处理器。当指令被处理器执行时,使得处理器执行第三方面或第三方面中任意一种实施方式的方法。
第十二方面以及第十二方面中任意一种实现方式所对应的技术效果,可参见上述第三方面及第三方面中任意一种实现方式所对应的技术效果,此处不再赘述。
附图说明
图1为提供的一种投音方法的场景示意图;
图2A为提供的通过第一种方式的投音方法的用户操作及提示的示意图;
图2B为提供的通过第二种方式的投音方法的用户操作及提示的示意图;
图3为本申请实施例提供的投音方法所涉及的第一电子设备与第二电子设备之间通信方式的示意图;
图4为本申请实施例提供的第一电子设备的硬件结构示意图;
图5为本申请实施例提供的第二电子设备的硬件结构示意图;
图6为本申请实施例提供的投音方法的原理示意图;
图7A-图7C为本申请实施例提供的投音方法的原理示意图;
图8为本申请实施例提供的投音方法的流程示意图;
图9A为本申请实施例提供的投音方法的用户操作及提示的示意图;
图9B为本申请实施例提供的投音方法中两种音频数据包对应关系示意图;
图10为本申请实施例提供的一种第一电子设备的结构示意图;
图11为本申请实施例提供的一种第二电子设备的结构示意图。
具体实施方式
以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请以下各实施例中,“至少一个”、“一个或多个”是指一个或两个以上(包含两个)。术语“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的 一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。术语“连接”包括直接连接和间接连接,除非另外说明。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。
一碰投音(也称一碰传音),通过第一电子设备和第二电子设备的彼此靠近(也称“碰一碰”;第一电子设备和第二电子设备可以接触,也可以不接触),发现对方,并建立短距离无线通信通道;通过该通道,传递音频数据或链接地址,第二电子设备基于该音频数据播放,或者,第二电子设备基于该链接地址获取到音频数据并播放。需要说明的是,本申请中第一电子设备和第二电子设备的“碰一碰”是指第一电子设备和第二电子设备靠近,第一电子设备和第二电子设备之间的距离小于一定距离,使得第一电子设备和第二电子设备可以互相发现;并不限定两个设备碰到。
为了便于阐述,下面,以第一电子设备为手机,第二电子设备为智能音箱,并且以第一电子设备和第二电子设备之间的靠近发现是通过NFC实现,来进行说明。
需要说明的是,第一电子设备、第二电子设备可以为其他的电子设备。第一电子设备与第二电子设备之间的靠近发现,也可以通过其他的短距离无线通信方式或者其他的方式实现。本申请对此均不作限制。
示例性地,如图1所示,手机和智能音箱都支持NFC。手机100靠近智能音箱200,手机100与智能音箱200通过NFC互相发现,建立传输通道。该传输通道可以为蓝牙传输通道,也可以为Wi-Fi传输通道。本申请对此不作限制。手机100的音频数据通过该传输通道投放到智能音箱200,并由智能音箱200播放。
在一种实现方式中,手机100通过NFC与智能音箱200建立第一传输通道。以蓝牙通道作为第一传输通道为例,手机100通过蓝牙通道把音频数据投放到智能音箱200进行播放。如图2A所示,用户使用手机100靠近智能音箱200;响应于上述的靠近,手机100的界面101上弹出窗口102,该窗口102用于提示用户确认是否进行手机与智能音箱一碰投音。窗口102包括“取消”按钮103和“连接”按钮104。用户可以点击“取消”按钮103确认不进行手机与智能音箱一碰投音。用户也可以点击“连接”按钮104确认进行手机与智能音箱一碰投音。比如,响应于用户对“连接”按钮104的点击操作,智能音箱200与手机100建立蓝牙连接,并建立蓝牙通道。手机100的音频数据通过该蓝牙通道,投放到智能音箱200进行播放。通常,蓝牙传输协议支持传输的音频流的采样率和位深度(表示音频的动态范围)较低。比如,高级音频编码 (advanced audio coding,AAC)支持的采样率为44.1KHz,位深度为16bit。LDAC(索尼公司研发的一种无线音频编码技术,允许通过蓝牙通道以最高990kbit/s的速度传输音频)支持的采样率为96KHz,位深度为24bit。受限于蓝牙传输协议,高解析音频(high resolution audio,Hi-Res)和直接比特流数字(direct stream digital,DSD)等高品质音频通过蓝牙通道投放到智能音箱过程中会被重采样,重采样后会降低音频的品质。这样,通过蓝牙通道投音无法实现高品质音频的投放。但是,蓝牙通道建立时延小,投音响应快。
在另一种实现方式中,手机100通过NFC与智能音箱200建立第二传输通道。以无线保真(wireless fidelity,Wi-Fi)通道作为第二传输通道为例,手机100通过Wi-Fi通道把音频投放到智能音箱200进行播放。如图2B所示,用户使用手机100靠近智能音箱200;响应于手机100向智能音箱200的靠近,手机100的界面201上弹出窗口202,该窗口202用于提示用户确认是否进行手机与智能音箱一碰投音。窗口202包括“取消”按钮203和“连接”按钮204。用户可以点击“取消”按钮203确认不进行手机与智能音箱一碰投音。用户也可以点击“连接”按钮204确认进行手机与智能音箱一碰投音。比如,响应于用户对“连接”按钮204的点击操作,智能音箱200与手机100建立Wi-Fi连接,并建立Wi-Fi通道。手机100的音频数据通过该Wi-Fi通道,投放到智能音箱200进行播放。通过Wi-Fi通道投音,高品质音频可以无损传输。但是,建立Wi-Fi连接需要进行Wi-Fi信道扫描,无线网络连接,动态主机配置协议(dynamic host configuration protocol,DHCP)分配网络协议地址,以及手机与智能音箱要基于Wi-Fi网络建立传输控制协议(transmission control protocol,TCP)连接通信等步骤,耗时较长,投音时延较大。
需要说明的是,上述第一传输通道并不限定为蓝牙通道,上述第二传输通道并不限定为Wi-Fi通道。第一传输通道和第二传输通道可以为其他短距离无线通信通道。第一传输通道的建立耗时短,通过第一传输通道传输的数据会被重采样且重采样率较低,导致丢失一定数据,从而降低音频品质。第二传输通道的建立耗时长于第一传输通道的建立耗时,通过第二传输通道传输的数据不进行重采样,或重采样采样率较高,导致不丢失数据,或丢失的数据较少,从而不降低或较少降低音频品质。在本申请实施例中,以蓝牙通道作为第一传输通道,Wi-Fi通道作为第二传输通道进行示例性说明。
本申请实施例提供一种投音方法、第一电子设备、第二电子设备及计算机可读存储介质。示例性地,第一电子设备和第二电子设备通过“碰一碰”,互相发现,之后同步地、相互独立地建立蓝牙通道和Wi-Fi通道。蓝牙通道的建立耗时较短。蓝牙通道建立成功后,第一电子设备开始投音。第一电子设备基于快速建立的蓝牙通道,向第二电子设备传输音频数据。第二电子设备播放从蓝牙通道接收的音频数据。Wi-Fi通道的建立耗时比蓝牙通道的建立耗时长。Wi-Fi通道建立完成后,第一电子设备通过Wi-Fi通道与蓝牙通道,并行地向第二电子设备传输音频数据。之后,第二电子设备切换播放的音频来源,即从蓝牙通道接收的音频数据,切换为从Wi-Fi通道接收的音频数据。由于蓝牙通道的建立耗时较短,蓝牙通道建立成功后即通过蓝牙通道投音,可以使得投音的时延较小。一段时间(比如,3秒)后,Wi-Fi通道建立完成,切换为 通过Wi-Fi通道投音,保证高品质音频播放效果。这样,兼顾投音响应速度和投音质量,为用户提供更好的听觉体验;在经历低时延后,即可使得用户听到音频数据,并且一段时间后,就能使得用户听到高品质的音频数据;兼顾了低时延和高品质音频,为用户提供更好的一碰投音播放体验。
图3示出了本申请实施例提供的投音方法所适用于的一种系统架构。如图3所示,该系统包括第一电子设备100和第二电子设备200。第一电子设备100和第二电子设备200分别支持NFC功能、蓝牙功能和Wi-Fi功能。第一电子设备100和第二电子设备200通过“碰一碰”,两者互相发现,并建立蓝牙通道和Wi-Fi通道。这样,第一电子设备100可以通过蓝牙通道或Wi-Fi通道,将音频数据投放到第二电子设备200进行播放。
其中,第一电子设备100可以是支持NFC、蓝牙和Wi-Fi的电子设备,该电子设备可以包括便携式移动设备(如手机等)、手持计算机、平板电脑、笔记本电脑、上网本、个人电脑(personal computer,PC)、智能家居设备(比如,智能电视等)、个人数字助理(personal digital assistant,PDA)、可穿戴电子设备(比如,智能手表、智能手环等)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、车载电脑等。上述电子设备也可为其它便携式移动设备,诸如膝上型计算机(Laptop)等。还应当理解的是,在其他一些实施例中,上述电子设备也可以不是便携式移动设备,而是固定式设备。本申请实施例对该第一电子设备100的具体形式不做特殊限制。
上述第二电子设备200可以是支持NFC、蓝牙和Wi-Fi的电子设备,该电子设备可以包括智能家居设备(比如,智能音箱、智能灯、智能洗衣机、智能空调等)、可穿戴设备(比如,智能手表、智能手环等)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、车载电脑、便携式移动设备(如手机等)、手持计算机、平板电脑、笔记本电脑、上网本、个人电脑(personal computer,PC)等。上述电子设备也可为其它便携式移动设备,诸如膝上型计算机(Laptop)等。还应当理解的是,在其他一些实施例中,上述电子设备也可以不是便携式移动设备,而是固定式设备。本申请实施例对该第二电子设备200的具体形式不做特殊限制。
示例性地,图4示出了一种第一电子设备100的结构示意图。第一电子设备100可包括处理器110,外部存储器接口120,内部存储器121,显示屏140,移动通信模块150,无线通信模块160,SIM卡接口170,电源模块180等。
可以理解地是,本申请实施例示意的结构并不构成对第一电子设备100的具体限定。在本申请另一些实施例中,第一电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以为硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元。例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的部件,也可以集成在 一个或多个处理器中。在一些实施例中,第一电子设备100也可以包括一个或多个处理器110。
应用处理器可以运行第一电子设备100的操作系统,用于管理第一电子设备100的硬件与软件资源。比如,管理与配置内存、决定系统资源供需的优先次序、控制输入与输出设备、操作网络、管理文件系统、管理驱动程序等。操作系统也可以用于提供一个让用户与系统交互的操作界面。其中,操作系统内可以安装各类软件,比如,驱动程序,应用程序(application,App)等。处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路间(inter-integrated circuit,I2C)接口,集成电路间音频(integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,SIM卡接口,和/或USB接口等。
可以理解地是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对第一电子设备100的结构限定。在本申请另一些实施例中,第一电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展第一电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音频,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器110可以通过运行存储在内部存储器121的上述指令,从而使得第一电子设备100执行本申请一些实施例中所提供的方法,以及各种应用以及数据管理等。内部存储器121可以包括代码存储区和数据存储区。
第一电子设备100通过GPU,显示屏140,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏140和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏140用于显示图像,视频等。显示屏140包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,第一电子设备100可以包括1个或N个显示屏140,N为大于1的正整数。本申请实施例中,显示屏140可以显示用于提示用户确认是否进行一碰投音的窗口,以及接收用户在电子设备界面上的操作。
第一电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150以及无线通信模块160等实现。
移动通信模块150可以提供应用在第一电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。
无线通信模块160可以提供应用在第一电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信(near field communication,NFC),红外(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。本申请实施例中,无线通信模块160用于进行蓝牙连接、Wi-Fi连接,并建立传输通道,以及通过传输通道投放音频数据。
在一些实施例中,第一电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得第一电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
SIM卡接口170用于连接SIM卡。
电源模块180,可以用于向第一电子设备100包含的各个部件供电。在一些实施例中,该电源模块180可以是电池,如可充电电池。
示例性地,请参考图5,其示出了一种第二电子设备200的结构示意图。第二电子设备200可包括处理器210,外部存储器接口220,内部存储器221,音频模块230,扬声器230A,麦克风230B,耳机接口230C,无线通信模块260,电源模块280等。
可以理解地是,本申请实施例示意的结构并不构成对第二电子设备200的具体限定。在本申请另一些实施例中,第二电子设备200可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以为硬 件,软件或软件和硬件的组合实现。
处理器210可以包括一个或多个处理单元。例如:处理器210可以包括应用处理器(AP),调制解调处理器,图形处理器(GPU),图像信号处理器(ISP),控制器,视频编解码器,数字信号处理器(DSP),和/或神经网络处理器(NPU)等。其中,不同的处理单元可以是独立的部件,也可以集成在一个或多个处理器中。在一些实施例中,第二电子设备200也可以包括一个或多个处理器210。其中,控制器是第二电子设备200的神经中枢和指挥中心。可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
应用处理器上可以运行第二电子设备200的操作系统,用于管理第二电子设备200的硬件与软件资源。比如,管理与配置内存、决定系统资源供需的优先次序、控制输入与输出设备、操作网络、管理文件系统、管理驱动程序等。操作系统也可以用于提供一个让用户与系统交互的操作界面。其中,操作系统内可以安装各类软件,比如,驱动程序,应用程序(application,App)等。
处理器210中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器210的等待时间,因而提高了系统的效率。
在一些实施例中,处理器210可以包括一个或多个接口。接口可以包括集成电路间(I2C)接口,集成电路间音频(I2S)接口,脉冲编码调制(PCM)接口,通用异步收发传输器(UART)接口,移动产业处理器接口(MIPI),通用输入输出(GPIO)接口,SIM卡接口,和/或USB接口等。
可以理解地是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对第二电子设备200的结构限定。在本申请另一些实施例中,第二电子设备200也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
外部存储器接口220可以用于连接外部存储卡,例如Micro SD卡,实现扩展第二电子设备200的存储能力。外部存储卡通过外部存储器接口220与处理器210通信,实现数据存储功能。例如将音频,视频等文件保存在外部存储卡中。
内部存储器221可以用于存储一个或多个计算机程序,该一个或多个计算机程序包括指令。处理器210可以通过运行存储在内部存储器221的上述指令,从而使得第二电子设备200执行本申请一些实施例中所提供的方法,以及各种应用以及数据管理等。内部存储器221可以包括代码存储区和数据存储区。
第二电子设备200可以通过音频模块230,扬声器230A,麦克风230B,耳机接口230C,以及应用处理器等实现音频功能。例如音频播放,录音等。音频模块230用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块230还可以用于对音频信号编码和解码。在一些实施例中,音频模块230可以设置于处理器210中,或将音频模块230的部分功能模块设置于处理器210中。
扬声器230A,也称“喇叭”,用于将音频电信号转换为声音信号。在本申请实施例中,扬声器230A用于将接收到的音频电信号转换为声音信号输出。
麦克风230B,也称“话筒”,“传声器”,用于将声音信号转换为电信号。用户 可以通过人嘴靠近麦克风230B发声,将声音信号输入到麦克风230B。
耳机接口230C用于连接有线耳机。耳机接口230C可以是USB接口,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
第二电子设备200的无线通信功能可以通过天线和无线通信模块260实现。
无线通信模块260可以提供应用在第二电子设备200上的包括无线局域网(WLAN)(如Wi-Fi网络),蓝牙(BT),全球导航卫星系统(GNSS),调频(FM),近距离无线通信(NFC),红外(IR)等无线通信的解决方案。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线转为电磁波辐射出去。本申请实施例中,无线通信模块260用于进行蓝牙连接、Wi-Fi连接,并建立传输通道,以及通过传输通道接收音频数据。
在一些实施例中,第二电子设备200的天线和无线通信模块260耦合,使得第二电子设备200可以通过无线通信技术与网络以及其他设备通信。无线通信技术可以包括全球移动通讯系统(GSM),通用分组无线服务(GPRS),码分多址接入(CDMA),宽带码分多址(WCDMA),时分码分多址(TD-SCDMA),长期演进(LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。GNSS可以包括全球卫星定位系统(GPS),全球导航卫星系统(GLONASS),北斗卫星导航系统(BDS),准天顶卫星系统(QZSS)和/或星基增强系统(SBAS)。
电源模块280,可以用于向第二电子设备200包含的各个部件供电。在一些实施例中,该电源模块280可以是电池,如可充电电池。
在本申请实施例提供的投音方法中,第一电子设备和第二电子设备通过“碰一碰”,可以通过NFC,启动建立蓝牙通道和Wi-Fi通道。蓝牙通道的建立耗时短,率先完成;Wi-Fi通道的建立耗时长,随后建立完成。如图6的(a)所示,蓝牙通道率先建立完成,第一电子设备开始投音,通过蓝牙通道向第二电子设备投放音频数据。第二电子设备播放通过蓝牙通道接收的音频数据。Wi-Fi通道随后建立完成,第一电子设备也通过Wi-Fi通道传输音频数据。蓝牙通道的建立和Wi-Fi通道的建立相互独立,同步进行。
在一些实施例中,如图6的(b)所示,在一段时间内,第一电子设备通过蓝牙通道和Wi-Fi通道,并行地、相互独立地传输音频数据。第二电子设备通过蓝牙通道和Wi-Fi通道分别接收音频数据。在本申请实施例中,将第二电子设备通过蓝牙通道接收的音频数据称为蓝牙音频,将通过Wi-Fi通道接收的音频数据称为Wi-Fi音频。在满足设定条件后(比如,第二电子设备确定接收到Wi-Fi音频;再比如,第二电子设备缓存了预设时长的Wi-Fi音频),第一电子设备停止通过蓝牙通道传输音频数据。如图6的(c)所示,第一电子设备仅通过Wi-Fi通道进行音频数据的投放。
在另一些实施例中,Wi-Fi通道建立完成后,第一电子设备就停止通过蓝牙通道传输音频数据,仅通过Wi-Fi通道进行音频数据的投放。也就是说,本申请实施例提 供的投音方法可以不包括图6的(b)所示过程。
在另一些实施例中,Wi-Fi通道建立完成后,第一电子设备通过Wi-Fi通道进行音频数据的投放,并且不停止通过蓝牙通道传输音频数据。也就是说,本申请实施例提供的投音方法可以不包括图6的(c)所示过程。
Wi-Fi通道建立完成后,第二电子设备播放的音频数据切换。第二电子设备停止播放从蓝牙通道接收的音频数据,转而播放从Wi-Fi通道接收的音频数据。
在该方法中,蓝牙通道的建立耗时短,蓝牙通道建立成功后即通过蓝牙通道投音,可以使得投音时延较小。但是,受限于蓝牙传输协议,高品质音频通过蓝牙通道投放到智能音箱过程中会被重采样且重采样率较低,丢失一部分数据,从而降低音频的品质,导致智能音箱播放的音频效果较差。Wi-Fi通道建立完成后,即停止通过蓝牙通道投音,转而通过Wi-Fi通道投音。由于高品质音频通过Wi-Fi通道投放到智能音箱过程中没有重采样,或者重采样率较高,智能音箱播放的是原始音频或者更接近原始音频的音频,可以保证高品质音频较好的播放效果。在该方法中,利用蓝牙通道的建立耗时短的特点,保证投放音频的低时延;在Wi-Fi通道建立成功之前的短暂时间内,智能音箱播放音频的效果较差;但很快Wi-Fi通道建立成功,智能音箱播放Wi-Fi音频之后,即可以保证高品质音频较好的播放效果;兼顾了低时延和高品质音频,为用户提供更好的投音播放体验。
示例性地,图7A-图7C示出了本申请实施例提供的投音方法的一种具体实现方式。手机100包括第一蓝牙模块710,第一Wi-Fi模块720等。智能音箱200包括第二蓝牙模块730,第二Wi-Fi模块740,蓝牙缓存760和Wi-Fi缓存770等。智能音箱200上运行有音频播放器750。手机100与智能音箱200通过“碰一碰”,两者可以通过NFC互相发现;智能音箱200的第二蓝牙模块730与手机100的第一蓝牙模块710建立蓝牙连接,并建立蓝牙通道。并且,手机100与智能音箱200通过NFC互相发现后,智能音箱200的第二Wi-Fi模块740与手机100的第一Wi-Fi模块720建立Wi-Fi连接,并建立Wi-Fi通道。
如图7A所示,蓝牙通道建立成功后,手机100通过蓝牙通道向智能音箱200传输音频数据,智能音箱200对接收到的音频数据进行重采样,并保存至蓝牙缓存760。音频播放器750从蓝牙缓存760获取音频数据进行播放。
手机100通过蓝牙通道向智能音箱200传输音频数据过程中,Wi-Fi通道很快建立成功。如图7B所示,手机100通过蓝牙通道和Wi-Fi通道分别向智能音箱200传输音频数据。智能音箱200对从蓝牙通道接收的音频数据进行重采样(重采样率较低),并将重采样后的音频数据保存至蓝牙缓存760。智能音箱200对从Wi-Fi通道接收的音频数据,不进行冲采样,或者虽然进行重采样但重采样率较高,并保存至Wi-Fi缓存770。
智能音箱200确定满足预设条件(比如,Wi-Fi缓存770中保存了40毫秒(ms)的Wi-Fi音频)后,通知手机100停止通过蓝牙通道传输音频数据。如图7C所示,手机100停止通过蓝牙通道传输音频数据,音频数据仅通过Wi-Fi通道进行传输。智能音箱200将播放的音频数据从蓝牙音频切换为Wi-Fi音频。
下面结合图8,以第一电子设备为手机,第二电子设备为智能音箱为例,对本申 请实施例提供的投音方法进行详细说明。
如图8所示,本申请实施例提供的投音方法包括:
S801、手机和智能音箱通过“碰一碰”,互相发现。
示例性地,手机和智能音箱都支持NFC。手机和智能音箱碰一碰,二者通过NFC互相发现。
在一些示例中,手机和智能音箱碰一碰之前,手机与智能音箱的蓝牙和Wi-Fi开关已分别打开。在另一些示例中,手机和智能音箱碰一碰,二者通过NFC互相发现,则打开各自的蓝牙和Wi-Fi开关。
在一种实现方式中,手机和智能音箱通过NFC互相发现后,向用户确认是否启动一碰投音。示例性地,如图9A所示,用户使用手机100碰一碰音箱200。手机100的桌面901上弹出一碰投音连接窗口902,一碰投音连接窗口902包括提示信息:“点击连接,会自动开启蓝牙和WLAN进行投音”,该提示信息用于提示用户确认进行投音。一碰投音连接窗口902还包括“取消”按钮903和“连接”按钮904。用户可以点击“取消”按钮903确认不进行投音,用户也可以点击“连接”按钮904确认进行投音。手机接收到用户确认进行投音的操作,启动一碰投音,执行后续步骤。比如,响应于用户对“连接”按钮904的点击操作,手机与智能音箱启动一碰投音。
S802、手机启动Wi-Fi热点。
示例性地,手机的Wi-Fi模块开启无线访问节点(access point,AP)模式,即启动Wi-Fi热点。手机启动Wi-Fi热点,智能音箱就可以接入手机的Wi-Fi热点,与手机建立Wi-Fi连接。智能音箱与手机建立Wi-Fi连接即基于WLAN,智能音箱连接手机提供的网络。
S803、手机向智能音箱发送Wi-Fi热点信息和蓝牙连接信息。
Wi-Fi热点信息用于智能音箱与手机建立Wi-Fi连接。示例性地,Wi-Fi热点信息包括服务区标识符(service set identifier,SSID)、密码、信道标识和加密方式等中的至少一项。蓝牙连接信息用于智能音箱与手机建立蓝牙连接。示例性地,蓝牙连接信息包括手机的介质访问控制(media access control,MAC)地址等。
需要说明的是,本申请实施例并不限定S802和S803的执行顺序。比如,手机先启动Wi-Fi热点,然后分别向智能音箱发送Wi-Fi热点信息和蓝牙连接信息。再比如,手机先向智能音箱发送蓝牙连接信息,然后启动Wi-Fi热点并向智能音箱发送Wi-Fi热点信息。再比如,手机先启动Wi-Fi热点,再向智能音箱发送蓝牙连接信息,再向智能音箱发送Wi-Fi热点信息。本申请实施例对此,不进行限定。
S804、智能音箱与手机建立蓝牙通道。
S805、智能音箱与手机建立Wi-Fi通道。
在一种实现方式中,智能音箱接收到Wi-Fi热点信息和蓝牙连接信息后,将Wi-Fi热点信息和蓝牙连接信息保存在智能音箱的NFC模块。智能音箱可以从NFC模块读取保存的Wi-Fi热点信息和蓝牙连接信息。
智能音箱根据蓝牙连接信息向手机发送蓝牙连接请求;蓝牙连接请求用于请求建立蓝牙连接。比如,智能音箱根据蓝牙连接信息获取MAC地址,向该MAC地址对应的手机发送蓝牙连接请求,请求与手机建立蓝牙连接。
智能音箱根据Wi-Fi热点信息向手机发送Wi-Fi连接请求;Wi-Fi连接请求用于请求建立Wi-Fi连接。示例性地,Wi-Fi连接请求包括SSID、密码、信道标识和加密方式等中的至少一项。
手机接收到蓝牙连接请求后,向智能音箱返回蓝牙连接响应。智能音箱接收到蓝牙连接响应,手机和智能音箱成功建立蓝牙连接。比如,蓝牙连接为蓝牙低功耗(bluetooth low energy,BLE)连接。
手机和智能音箱成功建立蓝牙连接之后,建立蓝牙通道。示例性地,蓝牙通道包括蓝牙控制信道和蓝牙数据信道。蓝牙控制信道用于传输控制信令;蓝牙数据信道用于传输蓝牙数据。
手机接收到Wi-Fi连接请求后,验证Wi-Fi连接请求中的SSID、密码、信道标识和加密方式等信息。如果验证通过,手机向智能音箱返回Wi-Fi连接响应。智能音箱接收到Wi-Fi连接响应,手机和智能音箱成功建立Wi-Fi连接。比如,该Wi-Fi连接为Wi-Fi点对点(peer to peer,P2P)连接。再比如,该Wi-Fi连接为无线访问节点(access point,AP)加站点(station,STA)模式连接。
手机和智能音箱成功建立Wi-Fi连接(即建立网络连接)之后,建立Wi-Fi通道。Wi-Fi通道即基于网络连接,建立KCP(具有可靠性的传输层自动重传请求协议)的数据传输通道或传输控制协议(transmission control protocol,TCP)的信令传输通道。
需要说明的是,S804和S805同步进行,并且相互独立。
通常,蓝牙通道的建立耗时较短。比如,从启动建立蓝牙连接,至蓝牙通道建立成功的耗时为1秒(s)左右。而在建立Wi-Fi连接过程中,需要进行Wi-Fi信道扫描、无线网络连接、动态主机配置协议(dynamic host configuration protocol,DHCP)分配网络协议地址、以及手机与智能音箱基于Wi-Fi连接建立TCP连接通道等导致耗时较长。比如,从启动Wi-Fi连接至Wi-Fi通道的建立耗时在3秒(s)以上。
S806、手机通过蓝牙通道向智能音箱发送音频数据。
蓝牙通道的建立耗时较短。响应于蓝牙通道的建立成功,手机通过蓝牙通道向智能音箱发送高品质音频。比如,该音频可以为高解析音频(high-resolution audio,Hi-Res)或直接比特流数字(direct stream digital,DSD)等格式的高品质音频。示例性地,蓝牙传输协议为高级音频编码(advanced audio coding,AAC)或LDAC等。基于蓝牙传输协议,Hi-Res或DSD等格式的高品质音频,在蓝牙传输过程中会被重采样。比如,蓝牙传输协议为AAC,智能音箱接收的蓝牙音频的采样率为44.1KHz,位深度为16bit。再比如,蓝牙传输协议为LDAC,智能音箱接收的蓝牙音频的采样率为96KHz,位深度为24bit。
在一种实现方式中,手机在通过蓝牙通道传输音频数据的过程中,对音频数据进行重采样(示例性地,使用AAC协议传输,采样率为44.1KHz,位深度为16bit),并在重采样后音频数据的每一包音频数据的数据头中添加显示时间戳(presentation time stamp,PTS),PTS用于指示该包音频数据的播放时间。比如,将每10毫秒(ms)的音频数据重采样后作为一个音频数据包,在该包音频数据的数据头中添加PTS。智能音箱可以根据音频数据包的PTS,在PTS指示的时间播放该包音频数据。示例性地,手机将音频数据按照每10ms音频作为一个数据包进行重采样。手机确定通过蓝牙通 道发送音频数据时,获取当前系统时间T 1(比如,单位精确到毫秒);将(T 1+t)作为第一个音频数据包(0ms~10ms的音频)的PTS打包至第一个音频数据包的数据头。其中,t>=0;t(比如,单位为毫秒)为预设值,根据手机向智能音箱发送音频数据的时延确定。手机将(T 1+t+10ms)作为第二个音频数据包的PTS打包至第二个音频数据包的数据头。以此类推,手机将(T 1+t+(w-1)*10ms)作为第w个音频数据包的PTS打包至第w个音频数据包的数据头。
S807、智能音箱播放蓝牙音频。
智能音箱保存接收到的蓝牙音频,并播放蓝牙音频。示例性地,智能音箱接收到蓝牙音频,在每个蓝牙音频数据包中的PTS指示的时间播放对应的音频数据包。
在一种实现方式中,智能音箱支持第一采样率,第一位深度的音频数据。以第一采样率为96KHz,第一位深度为32bit的PCM格式音频数据为例,智能音箱接收到蓝牙音频,解析该蓝牙音频,获取每个蓝牙音频数据包。智能音箱还将从蓝牙通道接收的音频数据重采样为采样率96KHz,位深度32bit的PCM音频数据;以PCM格式保存蓝牙音频数据。
示例性地,音频数据保存的格式可以为:
Figure PCTCN2022084147-appb-000001
其中,PcmInfo表示一个音频数据包,index为该音频数据包的序号,pts为该音频数据包的显示时间戳PTS的值,pcmData用于存储音频数据,7680表示pcmData中存储的音频数据长度(即音频数据包长度)最大值为7680。需要说明的是,音频数据包的长度与智能音箱支持的第一采样率和第一位深度相关。比如,上述示例中,最大值7680是对应10ms的音频数据包以第一采样率(96KHz)和第一位深度(32bit)进行重采样。可以理解地,智能音箱支持的第一采样率和/或第一位深度不同,音频数据包长度最大值也不同。
S808、手机通过Wi-Fi通道向智能音箱发送音频数据。
Wi-Fi通道建立时延较长,但是音频数据通过Wi-Fi通道传输不进行重采样,不会降低音频品质;或者,虽然进行重采样,但重采样率较高,对音频品质的影响较小。Wi-Fi通道建立成功后,手机也通过Wi-Fi通道向智能音箱发送音频数据。这样,音频数据通过Wi-Fi通道和蓝牙通道分别向智能音箱发送。在一种实现方式中,Wi-Fi通道建立成功时,手机已通过蓝牙通道向智能音箱传输了n个音频数据包,则从第(n+1)个音频数据包开始,也通过Wi-Fi通道进行发送。
在一种实现方式中,手机通过Wi-Fi通道传输音频数据过程中,在每一包音频数据的数据头中添加PTS。比如,将每10ms的音频数据作为一个音频数据包,在该包音频数据的音频数据头中添加PTS。智能音箱可以根据音频数据包的PTS,在PTS指示的时间播放该包音频数据。示例性地,手机确定通过Wi-Fi通道传输音频数据时,获取当前系统时间T 1(比如,单位精确到毫秒);将待通过Wi-Fi通道发送的音频数据 按照每10ms音频作为一个数据包进行重采样(示例性地,使用AAC协议传输,采样率为44.1KHz,位深度为16bit)。将(T 1+t)作为第一个Wi-Fi音频数据包的PTS打包至第一个Wi-Fi音频数据包的数据头。其中,t>=0;t(比如,单位为毫秒)为预设值,根据手机向智能音箱发送音频数据的时延确定。手机将(T 1+t+10ms)作为第二个Wi-Fi音频数据包的PTS打包至第二个Wi-Fi音频数据包的数据头。以此类推,手机将(T 1+t+(w-1)*10ms)作为第w个Wi-Fi音频数据包的PTS打包至第w个Wi-Fi音频数据包的数据头。
需要说明的是,对于同一音频数据包,通过Wi-Fi通道传输过程中添加的PTS与通过蓝牙通道传输过程中添加的PTS是一致的。
智能音箱从Wi-Fi通道接收到音频数据后,将Wi-Fi音频数据保存在智能音箱中。在一种实现方式中,智能音箱支持第一采样率,第一位深度的音频数据。以智能音箱支持第一采样率96KHz,第一位深度32bit的PCM格式音频数据为例,智能音箱接收到Wi-Fi音频,解析该Wi-Fi音频,获取每个Wi-Fi音频数据包。智能音箱还将从Wi-Fi通道接收的音频数据重采样为采样率96KHz,位深度32bit的PCM音频数据;以PCM格式保存Wi-Fi音频。
需要说明的是,在本申请实施例中,智能音箱对音频数据(蓝牙音频或Wi-Fi音频)以采样率96KHz和位深度32bit的PCM格式进行重采样。可以理解地,智能音箱也可以其他格式对音频数据进行重采样。比如,以更高的采样率和位深度进行重采样,以保证音频的高品质。
在一种实现方式中,智能音箱以相同的采样率以及相同的位深度,对Wi-Fi音频和蓝牙音频分别进行重采样;以相同的格式保存Wi-Fi音频和蓝牙音频。便于将播放的音频从蓝牙音频切换为Wi-Fi音频时,根据PCM格式音频数据包中的参数,确定蓝牙音频数据包与Wi-Fi音频数据包的对应关系。
S809、手机停止通过蓝牙通道传输音频数据。
可选地,在一种实现方式中,满足设定条件后,智能音箱指示手机停止通过蓝牙通道传输音频数据。在一种示例中,智能音箱向手机发送第二消息,第二消息用于通知手机停止通过蓝牙通道传输音频数据。示例性地,智能音箱确定从Wi-Fi通道接收到音频数据,向手机发送第二消息;再示例性地,智能音箱缓存预设时长(比如,40毫秒(ms))的Wi-Fi音频后,向手机发送第二消息。可以理解地,智能音箱通知手机停止通过蓝牙通道传输音频数据,或手机通知智能音箱将播放的音频从蓝牙音频切换为Wi-Fi音频都会带来时延,智能音箱缓存Wi-Fi音频的预设时长大于消息交互时延,可以保证播放音频流畅性。
手机接收到第二消息,停止通过蓝牙通道传输音频数据。
在一种示例中,第二消息包括指示信息,指示信息用于指示停止通过蓝牙通道传输音频数据的时刻。手机接收到第二消息,获取指示信息,在指示信息指示的时刻停止通过蓝牙通道传输音频数据。
在这种实现方式中,手机根据智能音箱发送的第二消息,停止通过蓝牙通道传输音频数据,可以避免在将播放的音频数据来源切换为通过Wi-Fi通道接收的音频之前,停止通过蓝牙通道传输音频数据导致的播放卡顿。
可选地,在另一种实现方式中,手机确定Wi-Fi通道建立成功,即开始通过Wi-Fi通道传输音频数据,停止通过蓝牙通道传输音频数据。该实现方式中,手机和智能音箱交互步骤少,由智能音箱保证音频切换流畅性,手机侧实现简单。
S810、智能音箱将播放的音频从蓝牙音频切换为Wi-Fi音频。
在一些实施例中,智能音箱确定将播放的音频数据切换为Wi-Fi音频。示例性地,智能音箱确定从Wi-Fi通道接收到音频数据,则确定将播放的音频数据切换为Wi-Fi音频。再比如,智能音箱确定缓存了预设时长(比如,40毫秒(ms))的Wi-Fi音频后,确定将播放的音频数据切换为Wi-Fi音频。
在另一些实施例中,手机确定智能音箱将播放的音频数据切换为Wi-Fi音频。示例性地,手机确定Wi-Fi通道建立成功,则确定智能音箱将播放的音频数据切换为Wi-Fi音频;再示例性地,手机从智能音箱接收到停止通过蓝牙通道传输音频数据的指示消息(第二消息)后,向智能音箱发送第一消息,用于通知智能音箱将播放的音频数据切换为Wi-Fi音频。智能音箱接收到第一消息,确定将播放的音频数据切换为Wi-Fi音频。
智能音箱在第一时刻将播放的音频数据切换为Wi-Fi音频。在一种实现方式中,智能音箱确定将播放的音频数据切换为Wi-Fi音频时(比如,接收到第一消息时;再比如,确定缓存了预设时长的Wi-Fi音频时),获取当前播放的蓝牙音频数据包,当前播放的蓝牙音频数据包的下一包蓝牙音频数据包的PTS(第一PTS)即为第一时刻。智能音箱在保存的Wi-Fi音频数据包中根据第一PTS值确定对应的第一Wi-Fi音频数据包。智能音箱在第一时刻开始播放第一Wi-Fi音频数据包,停止播放蓝牙音频数据包。可以理解地,由于智能音箱将接收的蓝牙音频和Wi-Fi音频都重采样为相同格式(比如PCM格式)的音频数据,可以实现根据蓝牙音频数据包中的PTS值确定对应的Wi-Fi音频数据包;保证播放的音频数据无缝切换。
示例性地,智能音箱接收到第一消息,确定将播放的音频数据切换为Wi-Fi音频。智能音箱获取当前播放的蓝牙音频数据包。如图9B所示,智能音箱根据当前系统时间在蓝牙缓存中查找当前播放的蓝牙音频数据包。比如,当前系统时间为1619686174998(单位为毫秒),根据蓝牙音频数据包的PTS值确定该蓝牙音频数据包的index为4。智能音箱获取index为5(当前播放蓝牙音频数据包的下一包)的蓝牙音频数据包的PTS值为1619686175008(1619686174998+10)(单位为毫秒)。智能音箱在保存的Wi-Fi音频数据包中遍历,确定PTS值1619686175008对应的Wi-Fi音频数据包为index值为3(可以理解地,蓝牙音频数据包与Wi-Fi音频数据包中的index值不相关)的Wi-Fi音频数据包,即获取到第一Wi-Fi音频数据包。智能音箱在1619686175008(单位为毫秒)时,停止播放蓝牙音频,转而从index值为3的Wi-Fi音频数据包开始顺序播放Wi-Fi音频。
可以理解地,本申请实施例并不限定S809和S810执行的先后顺序。可选地,在一些实施中,手机可以不停止通过蓝牙通道传输音频数据,即不执行S809。
在本申请实施例提供的投音方法中,第一电子设备和第二电子设备通过“碰一碰”,互相发现,启动建立蓝牙通道和Wi-Fi通道。蓝牙通道的建立耗时较短。蓝牙通道建立成功后,第一电子设备开始投音。第一电子设备基于快速建立的蓝牙通道向第二电 子设备传输音频数据,第二电子设备播放从蓝牙通道接收的音频数据。Wi-Fi通道的建立耗时比蓝牙通道的建立耗时长。Wi-Fi通道建立完成后,第一电子设备通过Wi-Fi通道与蓝牙通道并行地、相互独立地传输音频数据。之后,第二电子设备将播放的音频数据切换为Wi-Fi音频。由于蓝牙通道的建立耗时短,蓝牙通道建立成功后即通过蓝牙通道投音(可以理解地,高品质音频被重采样,重采样后会降低音频的品质,播放效果较差),可以使得投音时延较低。经过一个时长(比如,3秒)后,Wi-Fi通道建立完成,第二电子设备将播放的音频数据切换为Wi-Fi音频,保证高品质音频较好的播放效果。这样,高品质音频在较短时间内即可开始以有损(损失较大)方式进行投音,在Wi-Fi通道建立完成后即将播放的音频数据切换为无损或者损失较小的高品质音频;兼顾了低时延和高品质音频,为用户提供更好的投音播放体验。
需要说明的是,本申请实施例以音频投放为例进行说明。可以理解地,本申请实施例提供的方法并不局限于投音;第一电子设备向第二电子设备传输其他类型或格式的数据(比如视频数据等)也可适用本申请的方法。即本申请并不限定投放数据的类型或格式。投放其他数据,也在本申请的范围之内。
可以理解地是,上述第一电子设备和第二电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
本申请实施例可以根据上述方法示例对上述第一电子设备和第二电子设备进行功能模块的划分。例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
如图10所示,本申请实施例公开了一种第一电子设备1000,该第一电子设备可以为上述实施例中的手机。
在一种示例中,请参考图10,其示出了上述实施例中所涉及的第一电子设备1000的一种可能的结构示意图。该第一电子设备1000包括:处理单元1001,存储单元1002,通信单元1003和显示单元1004。其中,处理单元1001,用于对第一电子设备1000的动作进行控制管理。存储单元1002用于保存第一电子设备1000的程序代码和数据。通信单元1003用于支持第一电子设备1000与其他电子设备的通信。显示单元1004用于显示第一电子设备1000的界面。比如显示用于提示用户确认是否进行一碰投音的窗口。
当然,上述第一电子设备1000中的单元模块包括但不限于上述处理单元1001,存储单元1002,通信单元1003和显示单元1004。例如,第一电子设备1000中还可以包括电源单元等。电源单元用于对第一电子设备1000供电。
其中,处理单元1001可以是处理器或控制器,例如可以是中央处理器(central  processing unit,CPU),数字信号处理器(digital signal processor,DSP),专用集成电路(application-specific integrated circuit,ASIC),现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。存储单元1002可以是存储器。通信单元1003可以是收发器、收发电路等。显示单元1004可以是液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)或有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED)等。
例如,处理单元1001为处理器(如图4所示的处理器110),存储单元1002可以为存储器(如图4所示的内部存储器121),通信单元1003可以称为通信接口,包括无线通信模块(如图4所示的无线通信模块160),显示单元1004为显示屏(如图4所示的显示屏140,该显示屏140可以为触摸屏,该触摸屏中可以集成显示面板和触控面板)。本申请实施例所提供的第一电子设备1000可以为图4所示的第一电子设备100。其中,上述处理器、存储器、通信接口、显示屏等可以连接在一起,例如通过总线连接。
其中,上述处理器、存储器、通信接口等可以连接在一起,例如通过总线连接。
如图11所示,本申请实施例公开了一种第二电子设备1100,该第二电子设备1100可以为上述实施例中的智能音箱。
在一种示例中,该第二电子设备1100包括:处理单元1101,存储单元1102,通信单元1103和播放单元1104。其中,处理单元1101是第二电子设备的控制中心,对第二电子设备1100的动作进行控制管理。存储单元1102用于保存第二电子设备1100的程序代码和数据。例如,可以用于保存蓝牙音频和Wi-Fi音频。通信单元1103用于支持第二电子设备1100与其他电子设备的通信。播放单元1104用于播放第二电子设备1100中缓存的数据。比如用于播放蓝牙音频或Wi-Fi音频。
当然,上述第二电子设备1100中的单元模块包括但不限于上述处理单元1101,存储单元1102,通信单元1103和播放单元1104。例如,第二电子设备1100中还可以包括电源单元等。电源单元用于对第二电子设备1100供电。
其中,处理单元1101可以是处理器或控制器,例如可以是中央处理器(central processing unit,CPU),数字信号处理器(digital signal processor,DSP),专用集成电路(application-specific integrated circuit,ASIC),现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。存储单元1102可以是存储器。通信单元1103可以是收发器、收发电路等。播放单元1104可以是扬声器。
例如,处理单元1101为处理器(如图5所示的处理器210),存储单元1102可以为存储器(如图5所示的内部存储器221),通信单元1103可以称为通信接口,包括无线通信模块(如图5所示的无线通信模块260),播放单元1104为扬声器(如图5所示的扬声器230A)。本申请实施例所提供的第二电子设备1100可以为图5所示的第二电子设备200。其中,上述处理器、存储器、通信接口、扬声器等可以连接在一起,例如通过总线连接。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有 计算机程序代码,当处理器执行该计算机程序代码时,第一电子设备执行上述实施例中的方法。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序代码,当处理器执行该计算机程序代码时,第二电子设备执行上述实施例中的方法。
本申请实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述实施例中的方法。
其中,本申请实施例提供的投放设备1000、第二电子设备1100、计算机可读存储介质、计算机程序产品均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以使用硬件的形式实现,也可以使用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (29)

  1. 一种第一电子设备,其特征在于,所述第一电子设备包括:
    处理器;
    存储器;
    以及计算机程序,其中所述计算机程序存储在所述存储器上,当所述计算机程序被所述处理器执行时,使得所述第一电子设备执行:
    响应于所述第一电子设备和第二电子设备的靠近,所述第一电子设备发现所述第二电子设备;
    响应于所述第一电子设备与所述第二电子设备之间的第一传输通道建立成功,所述第一电子设备通过所述第一传输通道向所述第二电子设备传输音频数据;
    响应于所述第一电子设备与所述第二电子设备之间的第二传输通道建立成功,所述第一电子设备通过所述第二传输通道向所述第二电子设备传输音频数据;
    所述第一电子设备向所述第二电子设备发送第一消息;所述第一消息用于指示所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频。
  2. 根据权利要求1所述的第一电子设备,其特征在于,所述第一电子设备还执行:
    所述第一电子设备停止通过所述第一传输通道传输音频数据。
  3. 根据权利要求2所述的第一电子设备,其特征在于,在所述第一电子设备停止通过所述第一传输通道传输音频数据之前,所述第一电子设备还执行:
    所述第一电子设备从所述第二电子设备接收第二消息;所述第二消息用于通知第一电子设备停止通过所述第一传输通道传输音频数据。
  4. 根据权利要求3所述的第一电子设备,其特征在于,所述第二消息包括指示信息;所述指示信息用于指示所述第一电子设备停止通过所述第一传输通道传输音频数据的时刻;
    所述第一电子设备停止通过所述第一传输通道传输音频数据,包括:所述第一电子设备在所述指示信息指示的时刻停止通过所述第一传输通道传输音频数据。
  5. 根据权利要求1-4中任意一项所述的第一电子设备,其特征在于,所述第一传输通道为蓝牙通道,所述第二传输通道为无线保真Wi-Fi通道。
  6. 一种第二电子设备,其特征在于,所述第二电子设备包括:
    处理器;
    存储器;
    以及计算机程序,其中所述计算机程序存储在所述存储器上,当所述计算机程序被所述处理器执行时,使得所述第二电子设备执行:
    响应于所述第一电子设备和所述第二电子设备的靠近,所述第二电子设备发现所述第一电子设备;
    响应于所述第一电子设备与所述第二电子设备之间的第一传输通道建立成功,所述第二电子设备通过所述第一传输通道接收音频数据;
    所述第二电子设备播放第一音频,所述第一音频为所述第二电子设备通过所述第一传输通道接收的音频数据;
    响应于所述第一电子设备与所述第二电子设备之间的第二传输通道建立成功,所 述第二电子设备通过所述第二传输通道接收音频数据;
    所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频,所述第二音频为所述第二电子设备通过所述第二传输通道接收的音频数据。
  7. 根据权利要求6所述的第二电子设备,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频之前,所述第二电子设备还执行:
    所述第二电子设备确定满足设定条件。
  8. 根据权利要求7所述的第二电子设备,其特征在于,所述设定条件包括:
    所述第二电子设备缓存了预设时长的第二音频。
  9. 根据权利要求6所述的第二电子设备,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频之前,所述第二电子设备还执行:
    所述第二电子设备从所述第一电子设备接收第一消息,所述第一消息用于指示所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频。
  10. 根据权利要求6-9中任意一项所述的第二电子设备,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频;包括:
    所述第二电子设备根据当前播放的第一音频的第一音频数据包,确定第一显示时间戳PTS,根据所述第一PTS确定第二音频的第二音频数据包;
    所述第二电子设备在所述第一PTS指示的时刻停止播放第一音频,并开始播放所述第二音频的第二音频数据包。
  11. 根据权利要求10所述的第二电子设备,其特征在于,所述第二电子设备根据当前播放的第一音频确定第一显示时间戳PTS;包括:
    所述第二电子设备将当前播放的第一音频数据包的下一个音频数据包的PTS值确定为第一PTS。
  12. 根据权利要求6-11中任意一项所述的第二电子设备,其特征在于,所述第二电子设备还执行:
    所述第二电子设备以第一采样率和第一位深度对接收的第一音频进行重采样;
    所述第二电子设备以第一采样率和第一位深度对接收的第二音频进行重采样。
  13. 根据权利要求6-12中任意一项所述的第二电子设备:,其特征在于,所述第二电子设备还执行:
    所述第二电子设备向所述第一电子设备发送第二消息;所述第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。
  14. 根据权利要求13所述的第二电子设备,其特征在于,所述第二消息包括指示信息;所述指示信息用于指示所述第一电子设备停止通过第一传输通道传输音频数据的时刻。
  15. 一种投音方法,应用于第一电子设备,其特征在于,所述方法包括:
    响应于所述第一电子设备和所述第二电子设备的靠近,所述第一电子设备发现所述第二电子设备;
    响应于所述第一电子设备与所述第二电子设备之间的第一传输通道建立成功,所述第一电子设备通过所述第一传输通道向所述第二电子设备传输音频数据;
    响应于所述第一电子设备与所述第二电子设备之间的第二传输通道建立成功,所 述第一电子设备通过所述第二传输通道向所述第二电子设备传输音频数据;
    所述第一电子设备向所述第二电子设备发送第一消息,所述第一消息用于指示所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频。
  16. 根据权利要求15所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备停止通过所述第一传输通道传输音频数据。
  17. 根据权利要求16所述的方法,其特征在于,在所述第一电子设备停止通过所述第一传输通道传输音频数据之前,所述方法还包括:
    所述第一电子设备从所述第二电子设备接收第二消息;所述第二消息用于通知第一电子设备停止通过所述第一传输通道传输音频数据。
  18. 根据权利要求17所述的方法,其特征在于,所述第二消息包括指示信息;所述指示信息用于指示所述第一电子设备停止通过所述第一传输通道传输音频数据的时刻;
    所述第一电子设备停止通过所述第一传输通道传输音频数据,包括:所述第一电子设备在所述指示信息指示的时刻停止通过所述第一传输通道传输音频数据。
  19. 一种投音方法,应用于第二电子设备,其特征在于,所述方法包括:
    响应于所述第一电子设备和所述第二电子设备的靠近,所述第二电子设备发现所述第一电子设备;
    响应于所述第一电子设备与所述第二电子设备之间的第一传输通道建立成功,所述第二电子设备通过所述第一传输通道接收音频数据;
    所述第二电子设备播放第一音频,所述第一音频为所述第二电子设备通过所述第一传输通道接收的音频数据;
    响应于所述第一电子设备与所述第二电子设备之间的第二传输通道建立成功,所述第二电子设备通过所述第二传输通道接收音频数据;
    所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频,所述第二音频为所述第二电子设备通过所述第二传输通道接收的音频数据。
  20. 根据权利要求19所述的方法,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频之前,所述方法还包括:
    所述第二电子设备确定满足设定条件。
  21. 根据权利要求20所述的方法,其特征在于,所述设定条件包括:
    所述第二电子设备缓存了预设时长的第二音频。
  22. 根据权利要求19所述的方法,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频之前,所述方法还包括:
    所述第二电子设备从所述第一电子设备接收第一消息,所述第一消息用于指示所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频。
  23. 根据权利要求19-22中任意一项所述的方法,其特征在于,所述第二电子设备将播放的音频数据从所述第一音频切换为第二音频;包括:
    所述第二电子设备根据当前播放的第一音频的第一音频数据包,确定第一显示时间戳PTS,根据所述第一PTS确定第二音频的第二音频数据包;
    所述第二电子设备在所述第一PTS指示的时刻停止播放第一音频,并开始播放所 述第二音频的第二音频数据包。
  24. 根据权利要求23所述的方法,其特征在于,所述第二电子设备根据当前播放的第一音频确定第一显示时间戳PTS;包括:
    所述第二电子设备将当前播放的第一音频数据包的下一个音频数据包的PTS值确定为第一PTS。
  25. 根据权利要求19-24中任意一项所述的方法,其特征在于,所述方法还包括:
    所述第二电子设备以第一采样率和第一位深度对接收的第一音频进行重采样;
    所述第二电子设备以第一采样率和第一位深度对接收的第二音频进行重采样。
  26. 根据权利要求19-25中任意一项所述的方法,其特征在于,所述方法还包括:
    所述第二电子设备向所述第一电子设备发送第二消息;所述第二消息用于通知第一电子设备停止通过第一传输通道传输音频数据。
  27. 根据权利要求26所述的方法,其特征在于,所述第二消息包括指示信息;所述指示信息用于指示所述第一电子设备停止通过第一传输通道传输音频数据的时刻。
  28. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机程序,当所述计算机程序在第一电子设备上运行时,使得所述第一电子设备执行如权利要求15-18中任意一项所述的方法。
  29. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机程序,当所述计算机程序在第二电子设备上运行时,使得所述第二电子设备执行如权利要求19-27中任意一项所述的方法。
PCT/CN2022/084147 2021-04-30 2022-03-30 一种投音方法及计算机可读存储介质 WO2022228013A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110485895.2 2021-04-30
CN202110485895.2A CN115278612A (zh) 2021-04-30 2021-04-30 一种投音方法及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2022228013A1 true WO2022228013A1 (zh) 2022-11-03

Family

ID=83746086

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084147 WO2022228013A1 (zh) 2021-04-30 2022-03-30 一种投音方法及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN115278612A (zh)
WO (1) WO2022228013A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110183614A1 (en) * 2010-01-25 2011-07-28 Kabushiki Kaisha Toshiba Communication terminal
CN103856806A (zh) * 2012-11-28 2014-06-11 腾讯科技(北京)有限公司 视频流切换方法、装置及系统
CN108471638A (zh) * 2018-02-08 2018-08-31 深圳魔耳智能声学科技有限公司 无线耳机控制方法、装置、控制装置及存储介质
US20190394638A1 (en) * 2018-06-21 2019-12-26 Canon Kabushiki Kaisha Communication apparatus communicating with external apparatus, control method for communication apparatus, and recording medium
CN111224693A (zh) * 2019-11-27 2020-06-02 展讯通信(上海)有限公司 用于无线耳机的音频数据传输方法及装置、存储介质、终端
CN111713141A (zh) * 2018-04-04 2020-09-25 华为技术有限公司 一种蓝牙播放方法及电子设备
CN112350981A (zh) * 2019-08-09 2021-02-09 华为技术有限公司 一种切换通信协议的方法、装置和系统

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110183614A1 (en) * 2010-01-25 2011-07-28 Kabushiki Kaisha Toshiba Communication terminal
CN103856806A (zh) * 2012-11-28 2014-06-11 腾讯科技(北京)有限公司 视频流切换方法、装置及系统
CN108471638A (zh) * 2018-02-08 2018-08-31 深圳魔耳智能声学科技有限公司 无线耳机控制方法、装置、控制装置及存储介质
CN111713141A (zh) * 2018-04-04 2020-09-25 华为技术有限公司 一种蓝牙播放方法及电子设备
US20190394638A1 (en) * 2018-06-21 2019-12-26 Canon Kabushiki Kaisha Communication apparatus communicating with external apparatus, control method for communication apparatus, and recording medium
CN112350981A (zh) * 2019-08-09 2021-02-09 华为技术有限公司 一种切换通信协议的方法、装置和系统
CN111224693A (zh) * 2019-11-27 2020-06-02 展讯通信(上海)有限公司 用于无线耳机的音频数据传输方法及装置、存储介质、终端

Also Published As

Publication number Publication date
CN115278612A (zh) 2022-11-01

Similar Documents

Publication Publication Date Title
WO2021004381A1 (zh) 一种投屏显示方法及电子设备
WO2020098437A1 (zh) 一种播放多媒体数据的方法及电子设备
WO2021013156A1 (zh) 蓝牙切换方法及蓝牙设备
EP3893109B1 (en) Method and device for connecting bluetooth devices
WO2021017934A1 (zh) 一种控制设备的方法及终端
WO2022100305A1 (zh) 画面跨设备显示方法与装置、电子设备
WO2020133183A1 (zh) 音频数据的同步方法及设备
WO2020132839A1 (zh) 应用于tws耳机单双耳切换的音频数据传输方法及设备
WO2021082829A1 (zh) 蓝牙连接方法及相关装置
WO2021175214A1 (zh) 一种投屏连接控制方法及电子设备
WO2022222754A1 (zh) Wifi链路休眠唤醒方法、电子设备及系统
WO2022001147A1 (zh) 一种定位方法及电子设备
WO2021063189A1 (zh) 一种多设备之间的信息同步方法、系统及电子设备
WO2021104114A1 (zh) 一种提供无线保真WiFi网络接入服务的方法及电子设备
CN112398855A (zh) 应用内容跨设备流转方法与装置、电子设备
WO2022007944A1 (zh) 一种设备控制方法及相关装置
WO2020124371A1 (zh) 一种数据信道的建立方法及设备
WO2022048371A1 (zh) 跨设备音频播放方法、移动终端、电子设备及存储介质
WO2022143508A1 (zh) 一种近场中传输数据的方法、设备及系统
WO2022166618A1 (zh) 一种投屏的方法和电子设备
CN114258003A (zh) 音频播放控制方法、系统、设备及存储介质
JP2024516668A (ja) デバイスネットワーキング方法、電子デバイス、及び記憶媒体
WO2022213689A1 (zh) 一种音频设备间语音互通的方法及设备
CN117062256B (zh) 跨设备业务转移的方法、电子设备和系统
WO2019165983A1 (zh) 一种蓝牙传输控制方法、控制系统及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22794486

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22794486

Country of ref document: EP

Kind code of ref document: A1