WO2020063069A1 - Audio playing method and apparatus, electronic device and computer-readable medium - Google Patents

Audio playing method and apparatus, electronic device and computer-readable medium Download PDF

Info

Publication number
WO2020063069A1
WO2020063069A1 PCT/CN2019/097146 CN2019097146W WO2020063069A1 WO 2020063069 A1 WO2020063069 A1 WO 2020063069A1 CN 2019097146 W CN2019097146 W CN 2019097146W WO 2020063069 A1 WO2020063069 A1 WO 2020063069A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio playback
wireless audio
playback device
wireless
audio data
Prior art date
Application number
PCT/CN2019/097146
Other languages
French (fr)
Chinese (zh)
Inventor
龚金华
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2020063069A1 publication Critical patent/WO2020063069A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72442User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for playing music files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72409User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories
    • H04M1/72412User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by interfacing with external accessories using two-way short-range wireless interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • 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

Definitions

  • the present application relates to the field of communication technologies, and more particularly, to an audio playback method, device, electronic device, and computer-readable medium.
  • wireless audio playback devices to play audio data in electronic devices can reduce the inconvenience caused by wired headphones.
  • electronic devices can connect two wireless audio playback devices at the same time, and two wireless audio playback devices can achieve audio mixing. Play effect.
  • the user abandons using one of the wireless audio playback devices to listen to the audio, the user will not be able to hear the mixed playback effect of the audio, resulting in a poor user experience.
  • the present application proposes an audio playback method, device, electronic device, and computer-readable medium to improve the above defects.
  • an embodiment of the present application provides an audio playback method, which is applied to an electronic device that can connect two wireless audio playback devices at the same time.
  • the method includes: determining whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to achieve mixed audio playback; Device as the first wireless audio playback device, the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data; the wireless audio playback device that is not in the preset state is used as the second wireless audio A playback device, the audio data played by the second wireless audio playback device during mixing playback is second audio data; and controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time, so that Realize mixed playback.
  • an embodiment of the present application further provides an audio playback device, which is applied to an electronic device, and the electronic device can be connected to two wireless audio playback devices at the same time.
  • the audio playback device includes a detection unit, a first determination unit, a second determination unit, and a playback unit.
  • a detection unit is configured to determine whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to implement mixed audio playback.
  • the first determining unit is configured to use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
  • a second determining unit configured to use a wireless audio playback device that is not in a preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data .
  • the playback unit is configured to control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement the mixed audio playback.
  • an embodiment of the present application further provides an electronic device, including: one or more processors capable of simultaneously connecting two wireless audio playback devices; a memory; and one or more applications A program, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the above method.
  • an embodiment of the present application further provides a computer-readable medium having a processor-executable program code, where the program code causes the processor to perform the foregoing method.
  • FIG. 1 shows a module block diagram of a voice system provided by an embodiment of the present application
  • FIG. 2 shows a block diagram of a voice system according to another embodiment of the present application
  • FIG. 3 shows a method flowchart of an audio playback method according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of a device management interface according to an embodiment of the present application.
  • FIG. 5 shows a method flowchart of an audio playback method according to another embodiment of the present application.
  • FIG. 6 shows a method flowchart of an audio playback method according to another embodiment of the present application
  • FIG. 7 is a schematic diagram of an answering interface provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of an answering interface provided by another embodiment of the present application.
  • FIG. 9 shows a module block diagram of an audio playback device according to an embodiment of the present application.
  • FIG. 10 shows a module block diagram of an electronic device according to an embodiment of the present application.
  • FIG. 11 illustrates a storage unit for storing or carrying a program code for implementing an audio playing method according to an embodiment of the present application.
  • audio playback devices With the increase in the types of audio playback devices and the improvement of playback sound effects, more users will choose to output audio to be played by electronic devices such as mobile phones and tablets to the audio playback device for playback.
  • electronic devices such as mobile phones and tablets
  • audio playback devices include car music players, speakers, and headphones.
  • audio playback devices can be divided into wired audio playback devices and wireless audio playback devices.
  • the electronic device can interact with the wireless audio playback device through a wireless network to transmit signals.
  • the wireless network may be Bluetooth. , Wifi, LTE network or NFC, etc.
  • the voice system includes an electronic device 100, a first wireless audio playback device 210, and a second wireless audio playback device 220.
  • the electronic device 100 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220 at the same time.
  • an application capable of playing audio is installed in the electronic device 100.
  • the application may be audio playing software, video playing software, or calling software.
  • the electronic device 100 sends the audio to be played to the first wireless audio playback device 210 or the second wireless audio playback device 220, and the first wireless audio playback device 210 or the second wireless audio playback device 220 plays the voice.
  • the first wireless audio playback device 210 and the second wireless audio playback device 220 may both be Bluetooth speakers or Bluetooth headsets.
  • the first wireless audio playback device 210 and the second wireless audio playback device 220 may be enabled with the Bluetooth function.
  • a connection with the electronic device 100 is achieved, and after the connection is established, the electronic device 100 sends the voice that it needs to play to the Bluetooth audio, and the Bluetooth audio implements voice playback.
  • the electronic device 100 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220 through the Bluetooth module at the same time.
  • the Bluetooth module in the electronic device may support multipoint connection, so that the electronic device shown in FIG. 1 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220, respectively.
  • the electronic device 100 can obtain the identities of the first wireless audio playback device 210 and the second wireless audio playback device 220, and the identifications may be MAC addresses.
  • the Bluetooth function of the electronic device is turned on, the electronic device scans the Bluetooth devices within a certain distance from the surrounding area.
  • the preset Scan in the order of channel scanning. For example, scan the common channels 1, 7, and 13 first, and then scan the other unused channels, so as to obtain the identification of all Bluetooth devices in the current range and display them in the Bluetooth list interface of the electronic device. .
  • the electronic device will automatically connect with the Bluetooth device, and the user can also select a Bluetooth device in the Bluetooth list interface to connect.
  • the system of the electronic device obtains a status value, which indicates that the electronic device is currently connected to the Bluetooth device. Therefore, the electronic device can detect that the Bluetooth device is already present, and thereby obtain the device identification of the Bluetooth device.
  • the electronic device 100 is connected to the first wireless audio playback device 210 through Bluetooth, and then the first wireless audio playback device 210 is connected to the second wireless audio playback device 220 through Bluetooth. Therefore, the electronic device 100, the first wireless audio playback device 210, and the second wireless audio playback device 220 are simultaneously connected through networking, that is, the first wireless audio playback device 210 serves as the electronic device 100 and the second wireless audio playback device 220. Repeater.
  • different audio playback devices can play different audio data. Of course, it can also be played by different audio playback devices. Same audio data to achieve effects like stereo. It is also possible to use one of the wireless audio playback devices to play audio data while the other wireless audio playback device is on standby without playing audio.
  • the inventor found in the research that when the user abandons using one of the wireless audio playback devices to listen to the audio data, because the audio data played by the two wireless audio playback devices cannot be heard at the same time, the effect of mixing playback cannot be obtained , Resulting in poor user experience.
  • an embodiment of the present application provides an audio playback method, which is applied to the above electronic device. Specifically, the method includes: S301 to S304.
  • the two wireless audio playback devices play different audio data, and the user can obtain the visual effect of mixing playback by listening to the audio data played by the two wireless audio playback devices at the same time.
  • the audio data played by the two wireless audio playback devices can be made the same, for example, the two audio data are the same song, and the two audio data are The sampling frequency, the number of sampling bits, the bit rate, and the corresponding content are all the same.
  • the same song is played on two wireless audio playback devices at different frequencies, and the frequency represents the tone of the sound, for example, one imitates the tone of a male voice and the other imitates the tone of a female voice, thereby Realize the effect of male and female duet.
  • the audio data played by two wireless audio playback devices can achieve the effect of stereo playback.
  • one wireless audio playback device is playing the left channel data of the audio data.
  • a wireless audio playback device is playing the right channel data of the audio data to achieve stereo playback of the audio data.
  • the audio data played by the two wireless audio playback devices are the same song and recorded as the target song.
  • the target song can be divided into left and right channel data, that is, left channel data and right channel data.
  • Both the channel data and the right channel data correspond to the target song, then one of the wireless audio playback devices plays the left channel data of the target song, and the other wireless audio playback device plays the right channel data of the target song, and the user listens to the target at the same time Audio data of the left and right channels of the song to achieve a stereo effect.
  • the wireless audio playback device may be a wireless headset, specifically, a Bluetooth headset.
  • the wireless audio playback device may also be a wireless speaker, for example, a Bluetooth speaker.
  • the effect of simultaneous translation can be achieved through the wireless speaker.
  • the electronic device After acquiring the first audio data, the electronic device generates second audio data according to the first audio data, wherein a language corresponding to the first audio data is different from a language corresponding to the second audio data.
  • the first audio data and the second audio data may correspond to different languages, or may correspond to the same language and different languages. For example, if the language corresponding to the first audio data is Chinese and the language corresponding to the second audio data is English, the first audio data and the second audio data correspond to different languages. For another example, the language corresponding to the first audio data is Cantonese , And the language corresponding to the second audio data is Mandarin, the first audio data and the second audio data correspond to the same language, but the corresponding languages are different
  • translation software is installed in the electronic device, and after acquiring the first audio data, the translation software is called to generate the first audio data into the second audio data. Then, the first audio data and the second audio data may be obtained in advance, for example, downloading the first audio data and the second audio data on a website. For example, if the content of the first audio data is "I am Chinese and I love my motherland", then the content of the second audio data is "I am Chinese, I love my country.” When “I am Chinese”, the second audio data starts playing, and when "I love my motherland" is played by the first audio data, the second audio data is also playing.
  • the first audio data is acquired in real time and continuously, and the second audio data is also acquired continuously in real time.
  • the time difference between the starting point of the second playback time can be set according to experience.
  • the time for a user to speak a sentence or a paragraph is a preset time.
  • the preset time can be statistically obtained according to the habits of the user, and the time difference N times the preset time, where N is a value greater than 0 and less than 1.
  • An implementation manner of determining that the two wireless audio playback devices are playing different audio data to implement mixed audio playback may be that the electronic device is connected to the first wireless audio playback device and the second wireless audio playback device at the same time, and the user is playing the When audio data is selected, the music to be played can be selected on the audio playback interface of the electronic device, as shown in the display interface of the electronic device shown in FIG. 1 and FIG. 2. Select one or more of the audio data and click the play button to play it. The selected audio data. In addition, the user can also select a wireless audio playback device for playing audio data through the electronic device.
  • a device management interface of an electronic device is shown.
  • an operation interface of two wireless audio playback devices connected to the electronic device is displayed, and specifically includes two wireless audio playback devices.
  • a device selection button which is a selection button corresponding to each device in FIG. 4, for example, when the round button is on the left, the electronic device selects a wireless audio playback device to play audio data. After the connection is established, the audio data played by the electronic device can play the audio data through the connected wireless audio playback device.
  • each wireless audio playback device also corresponds to a drop-down menu.
  • the user can configure the user's audio playback application for the wireless audio playback device through the drop-down menu. For example, configure the first audio data for device 1 as The device 2 is configured with the second audio data. If the electronic device can control the playback of the first audio data and control the playback of the second audio data, the device 1 can play the first audio data and the device 2 can play the second audio data. To achieve the effect of mixed playback.
  • the electronic device is connected to the first wireless audio playback device can be determined through the button status in the interface.
  • whether the device connected by the electronic device through Bluetooth is an audio playback device can be detected.
  • the type of the device currently connected via Bluetooth can be determined based on the return value obtained by instantiating the BluetoothClass.Device class.
  • the returned value is AUDIO_VIDEO_CAMCORDER, it is characterized as an image capture device; if the returned value is AUDIO_VIDEO_CAR_AUDIO, it is characterized as a car device; if the returned value is AUDIO_VIDEO_HIFI_AUDIO, it is characterized as an audio playback device or a video playback device, such as a Bluetooth headset; If the returned value is AUDIO_VIDEO_MICROPHONE, it indicates that it is a microphone.
  • the electronic device When it is determined that the electronic device is connected to the wireless audio playback device, that is, after the electronic device is connected to the wireless audio playback device, it is detected whether the electronic device has received a playback request, and the playback request is a request for playing audio data.
  • the electronic device is connected to the first wireless audio playback device and the first wireless audio playback device is selected as a device for playing audio data of the electronic device, it is determined whether a playback request for audio data of the data is obtained when the user operates the electronic device, and if Upon the playback request, it is determined that the electronic device is playing audio data through the first wireless audio playback device.
  • the playback request may be reminder information or a voice playback request.
  • the reminder information includes call reminder information, short message reminder information, and alarm reminder information to remind the user that certain events have been triggered.
  • the call reminder information is used to remind the user of an incoming call.
  • the playback request may be a request to play a voice each time during the sounding process of the electronic device.
  • the playback request may be an audio sound request, or a video sound request or a call sound request.
  • the software may be a music playback APP, a video playback APP, a recording APP, or the like.
  • the video playback interface is provided with a video playback button. By detecting the touch of the video playback button, it can be determined whether the electronic device currently receives a playback request for audio data. For example, the user selects a video, enters the video playback interface, and clicks.
  • the playback button of the playback interface allows the application to detect what type of video the user is currently clicking by monitoring the user ’s touch operation.
  • the playback button is set with preset attributes to detect the acquired touch
  • the user can determine the video to be played selected by the user, and then obtain a playback request and the audio corresponding to the playback request.
  • the electronic device By using the electronic device to configure the audio data to be played when the two wireless audio devices are played and the acquired playback request for the audio data, it can be determined whether the two wireless audio playback devices are currently playing different audio data to To achieve the effect of mixing playback. If yes, determine whether each of the wireless audio playback devices is in a preset state.
  • the preset state indicates a use state of the wireless audio playback device.
  • the preset state may be a wearing state, a working state, a connection state, or a usage.
  • the usage indicates a type of audio to be played by the wireless audio playback device, for example, for playback. Audio-only, call voice, or audio in video. Then, if the wireless audio playback device is in a preset state, it means that the user abandons using the wireless audio playback device to listen to the audio data being played, thereby abandoning the auditory effect of the mixed playback.
  • the working status of each of the wireless audio playback devices may be obtained. If the working status of the wireless audio playback device is offline, it is determined that the wireless audio playback device is in a preset state, otherwise, It is determined that the wireless audio playback device is not in a preset state.
  • the wireless audio playback device may be turned off, and the connection between the electronic device and the wireless audio playback device may be disconnected.
  • the failure of the communication link between the wireless audio playback device and the electronic device results in the connection between the electronic device and the wireless audio playback device being broken.
  • the electronic device sends a beacon to each wireless audio playback device, and determines whether a return result returned by the wireless audio playback device based on the received beacon is received within a preset time.
  • the return result sent by the wireless audio playback device is obtained, it is determined that the connection between the electronic device and the wireless audio playback device is not disconnected, that is, the working state of the wireless audio playback device is connected, otherwise, the work of the wireless audio playback device is determined
  • the status is offline. If the working state of the wireless audio playback device is offline, it is determined that the wireless audio playback device is in a preset state, and if the working state of the wireless audio playback device is connected, it is determined that the wireless audio playback device is not in a preset state .
  • whether the wireless audio playback device is in a preset state can also be determined according to the wearing state and the call status of the wireless audio playback device. For details, refer to the subsequent embodiments.
  • S302 Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
  • S303 Use the wireless audio playback device that is not in the preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
  • each wireless audio playback device determine whether it is in a preset state, use the wireless audio playback device in the preset state as the first wireless audio playback device, and use the wireless audio playback device that is not in the preset state as the second wireless audio.
  • a playback device wherein the audio data played by the first wireless audio playback device during the mixing playback is used as the first audio data, and the audio data played by the second wireless audio playback device during the mixing playback is used as the second audio data That is, the first audio data is used as a reference for the audio data played by the first wireless audio playback device during the mixing playback, and the second audio data is used as the second wireless audio playback device played during the mixing playback.
  • the reference of audio data is not a limitation on the audio data played by the first wireless audio playback device and the second wireless audio playback device.
  • the two wireless audio playback devices are not in a preset state, it means that the user is still using the two wireless audio playback devices to listen to the audio played by the mixed audio, and then the method ends or returns to execute S301.
  • both wireless audio playback devices are in a preset state, it means that the user has given up using the two wireless audio playback devices to listen to the audio, then the method is ended or the process returns to S301.
  • S304 Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
  • the second wireless audio playback device is controlled to continue to play the second audio data, and at the same time, the first audio data played by the first wireless audio playback device is also handed over to the second wireless audio playback device to play, so that the user can continue to pass
  • the second wireless audio playback device plays different audio data to achieve a mixing playback effect.
  • the first playback progress of the first audio data played by the first wireless audio playback device is recorded.
  • the first wireless audio playback device it is determined that the two wireless audio playback devices are in a preset state.
  • the wireless audio playback device is recorded, the time point at this time is recorded as the first time point, the playback progress of the first audio data corresponding to the first time point is determined as the first playback progress, and the second wireless audio playback device is controlled at the same time
  • a specific implementation manner of playing the first audio data and the second audio data is to control the second wireless audio playback device to continue playing the second audio data, and continue to play the first audio data at a first playback progress.
  • the first audio data and the second audio data are played, there is a corresponding relationship in time, for example, the two are played at the same time or the two are delayed for a certain time.
  • the first playback progress lag is acquired, it is determined that during the mixing playback, the second playback progress of the second audio data corresponding to the first playback progress of the second audio data is controlled, and the second wireless audio playback device is controlled to play simultaneously
  • a specific implementation manner of the first audio data and the second audio data is to control the second wireless audio playback device to play the second audio data at a second playback progress while continuing to play the first audio data at a first playback progress.
  • the wireless audio playback device is a wireless headset
  • the user wears a first wireless headset and a second wireless headset
  • the first wireless headset plays the left channel data of the target audio
  • the second wireless headset plays the target audio.
  • the right channel data, and the first wireless headset and the second wireless headset simultaneously play the target audio, then the user can listen to the stereo effect of the target audio through the first wireless headset and the second wireless headset.
  • the user can control the second wireless headset through the electronic device to continue playing the left channel data and the right channel data of the target audio to achieve the Two wireless headphones listen to stereo effects.
  • the Android recording generates a pcm file by default, that is, the Android stereo pcm data structure.
  • the recording type is AudioFormat.CHANNEL_IN_STEREO (stereo recording)
  • the data type is AudioFormat.ENCODING_PCM_16BIT
  • the data structure of the pcm file is roughly 2byte left channel, 2byte right channel, 2byte left channel, 2byte right channel .... Therefore, the Android stereo pcm data structure can be split into a left channel audio signal and a right channel.
  • Audio signal and transmit the left channel audio signal obtained after processing the split signal to the first wireless earphone input user's left ear, and transmit the right channel audio signal obtained after processing the split signal to the second wireless Headphone input into the user's right ear, which can improve the audio playback effect and user experience
  • the wireless audio playback device is a wireless headset.
  • the user wears two wireless headsets to play audio data. If one of the wireless headsets is taken off, the other wireless headset is controlled to play different audio data at the same time to achieve the effect of mixing playback.
  • FIG. 5 shows an audio playback method provided by another embodiment of the present application, which is applied to the above electronic device. Specifically, the method includes S501 to S505.
  • the wireless audio playback device is a Bluetooth headset
  • the Bluetooth headset includes a casing, a Bluetooth module, and a playback module.
  • the Bluetooth module and the playback module are both located in the casing, and the Bluetooth module is used to establish a connection with the electronic device. Connect the relationship and transfer data, etc., and the playback module is used to play the acquired audio data.
  • the case is provided with a contact sensor, which can detect the contact parameters entered by the user when contacting the case of the Bluetooth headset.
  • the contact sensor may be Pressure sensor, proximity light sensor, etc., the contact parameter may be a pressure value or an optical signal intensity value.
  • the contact parameters of the two Bluetooth headsets are obtained, and based on the contact parameters, the first Bluetooth headset and the second Bluetooth headset are determined. Wearing status of Bluetooth headset.
  • the first Bluetooth headset in contact with the user's left ear and the second Bluetooth in contact with the user's right ear can be determined from the two Bluetooth headsets. headset.
  • a Bluetooth headset is taken as an example for description.
  • the contact sensor of the Bluetooth headset is fixedly set at the target position of the headset body. When the Bluetooth headset is placed in the left ear of the user, the contact sensor can detect Contact area and contact point of the Bluetooth headset when the Bluetooth headset is placed in the user's right ear, the contact sensor can detect the contact point area and contact point between the user's right ear.
  • the contact parameters and the pre-stored Bluetooth headset can be placed.
  • the contact parameters of the user's left ear and the contact parameters of the Bluetooth headset placed in the user's right ear are compared to determine the placement position of the Bluetooth headset, that is, the Bluetooth headset is determined to be the first Bluetooth headset or the second Bluetooth headset.
  • another Bluetooth headset can also be determined as the first Bluetooth headset or the second Bluetooth headset in the above manner, so that it can be determined whether the two Bluetooth headsets are worn on the user's ear based on the contact parameters.
  • the ear it is determined that the wearing state of the Bluetooth headset is a worn state, and if it is not worn on the user's ear, it is determined that the wearing state of the Bluetooth headset is an unworn state.
  • first Bluetooth headset and the second Bluetooth headset are worn on the user's ear by the motion trajectory, and specifically detect the motion trajectory of the first Bluetooth headset and the motion trajectory of the second Bluetooth headset, respectively.
  • the Bluetooth headset further includes an acceleration sensor and / or a gyroscope, and the acceleration sensor and / or the gyroscope is disposed in the headset body, and is configured to detect the motion trajectory of the Bluetooth headset and send the detected motion trajectory.
  • the power supply device to detect the movement track of the Bluetooth headset.
  • the movement track of the first Bluetooth headset can be detected by a first acceleration sensor provided in the first Bluetooth headset and sent to the electronic device
  • the second Bluetooth headset can be detected by a second acceleration sensor provided in the second Bluetooth headset.
  • the motion trajectory of the first Bluetooth headset and the second trajectory of the second Bluetooth headset are monitored separately.
  • the gyroscope As an example, according to the gyroscope's axiality and the known preset attitude of the Bluetooth headset with respect to the rotation axis direction of the gyroscope, when a difference occurs between the attitude of the Bluetooth headset and the preset attitude, pitching occurs. , Yaw or roll movement in a certain direction, because the rotation axis of the gyroscope remains the same direction, it is possible to detect the change in the angle relationship between the Bluetooth headset lever with respect to the rotation axis and the angle relationship between the preset attitude and the rotation axis. Determine the attitude change of the Bluetooth headset, and determine the movement track of the Bluetooth headset.
  • the wearing state of the two Bluetooth headsets is determined based on the motion trajectories of the two Bluetooth headsets.
  • the first Bluetooth headset after detecting the motion trajectory of the first Bluetooth headset through an acceleration sensor and / or a gyroscope provided in the headset body of the first Bluetooth headset, it is determined whether the first Bluetooth headset is detached from the user based on the motion trajectory.
  • the motion trajectory of the first Bluetooth headset has a significant radian change, it can be considered that the first Bluetooth headset is detached from the user's left ear.
  • the motion trajectory of the first Bluetooth headset has no obvious radian change It can be considered that the first Bluetooth headset is not separated from the left ear of the user.
  • the second Bluetooth headset after detecting a motion trajectory of the second Bluetooth headset through an acceleration sensor and / or a gyroscope provided in the headset body of the second Bluetooth headset, it is determined whether the second Bluetooth headset is detached from the user based on the motion trajectory.
  • the motion trajectory of the second Bluetooth headset has a significant radian change, it can be considered that the second Bluetooth headset is detached from the user's right ear.
  • the motion trajectory of the second Bluetooth headset has no obvious radian change It can be considered that the second Bluetooth headset is not separated from the user's right ear.
  • S503 Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
  • S505 Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
  • the wireless audio playback device is a Bluetooth headset
  • the user wears a first Bluetooth headset and a second Bluetooth headset
  • the first Bluetooth headset plays the left channel data of the target audio
  • the second Bluetooth headset plays the target
  • the right channel data of the audio and the first Bluetooth headset and the second Bluetooth headset play the target audio at the same time
  • the user can listen to the stereo effect of the target audio through the first Bluetooth headset and the second Bluetooth headset.
  • the user can control the second Bluetooth headset through the electronic device to continue playing the left channel data and the right channel data of the target audio, so as to achieve a stereo effect through the second Bluetooth headset.
  • the user has a habit of answering calls using a Bluetooth headset.
  • the Bluetooth headset is in the wearing state at this time, the user may still give up using one of the Bluetooth headsets to listen to audio data and use it to answer the call.
  • FIG. 6, shows an audio playing method provided by another embodiment of the present application, which is applied to the above electronic device. Specifically, the method includes S601 to S606.
  • the audio playback request is used to play a preset type of audio.
  • the preset type of audio may be voice or audio in a video.
  • the preset type of audio is a voice call type. Audio.
  • the audio playback request input based on the application operated by the user can determine the type of audio corresponding to the audio playback request, for example, the audio playback input by the user clicking a certain audio or video playback button of the music playback software Request, the audio type corresponding to the audio playback request is pure audio or video.
  • the electronic device when the electronic device receives an incoming call, that is, when a telephone ringtone or a vibration reminder sounds, the electronic device can detect and display an incoming call interface on the screen. The user clicks the answer key in the incoming call interface to establish a call connection between the current number of the electronic device and the incoming call number.
  • the phone status of the electronic device can be monitored through the phone manager in the system of the electronic device, so that it can be monitored whether the electronic device is in a call mode.
  • the phone manager is an application module in the system of the electronic device, and the user obtains the call status of the electronic device. For example, when the system of the electronic device is an Android system, the phone manager is a TelephonyManager.
  • the answering interface is displayed, and the answering button is displayed on the answering interface.
  • the user can click the answering button to connect the call.
  • the ON button is clicked, an audio playback request input by the user is obtained, and the audio playback requests the user to play the voice of a call during the call of the electronic device, that is, a voice call type audio.
  • S602 If acquired, determine a wireless audio playback device corresponding to the audio playback request.
  • the user can play the audio data during the call through the default wireless headset.
  • the user sets the wireless headset for receiving the call through the electronic device, which can be two wireless headsets or one of them.
  • Wireless headset when the user clicks the answer button shown in Figure 7, an audio playback request will be input, and the call will be answered through the wireless headset set by default, that is, the wireless audio playback device corresponding to the audio playback request is a preset
  • the wireless audio playback device can determine the wireless audio playback device corresponding to the audio playback request.
  • the user when answering a call, the user can choose which wireless audio playback device to use to answer the call.
  • two answer buttons are provided on the interface, namely a first answer button and a second answer button, wherein the first answer button and the second answer button correspond to different wireless headsets, specifically
  • the first answer button corresponds to the wireless earphone worn on the left ear
  • the second answer button corresponds to the wireless earphone worn on the right ear.
  • the user can input an audio playback request by clicking one of the answer buttons, and the electronic device can determine the wireless headset corresponding to the audio playback request by detecting the first answer button and the second answer button.
  • S603 Determine the use state of the wireless audio playback device corresponding to the audio playback request as being in a preset state.
  • a user wants to use a certain wireless headset to play audio data during a call, it means that the wireless headset can no longer be used to listen to the mix playback, but needs to play the audio data during the call, then it is determined that the wireless playback corresponding to the audio playback request
  • the use state of the audio playback device is determined to be in a preset state, and the other wireless headset is deemed not to be in a predetermined state.
  • the wireless audio playback device when it is determined that the wearing state of the wireless audio playback device is an unworn state, it is determined that the wireless audio playback device is in a preset state, and if the wearing state of the wireless audio playback device is a worn state, the wireless audio device is determined again. Whether the playback device wants to play a preset type of audio.
  • the first Bluetooth headset and the second Bluetooth headset as an example, if the first Bluetooth headset is taken off, that is, it is in an unworn state, it is determined whether the second Bluetooth headset wants to play a preset type of audio, and if so, then The subsequent steps S604 to S606 are not performed because the playback priority of the preset type of audio is higher, for example, the audio call type audio has the highest playback level, and other types of audio data can be prioritized and played first.
  • the wearing status of each of the wireless audio playback devices is acquired. If the wearing state is the non-wearing state, it is determined that the wireless audio playback device is in a preset state; otherwise, it is detected whether an audio playback request is obtained, and the audio playback request is used to play a preset type of audio.
  • the wireless audio playback device corresponding to the audio playback request if the use status of the wireless audio playback device corresponding to the audio playback request is a worn state, the method is ended, otherwise, the process continues to S604.
  • the two wireless headsets before detecting whether an audio playback request is obtained, it may be determined whether the two wireless headsets are in a wearing state. Specifically, when two wireless audio playback devices are playing different audio data, In order to achieve mixing playback, the wearing status of each of the wireless audio playback devices is acquired. If the wearing status of each of the wireless audio playback devices is a worn status, it is detected whether an audio playback request is obtained, and the audio The playback request is used to play a preset type of audio; if it is obtained, a wireless audio playback device corresponding to the audio playback request is determined; a use state of the wireless audio playback device corresponding to the audio playback request is determined to be in a preset state.
  • S604 Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
  • S606 Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
  • the wireless audio playback device is a Bluetooth headset
  • the user wears a first Bluetooth headset and a second Bluetooth headset
  • the first Bluetooth headset plays the left channel data of the target audio
  • the second Bluetooth headset plays the target
  • the right channel data of the audio and the first Bluetooth headset and the second Bluetooth headset play the target audio at the same time, the user can listen to the stereo effect of the target audio through the first Bluetooth headset and the second Bluetooth headset.
  • the user can control the second Bluetooth headset through the electronic device to continue playing the left channel data and the right channel data of the target audio to achieve the
  • the second Bluetooth headset listens to the stereo effect, and the first Bluetooth headset can play audio during a call, so that the user can play stereo audio while receiving a call.
  • the playback volume of the second wireless audio playback device needs to be adjusted. Specifically, controlling the second wireless audio device The audio playback device plays the first audio data and the second audio data at the same time to realize the mixed playback, including: reducing the playback volume of the second wireless audio playback device, and controlling the second wireless audio playback device to reduce the playback after The volume plays the first audio data and the second audio data at the same time to achieve mixed playback.
  • the electronic device sends a volume acquisition request to the second wireless audio playback device.
  • the volume acquisition request feedbacks the playback volume of the second wireless audio playback device.
  • an audio playback client is provided in the electronic device, the audio playback client requests to play audio data, and the user can adjust the playback volume of the audio data of the mixed playback through the audio playback client, that is, can Set the playback volume when the first wireless audio playback device or the second wireless audio playback device plays audio data.
  • the playback volume when the electronic device plays a preset type of audio, that is, the call volume during a call, and determine the relationship between the two. If the playback volume of the second wireless audio playback device is greater than that of the first wireless audio playback device, When the playback volume is set for the type of audio, the playback volume of the second wireless audio playback device is reduced.
  • the first wireless audio playback device and the second wireless audio playback device both play audio data at a first volume to achieve the effect of mixing playback. Then, when a user uses the first wireless audio playback device to answer a call, If the call volume is the second volume, the difference between the first volume and the second volume is obtained. Based on the difference, the relationship between the first volume and the second volume can be determined.
  • the first volume is The volume reduction may be specifically lowering the first volume to be lower than the second volume, more specifically, it may be to obtain half of the absolute value of the volume difference between zero and the second volume, and record it as the third volume. One volume is adjusted to the second volume.
  • the user can listen to the audio data of the mixed audio while receiving the call, and the volume of the audio data of the mixed audio playback is lower than the volume of the call of the received telephone, so that the user does not overdo the audio data played by the audio mixing. Too big to hear the voice during a call.
  • FIG. 9 shows a structural block diagram of an audio playback device 900 according to an embodiment of the present application.
  • the device may include a detection unit 901, a first determination unit 902, a second determination unit 903, and a playback unit 904.
  • a detecting unit 901 is configured to determine whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to implement mixed audio playback.
  • the first determining unit 902 is configured to use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data .
  • a second determining unit 903 is configured to use a wireless audio playback device that is not in a preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
  • the playback unit 904 is configured to control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
  • the coupling between the modules may be electrical, mechanical, or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist separately physically, or two or more modules may be integrated into one module.
  • the above integrated modules may be implemented in the form of hardware or software functional modules.
  • the electronic device 100 may be an electronic device capable of running an application program, such as a smart phone, a tablet computer, or an e-book.
  • the electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, a Bluetooth module 140, and one or more application programs.
  • One or more of the application programs may be stored in the memory 120 and stored in the memory 120. It is configured to be executed by one or more processors 110, and one or more programs are configured to execute the method as described in the foregoing method embodiment.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts in the entire electronic device 100, and executes or executes instructions, programs, code sets, or instruction sets stored in the memory 120 by calling or executing data stored in the memory 120 to execute Various functions and processing data of the electronic device 100.
  • the processor 110 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). To implement a hardware form.
  • the processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem modem
  • the CPU mainly handles the operating system, user interface, and application programs; the GPU is responsible for rendering and rendering of the displayed content; the modem is used for wireless communication. It can be understood that the modem may not be integrated into the processor 110, and may be implemented by a single communication chip.
  • the memory 120 may include Random Access Memory (RAM), and may also include Read-Only Memory.
  • the memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets.
  • the memory 120 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , Instructions for implementing the following method embodiments, and the like.
  • the storage data area may also store data (such as phonebook, audio and video data, and chat history data) created by the terminal 100 during use.
  • the Bluetooth module 140 is configured to implement a Bluetooth connection between the electronic device and the Bluetooth device, and data interaction with the Bluetooth device. Specifically, it can communicate with Bluetooth devices through the Bluetooth protocol 5.0 / 4.2 / 4.1 / 2.1 / 2.0, or through Bluetooth Low Energy (BLE), Enhanced Data Rate (EDR), or Bluetooth basic rate. (Base, Rate, BR) and so on.
  • the Bluetooth module 140 may include a power amplifier, a wireless transceiver, a transceiver switch, a low-noise amplifier, and an antenna.
  • the transceiver When transmitting a signal, the transceiver itself will output a weak RF signal of low power directly, send it to a Power Amplifier (PA) for power amplification, and then radiate it to the antenna via Antenna through the Transmit / Receive Switch. space.
  • PA Power Amplifier
  • the antenna When receiving a signal, the antenna will sense the electromagnetic signal in the space, and then send it to a Low Noise Amplifier (LNA) for amplification after switching, so that the amplified signal can be sent directly to the transceiver for processing.
  • LNA Low Noise Amplifier
  • the Bluetooth module 140 can use the 2.4 GHz frequency band.
  • FIG. 11 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 1100 stores program code, and the program code can be called by a processor to execute a method described in the foregoing method embodiment.
  • the computer-readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM.
  • the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 1100 has a storage space of a program code 1110 for performing any of the method steps in the above method. These program codes can be read from or written into one or more computer program products.
  • the program code 1110 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Circuit For Audible Band Transducer (AREA)
  • Telephone Function (AREA)

Abstract

Disclosed are an audio playing method and apparatus, an electronic device and a computer-readable medium, relating to the technical field of communications. The method comprises: when two wireless audio playing devices are playing different audio data to realize mixed playing, determining whether each of the wireless audio playing devices is in a preset state; taking the wireless audio playing device in the preset state as a first wireless audio playing device, and taking the audio data played by same as first audio data; taking the wireless audio playing device not in the preset state as a second wireless audio playing device, and taking the audio data played by same as second audio data; and controlling the second wireless audio playing device to play the first audio data and the second audio data simultaneously so as to realize mixed playing. Therefore, even if a user gives up using one of the wireless audio playing devices to listen to the audio data, the other wireless audio playing device can also play the two pieces of audio data simultaneously to achieve the effect of mixed playing.

Description

音频播放方法、装置、电子设备及计算机可读介质Audio playing method, device, electronic equipment and computer-readable medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2018年9月30日提交中国专利局的申请号为CN201811161376.5、名称为“音频播放方法、装置、电子设备及计算机可读介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 30, 2018 under the application number CN201811161376.5 and entitled "Audio Playback Method, Device, Electronic Equipment, and Computer-readable Media", its entire content Incorporated by reference in this application.
技术领域Technical field
本申请涉及通信技术领域,更具体地,涉及一种音频播放方法、装置、电子设备及计算机可读介质。The present application relates to the field of communication technologies, and more particularly, to an audio playback method, device, electronic device, and computer-readable medium.
背景技术Background technique
目前,使用无线音频播放设备播放电子设备内的音频数据,能够减少有线耳机所带来的不便,而且,电子设备能够同时连接两个无线音频播放设备,两个无线音频播放设备能够实现音频的混合播放效果。但是,如果用户放弃使用其中一个无线音频播放设备收听音频时,用户会无法收听到音频的混合播放效果,导致用户体验过差。At present, the use of wireless audio playback devices to play audio data in electronic devices can reduce the inconvenience caused by wired headphones. Moreover, electronic devices can connect two wireless audio playback devices at the same time, and two wireless audio playback devices can achieve audio mixing. Play effect. However, if the user abandons using one of the wireless audio playback devices to listen to the audio, the user will not be able to hear the mixed playback effect of the audio, resulting in a poor user experience.
发明内容Summary of the Invention
本申请提出了一种音频播放方法、装置、电子设备及计算机可读介质,以改善上述缺陷。The present application proposes an audio playback method, device, electronic device, and computer-readable medium to improve the above defects.
第一方面,本申请实施例提供了一种音频播放方法,应用于电子设备,所述电子设备能够同时连接两个无线音频播放设备。该方法包括:当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态;将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据;将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据;控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。In a first aspect, an embodiment of the present application provides an audio playback method, which is applied to an electronic device that can connect two wireless audio playback devices at the same time. The method includes: determining whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to achieve mixed audio playback; Device as the first wireless audio playback device, the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data; the wireless audio playback device that is not in the preset state is used as the second wireless audio A playback device, the audio data played by the second wireless audio playback device during mixing playback is second audio data; and controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time, so that Realize mixed playback.
第二方面,本申请实施例还提供了一种音频播放装置,应用于电子设备,所述电子设备能够同时连接两个无线音频播放设备。所述音频播放装置包括:检测单元、第一确定单元、第二确定单元和播放单元。检测单元,用于当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态。第一确定单元,用于将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据。第二确定单元,用于将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据。播放单元,用于控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。In a second aspect, an embodiment of the present application further provides an audio playback device, which is applied to an electronic device, and the electronic device can be connected to two wireless audio playback devices at the same time. The audio playback device includes a detection unit, a first determination unit, a second determination unit, and a playback unit. A detection unit is configured to determine whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to implement mixed audio playback. The first determining unit is configured to use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data. A second determining unit, configured to use a wireless audio playback device that is not in a preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data . The playback unit is configured to control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement the mixed audio playback.
第三方面,本申请实施例还提供了一种电子设备,包括:一个或多个处理器,所述一个或多个处理器能够同时连接两个无线音频播放设备;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述方法。According to a third aspect, an embodiment of the present application further provides an electronic device, including: one or more processors capable of simultaneously connecting two wireless audio playback devices; a memory; and one or more applications A program, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the above method.
第四方面,本申请实施例还提供了一种具有处理器可执行的程序代码的计算机可读介质,所述程序代码使所述处理器执行上述方法。In a fourth aspect, an embodiment of the present application further provides a computer-readable medium having a processor-executable program code, where the program code causes the processor to perform the foregoing method.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present application more clearly, the drawings used in the description of the embodiments are briefly introduced below. Obviously, the drawings in the following description are just some embodiments of the application. For those skilled in the art, other drawings can be obtained based on these drawings without paying creative labor.
图1示出了本申请一实施例提供的语音系统的模块框图;FIG. 1 shows a module block diagram of a voice system provided by an embodiment of the present application;
图2示出了本申请另一实施例提供的语音系统的模块框图;FIG. 2 shows a block diagram of a voice system according to another embodiment of the present application;
图3示出了本申请一实施例提供的一种音频播放方法的方法流程图;FIG. 3 shows a method flowchart of an audio playback method according to an embodiment of the present application;
图4示出了本申请实施例提供的设备管理界面的示意图;FIG. 4 is a schematic diagram of a device management interface according to an embodiment of the present application; FIG.
图5示出了本申请另一实施例提供的一种音频播放方法的方法流程图;FIG. 5 shows a method flowchart of an audio playback method according to another embodiment of the present application;
图6示出了本申请又一实施例提供的一种音频播放方法的方法流程图FIG. 6 shows a method flowchart of an audio playback method according to another embodiment of the present application
图7示出了本申请一实施例提供的接听界面的示意图;FIG. 7 is a schematic diagram of an answering interface provided by an embodiment of the present application; FIG.
图8示出了本申请另一实施例提供的接听界面的示意图;FIG. 8 is a schematic diagram of an answering interface provided by another embodiment of the present application; FIG.
图9示出了本申请实施例提供的一种音频播放装置的模块框图;FIG. 9 shows a module block diagram of an audio playback device according to an embodiment of the present application;
图10示出了本申请实施例提供的电子设备的模块框图;FIG. 10 shows a module block diagram of an electronic device according to an embodiment of the present application; FIG.
图11示出了本申请实施例提供的用于保存或者携带实现根据本申请实施例的音频播放方法的程序代码的存储单元。FIG. 11 illustrates a storage unit for storing or carrying a program code for implementing an audio playing method according to an embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
随着音频播放设备的种类增多以及播放音效的提升,更多的用户会选择将手机、平板电脑等电子设备待播放的音频输出到音频播放设备进行播放。其中,常见的音频播放设备包括车载音乐播放器、音箱以及耳机等。With the increase in the types of audio playback devices and the improvement of playback sound effects, more users will choose to output audio to be played by electronic devices such as mobile phones and tablets to the audio playback device for playback. Among them, common audio playback devices include car music players, speakers, and headphones.
而音频播放设备根据连接方式不同,可以分为有线音频播放设备和无线音频播放设备,则电子设备可以与无线音频播放设备之间通过无线网络进行交互以传输信号,其中,该无线网络可以是蓝牙、wifi、LTE网络或者NFC等等。According to different connection methods, audio playback devices can be divided into wired audio playback devices and wireless audio playback devices. The electronic device can interact with the wireless audio playback device through a wireless network to transmit signals. The wireless network may be Bluetooth. , Wifi, LTE network or NFC, etc.
示例性地,如图1所示,示出了本申请实施例提供的语音系统的模块图。具体地,该语音系统包括电子设备100、第一无线音频播放设备210和第二无线音频播放设备220,电子设备100能够同时与第一无线音频播放设备210和第二无线音频播放设备220连接。Exemplarily, as shown in FIG. 1, a block diagram of a voice system provided by an embodiment of the present application is shown. Specifically, the voice system includes an electronic device 100, a first wireless audio playback device 210, and a second wireless audio playback device 220. The electronic device 100 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220 at the same time.
在本发明实施例中,电子设备100内安装有能够播放音频的应用程序,具体地,该应用程序可以是音频播放软件、视频播放软件或者通话软件等。电子设备100将需要播放的音频发送给第一无线音频播放设备210或第二无线音频播放设备220,由第一无线音频播放设备210或第二无线音频播放设备220播放语音。In the embodiment of the present invention, an application capable of playing audio is installed in the electronic device 100. Specifically, the application may be audio playing software, video playing software, or calling software. The electronic device 100 sends the audio to be played to the first wireless audio playback device 210 or the second wireless audio playback device 220, and the first wireless audio playback device 210 or the second wireless audio playback device 220 plays the voice.
本发明实施例中,第一无线音频播放设备210和第二无线音频播放设备220均可以是蓝牙音响或者蓝牙耳机,第一无线音频播放设备210和第二无线音频播放设备220可以通过开启蓝牙功能实现与电子设备100的连接,且在建立连接之后,电子设备100将其需要播放的语音发送给蓝牙音响,由蓝牙音响实现语音播放。In the embodiment of the present invention, the first wireless audio playback device 210 and the second wireless audio playback device 220 may both be Bluetooth speakers or Bluetooth headsets. The first wireless audio playback device 210 and the second wireless audio playback device 220 may be enabled with the Bluetooth function. A connection with the electronic device 100 is achieved, and after the connection is established, the electronic device 100 sends the voice that it needs to play to the Bluetooth audio, and the Bluetooth audio implements voice playback.
当第一无线音频播放设备210和第二无线音频播放设备220均为蓝牙设备时,电子设备100能够通过蓝牙模块同时与第一无线音频播放设备210和第二无线音频播放设备220连接,作为一种实施方式,可以是电子设备内的蓝牙模块可以支持多点连接,从而能够实现图1所示的电子设备分别与第一无线音频播放设备210和第二无线音频播放设备220连接,则在建立连接之后,电子设备100能够获取到第一无线音频播放设备210和第二无线音频播放设备220的标识,该标识可以是MAC地址。具体地,当电子设备的蓝牙功能开启的时候,电子设备会对周围一定距离范围内的蓝牙设备扫描,具体地,由电子设备的蓝牙芯片或者其他底层网络模块接收到扫描命令后,按照预设的信道扫描顺序进行扫描,如先扫描常用信道1、7、13信道,再扫描其他的非常用信道,由此获得当前范围内的所有蓝牙设备的标识,并显示在电子设备的蓝牙列表界面内。When the first wireless audio playback device 210 and the second wireless audio playback device 220 are both Bluetooth devices, the electronic device 100 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220 through the Bluetooth module at the same time. In an implementation manner, the Bluetooth module in the electronic device may support multipoint connection, so that the electronic device shown in FIG. 1 can be connected to the first wireless audio playback device 210 and the second wireless audio playback device 220, respectively. After the connection, the electronic device 100 can obtain the identities of the first wireless audio playback device 210 and the second wireless audio playback device 220, and the identifications may be MAC addresses. Specifically, when the Bluetooth function of the electronic device is turned on, the electronic device scans the Bluetooth devices within a certain distance from the surrounding area. Specifically, after receiving the scan command from the electronic device's Bluetooth chip or other underlying network module, the preset Scan in the order of channel scanning. For example, scan the common channels 1, 7, and 13 first, and then scan the other unused channels, so as to obtain the identification of all Bluetooth devices in the current range and display them in the Bluetooth list interface of the electronic device. .
如果在所扫描到的蓝牙设备的标识中存在已经连接过且信号强度较好的蓝牙设备,电子设备会自动与该蓝牙设备连接,则用户也可以在蓝牙列表界面内选择一个蓝牙设备进行连接。If there is a connected Bluetooth device with a better signal strength in the scanned Bluetooth device identification, the electronic device will automatically connect with the Bluetooth device, and the user can also select a Bluetooth device in the Bluetooth list interface to connect.
当电子设备与外部的蓝牙设备连接时,则电子设备的系统会获取到一个状态值,该状态值表示电子设备当前已经连接蓝牙设备。从而,电子设备能够检测到已经蓝牙设备,从而获取到蓝牙设备的设备标识。When the electronic device is connected to an external Bluetooth device, the system of the electronic device obtains a status value, which indicates that the electronic device is currently connected to the Bluetooth device. Therefore, the electronic device can detect that the Bluetooth device is already present, and thereby obtain the device identification of the Bluetooth device.
作为另一种实施方式,如图2所示,电子设备100与第一无线音频播放设备210通过蓝牙连接, 然后,第一无线音频播放设备210再通过蓝牙和第二无线音频播放设备220连接,从而,电子设备100、第一无线音频播放设备210和第二无线音频播放设备220通过组网的方式实现同时连接,即第一无线音频播放设备210作为电子设备100和第二无线音频播放设备220的中继器。As another implementation manner, as shown in FIG. 2, the electronic device 100 is connected to the first wireless audio playback device 210 through Bluetooth, and then the first wireless audio playback device 210 is connected to the second wireless audio playback device 220 through Bluetooth. Therefore, the electronic device 100, the first wireless audio playback device 210, and the second wireless audio playback device 220 are simultaneously connected through networking, that is, the first wireless audio playback device 210 serves as the electronic device 100 and the second wireless audio playback device 220. Repeater.
因此,在电子设备100同时与第一无线音频播放设备210和第二无线音频播放设备220连接之后,可以实现不同的音频播放设备播放不同的音频数据,当然,也可以是不同的音频播放设备播放相同的音频数据,以实现立体声等效果。也可以是使用其中一个无线音频播放设备播放音频数据,而另一个无线音频播放设备处于待机状态而不播放音频。Therefore, after the electronic device 100 is connected to the first wireless audio playback device 210 and the second wireless audio playback device 220 at the same time, different audio playback devices can play different audio data. Of course, it can also be played by different audio playback devices. Same audio data to achieve effects like stereo. It is also possible to use one of the wireless audio playback devices to play audio data while the other wireless audio playback device is on standby without playing audio.
但是,发明人在研究中发现,当用户放弃使用其中一个无线音频播放设备收听音频数据时,由于无法同时收听到两个无线音频播放设备所播放的音频数据,则无法获取到混音播放的效果,导致用户体验度不高。However, the inventor found in the research that when the user abandons using one of the wireless audio playback devices to listen to the audio data, because the audio data played by the two wireless audio playback devices cannot be heard at the same time, the effect of mixing playback cannot be obtained , Resulting in poor user experience.
因此,为了解决上述技术缺陷,本申请实施例提供了一种音频播放方法,应用于上述电子设备,具体地,该方法包括:S301至S304。Therefore, in order to solve the above technical defects, an embodiment of the present application provides an audio playback method, which is applied to the above electronic device. Specifically, the method includes: S301 to S304.
S301:当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态。S301: When two of the wireless audio playback devices are playing different audio data to achieve mixed audio playback, determine whether each of the wireless audio playback devices is in a preset state.
其中,两个无线音频播放设备播放不同的音频数据,用户同时收听两个无线音频播放设备所播放的音频数据,就能够获得到混音播放的视觉效果。例如,为了使用户在播放音乐的时候,实现音乐的重唱的特效,可以使两个无线音频播放设备所播放的音频数据相同,例如,两个音频数据为同一首歌曲,且两个音频数据的采样频率、采样位数、位速以及对应的内容都是相同的。Among them, the two wireless audio playback devices play different audio data, and the user can obtain the visual effect of mixing playback by listening to the audio data played by the two wireless audio playback devices at the same time. For example, in order to enable the user to realize the special effect of music replay when playing music, the audio data played by the two wireless audio playback devices can be made the same, for example, the two audio data are the same song, and the two audio data are The sampling frequency, the number of sampling bits, the bit rate, and the corresponding content are all the same.
由此,用户在播放歌曲的时候,相同的歌曲分别在两个无线音频播放设备以不同的频率播放,而频率代表声音的音调,例如,一个模仿男声的音调,另一个模仿女声的音调,从而实现男女二重唱的效果。Therefore, when a user plays a song, the same song is played on two wireless audio playback devices at different frequencies, and the frequency represents the tone of the sound, for example, one imitates the tone of a male voice and the other imitates the tone of a female voice, thereby Realize the effect of male and female duet.
再例如,两个无线音频播放设备所播放的音频数据能够实现立体声播放的效果,具体地,两个所述无线音频播放设备中,一个无线音频播放设备正在播放音频数据的左声道数据,另一个无线音频播放设备正在播放所述音频数据的右声道数据以实现所述音频数据的立体声播放。具体地,两个无线音频播放设备所播放的音频数据都是同一首歌曲,记为目标歌曲,则目标歌曲可以分为左右声道的数据,即左声道数据和右声道数据,且左声道数据和右声道数据都对应目标歌曲,则其中一个无线音频播放设备播放目标歌曲的左声道数据,另一个无线音频播放设备播放目标歌曲的右声道数据,则用户同时收听到目标歌曲的左右声道的音频数据,实现立体声效果。For another example, the audio data played by two wireless audio playback devices can achieve the effect of stereo playback. Specifically, among the two wireless audio playback devices, one wireless audio playback device is playing the left channel data of the audio data. A wireless audio playback device is playing the right channel data of the audio data to achieve stereo playback of the audio data. Specifically, the audio data played by the two wireless audio playback devices are the same song and recorded as the target song. The target song can be divided into left and right channel data, that is, left channel data and right channel data. Both the channel data and the right channel data correspond to the target song, then one of the wireless audio playback devices plays the left channel data of the target song, and the other wireless audio playback device plays the right channel data of the target song, and the user listens to the target at the same time Audio data of the left and right channels of the song to achieve a stereo effect.
作为一种实施方式,为了更好的实现上述的二重唱和立体声效果,则无线音频播放设备可以是无线耳机,具体地,可以是蓝牙耳机。As an implementation manner, in order to better implement the duet and stereo effects described above, the wireless audio playback device may be a wireless headset, specifically, a Bluetooth headset.
作为另一种实施方式,上述无线音频播放设备还可以是无线音箱,例如,可以是蓝牙音箱。则可以通过该无线音箱实现同声翻译的效果,具体地,As another implementation manner, the wireless audio playback device may also be a wireless speaker, for example, a Bluetooth speaker. The effect of simultaneous translation can be achieved through the wireless speaker. Specifically,
电子装置在获取到第一音频数据之后,根据该第一音频数据生成第二音频数据,其中,第一音频数据对应的语言与第二音频数据对应的语言不同。其中,第一音频数据和第二音频数据可以对应不同的语种,也可以对应相同的语种而语言不同。例如,第一音频数据对应的语言是中文,而第二音频数据对应的语言是英语,则第一音频数据和第二音频数据对应不同的语种,再例如,第一音频数据对应的语言是粤语,而第二音频数据对应的语言是普通话,则第一音频数据和第二音频数据对应相同的语种,但是所对应的语言不同After acquiring the first audio data, the electronic device generates second audio data according to the first audio data, wherein a language corresponding to the first audio data is different from a language corresponding to the second audio data. The first audio data and the second audio data may correspond to different languages, or may correspond to the same language and different languages. For example, if the language corresponding to the first audio data is Chinese and the language corresponding to the second audio data is English, the first audio data and the second audio data correspond to different languages. For another example, the language corresponding to the first audio data is Cantonese , And the language corresponding to the second audio data is Mandarin, the first audio data and the second audio data correspond to the same language, but the corresponding languages are different
具体地,电子装置内安装有翻译软件,在获取到第一音频数据之后,调用所述翻译软件,将第一音频数据生成第二音频数据。然后,还可以是,第一音频数据和第二音频数据为预先获取的,例如,在某个网站上下载第一音频数据和第二音频数据。例如,第一音频数据的内容为“我是中国人,我爱我的祖国”,则第二音频数据的内容为“I am Chinese,I love my country.”,则可以在第一音频数据播放到“我是中国人”的时候,第二音频数据开始播放,则第一音频数据所播放“我爱我的祖国”的时候,第二音频数据也在播放。Specifically, translation software is installed in the electronic device, and after acquiring the first audio data, the translation software is called to generate the first audio data into the second audio data. Then, the first audio data and the second audio data may be obtained in advance, for example, downloading the first audio data and the second audio data on a website. For example, if the content of the first audio data is "I am Chinese and I love my motherland", then the content of the second audio data is "I am Chinese, I love my country." When "I am Chinese", the second audio data starts playing, and when "I love my motherland" is played by the first audio data, the second audio data is also playing.
需要说明的是,考虑到两个用户在语音聊天的时候,第一音频数据的获取是实时且持续获取的,而第二音频数据也是实时持续获取的,则第一播放时间起点与所述第二播放时间起点之间的时间差可以根据经验而设置,作为一种实施方式,用户讲一句话或者一段话的时间为预设时间,该预设时间可以根据用户的习惯而统计获得,而该时间差为该预设时间的N倍,其中,N为大于0而小于1之间的数值。It should be noted that, when two users are in a voice chat, the first audio data is acquired in real time and continuously, and the second audio data is also acquired continuously in real time. The time difference between the starting point of the second playback time can be set according to experience. As an implementation, the time for a user to speak a sentence or a paragraph is a preset time. The preset time can be statistically obtained according to the habits of the user, and the time difference N times the preset time, where N is a value greater than 0 and less than 1.
而确定两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放的实施方式可以是,电子设备同时与第一无线音频播放设备和第二无线音频播放设备连接,则用户在播放音频数据 的时候,能够在电子设备的音频播放界面选中要播放的音乐,如图1和图2所示的电子设备的显示的界面,选中其中一个或者多个音频数据,点击播放按钮就能够播放所选中的音频数据。另外,用户还能够通过电子设备选中用于播放音频数据的无线音频播放设备。An implementation manner of determining that the two wireless audio playback devices are playing different audio data to implement mixed audio playback may be that the electronic device is connected to the first wireless audio playback device and the second wireless audio playback device at the same time, and the user is playing the When audio data is selected, the music to be played can be selected on the audio playback interface of the electronic device, as shown in the display interface of the electronic device shown in FIG. 1 and FIG. 2. Select one or more of the audio data and click the play button to play it. The selected audio data. In addition, the user can also select a wireless audio playback device for playing audio data through the electronic device.
例如,图4所示,示出了电子设备的设备管理界面,在该设备管理界面内,显示有电子设备所连接的两个无线音频播放设备的操作界面,具体地,包括两个无线音频播放设备的选择按钮,图4中的每个设备对应的选择按钮,例如,在圆形按钮位于左侧时,电子设备选中无线音频播放设备播放音频数据。则在建立连接之后,电子设备所播放的音频数据就能够通过所连接的无线音频播放设备播放该音频数据。For example, as shown in FIG. 4, a device management interface of an electronic device is shown. In the device management interface, an operation interface of two wireless audio playback devices connected to the electronic device is displayed, and specifically includes two wireless audio playback devices. A device selection button, which is a selection button corresponding to each device in FIG. 4, for example, when the round button is on the left, the electronic device selects a wireless audio playback device to play audio data. After the connection is established, the audio data played by the electronic device can play the audio data through the connected wireless audio playback device.
另外,在该界面内,每个无线音频播放设备还对应一个下拉菜单,用户能够通过该下拉菜单为无线音频播放设备配置用户播放音频的应用程序,例如,为设备1配置第一音频数据,为设备2配置第二音频数据,则在如果电子设备能够分别控制第一音频数据播放以及控制第二音频数据播放,就能够使得设备1播放第一音频数据,而使设备2播放第二音频数据,以实现混合播放的效果。In addition, in this interface, each wireless audio playback device also corresponds to a drop-down menu. The user can configure the user's audio playback application for the wireless audio playback device through the drop-down menu. For example, configure the first audio data for device 1 as The device 2 is configured with the second audio data. If the electronic device can control the playback of the first audio data and control the playback of the second audio data, the device 1 can play the first audio data and the device 2 can play the second audio data. To achieve the effect of mixed playback.
因此,通过该界面内的按钮状态能够确定电子设备是否与第一无线音频播放设备连接,另外,还可以对电子设备通过蓝牙连接的设备是否为音频播放设备进行检测,其中,在基于android操作系统的电子设备中,可以通过基于实例化BluetoothClass.Device类所得到的返回值来确定当前通过蓝牙连接的设备类型。若返回的值为AUDIO_VIDEO_CAMCORDER,则表征为图像采集设备;若返回的值为AUDIO_VIDEO_CAR_AUDIO,则表征为车载设备;若返回的值为AUDIO_VIDEO_HIFI_AUDIO,则表征为音频播放设备或者视频播放设备,例如,蓝牙耳机;若返回的值为AUDIO_VIDEO_MICROPHONE,则表征其为麦克风。Therefore, whether the electronic device is connected to the first wireless audio playback device can be determined through the button status in the interface. In addition, whether the device connected by the electronic device through Bluetooth is an audio playback device can be detected. In an electronic device, the type of the device currently connected via Bluetooth can be determined based on the return value obtained by instantiating the BluetoothClass.Device class. If the returned value is AUDIO_VIDEO_CAMCORDER, it is characterized as an image capture device; if the returned value is AUDIO_VIDEO_CAR_AUDIO, it is characterized as a car device; if the returned value is AUDIO_VIDEO_HIFI_AUDIO, it is characterized as an audio playback device or a video playback device, such as a Bluetooth headset; If the returned value is AUDIO_VIDEO_MICROPHONE, it indicates that it is a microphone.
在确定电子设备连接无线音频播放设备的时候,也就是说,在电子设备连接无线音频播放设备之后,检测电子设备是否接收到播放请求,该播放请求为用于请求播放音频数据的请求,则如果在电子设备与第一无线音频播放设备连接,并且选中第一无线音频播放设备作为播放电子设备的音频数据的设备时,确定是否获取到用户操作电子设备而数据的音频数据的播放请求,如果获取到播放请求,则就确定电子设备在通过第一无线音频播放设备播放音频数据。When it is determined that the electronic device is connected to the wireless audio playback device, that is, after the electronic device is connected to the wireless audio playback device, it is detected whether the electronic device has received a playback request, and the playback request is a request for playing audio data. When the electronic device is connected to the first wireless audio playback device and the first wireless audio playback device is selected as a device for playing audio data of the electronic device, it is determined whether a playback request for audio data of the data is obtained when the user operates the electronic device, and if Upon the playback request, it is determined that the electronic device is playing audio data through the first wireless audio playback device.
具体地,播放请求可以是提醒信息,也可以是语音播放请求。其中,提醒信息包括通话提醒信息、短信提醒信息以及闹铃提醒信息等用于提醒用户某些事件已经触发的信息。例如,通话提醒信息用于提醒用户当前有来电。Specifically, the playback request may be reminder information or a voice playback request. The reminder information includes call reminder information, short message reminder information, and alarm reminder information to remind the user that certain events have been triggered. For example, the call reminder information is used to remind the user of an incoming call.
作为另一种实施方式,播放请求可以是在电子设备发声的过程中,每次播放语音的请求。则该播放请求可以是音频发声请求,也可以是视频发声请求或者通话发声请求。As another implementation manner, the playback request may be a request to play a voice each time during the sounding process of the electronic device. The playback request may be an audio sound request, or a video sound request or a call sound request.
具体地,电子设备内安装有多个音频播放软件,则该软件可以是音乐播放APP、视频播放APP或者录音APP等。例如,视频播放界面设置有视频播放按键,通过对该视频播放按键的触控的检测,能够确定电子设备当前是否接收到音频数据的播放请求,例如,用户选中视频,进入视频的播放界面,点击该播放界面的播放按钮,应用程序通过对用户触控操作的监听,能够检测到用户当前所点击的是什么类型的视频,具体地,播放按钮设置有预设属性,检测到所获取的触控操作对应的播放按钮的属性,就能够确定用户所选中的待播放视频,进而获取到播放请求,以及该播放请求对应的音频。Specifically, if multiple audio playback software is installed in the electronic device, the software may be a music playback APP, a video playback APP, a recording APP, or the like. For example, the video playback interface is provided with a video playback button. By detecting the touch of the video playback button, it can be determined whether the electronic device currently receives a playback request for audio data. For example, the user selects a video, enters the video playback interface, and clicks. The playback button of the playback interface allows the application to detect what type of video the user is currently clicking by monitoring the user ’s touch operation. Specifically, the playback button is set with preset attributes to detect the acquired touch By operating the properties of the corresponding playback button, the user can determine the video to be played selected by the user, and then obtain a playback request and the audio corresponding to the playback request.
通过电子设备为两个无线音频播放时设备所配置要播放的音频数据以及所获取的对该音频数据的播放请求,就能够确定当前两个所述无线音频播放设备是否正在播放不同的音频数据以实现混音播放的效果。如果是,则判断每个所述无线音频播放设备是否处于预设状态。By using the electronic device to configure the audio data to be played when the two wireless audio devices are played and the acquired playback request for the audio data, it can be determined whether the two wireless audio playback devices are currently playing different audio data to To achieve the effect of mixing playback. If yes, determine whether each of the wireless audio playback devices is in a preset state.
其中,预设状态表示无线音频播放设备的使用状态,具体地,可以是佩戴状态、工作状态、连接状态或者用途,其中,用途表示该无线音频播放设备欲播放的音频类型,例如,用于播放纯音频、通话语音或者视频中的音频等。则如果无线音频播放设备处于预设状态,则表示用户放弃使用该无线音频播放设备收听正在播放的音频数据,从而放弃混音播放的听觉效果。The preset state indicates a use state of the wireless audio playback device. Specifically, the preset state may be a wearing state, a working state, a connection state, or a usage. The usage indicates a type of audio to be played by the wireless audio playback device, for example, for playback. Audio-only, call voice, or audio in video. Then, if the wireless audio playback device is in a preset state, it means that the user abandons using the wireless audio playback device to listen to the audio data being played, thereby abandoning the auditory effect of the mixed playback.
作为一种实施方式,可以是获取每个所述无线音频播放设备的工作状态,若所述无线音频播放设备的工作状态为掉线状态,则判定该无线音频播放设备处于预设状态,否则,判定该无线音频播放设备未处于预设状态。As an implementation manner, the working status of each of the wireless audio playback devices may be obtained. If the working status of the wireless audio playback device is offline, it is determined that the wireless audio playback device is in a preset state, otherwise, It is determined that the wireless audio playback device is not in a preset state.
具体地,掉线状态为电子设备与该无线音频播放设备之间的连接断开,则可以是无线音频播放设备关闭,而导致电子设备与该无线音频播放设备之间的连接断开,也可以是无线音频播放设备与电子设备之间的通信链路故障而导致电子设备与该无线音频播放设备之间的连接断开。Specifically, if the disconnected state is that the connection between the electronic device and the wireless audio playback device is disconnected, the wireless audio playback device may be turned off, and the connection between the electronic device and the wireless audio playback device may be disconnected. The failure of the communication link between the wireless audio playback device and the electronic device results in the connection between the electronic device and the wireless audio playback device being broken.
具体地,电子设备发送一个信标至每个无线音频播放设备,并判断在预设时间内是否收到该无线音频播放设备基于所接收的信标而返回的返回结果,若在预设时间内获取到无线音频播放设备发 送的返回结果,则判定电子设备与该无线音频播放设备之间的连接未断开,即无线音频播放设备的工作状态为已连接,否则,判定无线音频播放设备的工作状态为掉线状态。如果无线音频播放设备的工作状态为掉线状态,则判定该无线音频播放设备处于预设状态,如果无线音频播放设备的工作状态为已连接状态,则判定该无线音频播放设备未处于预设状态。Specifically, the electronic device sends a beacon to each wireless audio playback device, and determines whether a return result returned by the wireless audio playback device based on the received beacon is received within a preset time. When the return result sent by the wireless audio playback device is obtained, it is determined that the connection between the electronic device and the wireless audio playback device is not disconnected, that is, the working state of the wireless audio playback device is connected, otherwise, the work of the wireless audio playback device is determined The status is offline. If the working state of the wireless audio playback device is offline, it is determined that the wireless audio playback device is in a preset state, and if the working state of the wireless audio playback device is connected, it is determined that the wireless audio playback device is not in a preset state .
另外,还可以根据无线音频播放设备的佩戴状态和通话状态确定该无线音频播放设备是否处于预设状态,具体地,请参阅后续实施例。In addition, whether the wireless audio playback device is in a preset state can also be determined according to the wearing state and the call status of the wireless audio playback device. For details, refer to the subsequent embodiments.
S302:将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据。S302: Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
S303:将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据。S303: Use the wireless audio playback device that is not in the preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
对每个无线音频播放设备分别判断其是否处于预设状态,将处于预设状态的无线音频播放设备作为第一无线音频播放设备,将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,其中,将第一无线音频播放设备在混音播放过程中播放的音频数据作为第一音频数据,将第二无线音频播放设备在混音播放过程中播放的音频数据作为第二音频数据,也就是说,第一音频数据作为第一无线音频播放设备在混音播放过程中播放的音频数据的指代,而第二音频数据作为第二无线音频播放设备在混音播放过程中播放的音频数据的指代,而非对第一无线音频播放设备和第二无线音频播放设备所播放的音频数据的限定。For each wireless audio playback device, determine whether it is in a preset state, use the wireless audio playback device in the preset state as the first wireless audio playback device, and use the wireless audio playback device that is not in the preset state as the second wireless audio. A playback device, wherein the audio data played by the first wireless audio playback device during the mixing playback is used as the first audio data, and the audio data played by the second wireless audio playback device during the mixing playback is used as the second audio data That is, the first audio data is used as a reference for the audio data played by the first wireless audio playback device during the mixing playback, and the second audio data is used as the second wireless audio playback device played during the mixing playback. The reference of audio data is not a limitation on the audio data played by the first wireless audio playback device and the second wireless audio playback device.
需要说明的是,如果两个无线音频播放设备均未处于预设状态,则表示用户依然在使用两个无线音频播放设备收听混音播放的音频,则结束本次方法或者返回执行S301。另外,如果两个无线音频播放设备均处于预设状态,则表示用户放弃使用两个无线音频播放设备来收听该音频,则结束本次方法或者返回执行S301。It should be noted that if the two wireless audio playback devices are not in a preset state, it means that the user is still using the two wireless audio playback devices to listen to the audio played by the mixed audio, and then the method ends or returns to execute S301. In addition, if both wireless audio playback devices are in a preset state, it means that the user has given up using the two wireless audio playback devices to listen to the audio, then the method is ended or the process returns to S301.
S304:控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。S304: Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
具体地,控制第二无线音频播放设备继续播放第二音频数据,同时,将第一无线音频播放设备所播放的第一音频数据也交由第二无线音频播放设备播放,从而使得用户能够继续通过第二无线音频播放设备播放不同的音频数据以实现混音播放效果。Specifically, the second wireless audio playback device is controlled to continue to play the second audio data, and at the same time, the first audio data played by the first wireless audio playback device is also handed over to the second wireless audio playback device to play, so that the user can continue to pass The second wireless audio playback device plays different audio data to achieve a mixing playback effect.
具体地,记录第一无线音频播放设备播放第一音频数据的第一播放进度,作为一种实施方式,当判定第一无线音频播放设备时,即判定两个无线音频播放设备中处于预设状态的无线音频播放设备时,记录此时的时间点为第一时间点,确定该第一时间点对应的第一音频数据的播放进度作为第一播放进度,控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据的具体实施方式为,控制所述第二无线音频播放设备继续播放第二音频数据,并且以第一播放进度继续播放第一音频数据。Specifically, the first playback progress of the first audio data played by the first wireless audio playback device is recorded. As an embodiment, when the first wireless audio playback device is determined, it is determined that the two wireless audio playback devices are in a preset state. When the wireless audio playback device is recorded, the time point at this time is recorded as the first time point, the playback progress of the first audio data corresponding to the first time point is determined as the first playback progress, and the second wireless audio playback device is controlled at the same time A specific implementation manner of playing the first audio data and the second audio data is to control the second wireless audio playback device to continue playing the second audio data, and continue to play the first audio data at a first playback progress.
另外,为了更好的实现混音播放的效果,第一音频数据和第二音频数据播放的时候,在时间上有一个对应关系,例如,二者同时播放或者二者延时一定时间播放,在获取到第一播放进度滞后,确定在混音播放过程中,第二音频数据的第一播放进度所对应的第二音频数据的第二播放进度,则控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据的具体实施方式为,控制所述第二无线音频播放设备以第二播放进度播放第二音频数据,同时以第一播放进度继续播放第一音频数据。In addition, in order to better achieve the effect of mixing playback, when the first audio data and the second audio data are played, there is a corresponding relationship in time, for example, the two are played at the same time or the two are delayed for a certain time. When the first playback progress lag is acquired, it is determined that during the mixing playback, the second playback progress of the second audio data corresponding to the first playback progress of the second audio data is controlled, and the second wireless audio playback device is controlled to play simultaneously A specific implementation manner of the first audio data and the second audio data is to control the second wireless audio playback device to play the second audio data at a second playback progress while continuing to play the first audio data at a first playback progress.
以立体声为例,且无线音频播放设备为无线耳机,则用户佩戴第一无线耳机和第二无线耳机,且第一无线耳机播放目标音频的左声道数据,而第二无线耳机播放目标音频的右声道数据,且第一无线耳机和第二无线耳机同时播放目标音频,则用户通过第一无线耳机和第二无线耳机能够收听到目标音频的立体声效果。当用户摘下或者关闭第一无线耳机或者使用第一无线耳机接听电话的时候,用户可以通过电子设备控制第二无线耳机继续播放目标音频的左声道数据和右声道数据,以实现通过第二无线耳机收听立体声效果。Taking stereo as an example, and the wireless audio playback device is a wireless headset, the user wears a first wireless headset and a second wireless headset, and the first wireless headset plays the left channel data of the target audio, and the second wireless headset plays the target audio. The right channel data, and the first wireless headset and the second wireless headset simultaneously play the target audio, then the user can listen to the stereo effect of the target audio through the first wireless headset and the second wireless headset. When the user takes off or turns off the first wireless headset or uses the first wireless headset to answer the call, the user can control the second wireless headset through the electronic device to continue playing the left channel data and the right channel data of the target audio to achieve the Two wireless headphones listen to stereo effects.
其中,作为一种方式,Android录音默认录制生成的是pcm文件,即Android立体声pcm数据结构,假设设置采样率为16K,录音类型为AudioFormat.CHANNEL_IN_STEREO(立体声录音),数据类型为AudioFormat.ENCODING_PCM_16BIT,则pcm文件的数据结构大致为2byte左声道、2byte右声道、2byte左声道、2byte右声道….,因此,可以将Android立体声pcm数据结构拆分成左声道音频信号和右声道音频信号,并将拆分的信号进行处理后得到的左声道音频信号传输至第一无线耳机输入用户左耳,将拆分的信号进行处理后得到的右声道音频信号传输至第二无线耳机输入用户右耳,从而可以提升音频播放效果和用户体验Among them, as a method, the Android recording generates a pcm file by default, that is, the Android stereo pcm data structure. Assuming that the sampling rate is set to 16K, the recording type is AudioFormat.CHANNEL_IN_STEREO (stereo recording), and the data type is AudioFormat.ENCODING_PCM_16BIT, then The data structure of the pcm file is roughly 2byte left channel, 2byte right channel, 2byte left channel, 2byte right channel .... Therefore, the Android stereo pcm data structure can be split into a left channel audio signal and a right channel. Audio signal, and transmit the left channel audio signal obtained after processing the split signal to the first wireless earphone input user's left ear, and transmit the right channel audio signal obtained after processing the split signal to the second wireless Headphone input into the user's right ear, which can improve the audio playback effect and user experience
另外,无线音频播放设备为无线耳机,用户佩戴两个无线耳机播放音频数据,如果其中一个无线耳机被摘下,则控制另外一个无线耳机同时播放不同的音频数据以实现混音播放的效果。具体地,请参阅图5,示出了本申请另一实施例提供的一种音频播放方法,应用于上述电子设备,具体地,该方法包括:S501至S505。In addition, the wireless audio playback device is a wireless headset. The user wears two wireless headsets to play audio data. If one of the wireless headsets is taken off, the other wireless headset is controlled to play different audio data at the same time to achieve the effect of mixing playback. Specifically, please refer to FIG. 5, which shows an audio playback method provided by another embodiment of the present application, which is applied to the above electronic device. Specifically, the method includes S501 to S505.
S501:当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,获取每个所述无线音频播放设备的佩戴状态。S501: When two of the wireless audio playback devices are playing different audio data to achieve mixed audio playback, obtain a wearing state of each of the wireless audio playback devices.
具体地,以无线音频播放设备为蓝牙耳机为例,则该蓝牙耳机包括壳体、蓝牙模块和播放模块,其中,蓝牙模块和播放模块均位于壳体内,蓝牙模块用于与电子设备之间建立连接关系并且传递数据等,而播放模块用于播放所获取的音频数据,该壳体上设置有接触传感器,能够检测到用户接触蓝牙耳机的壳体时输入的接触参数,其中,接触传感器可以是压力传感器、接近光传感器等,则该接触参数可以是压力值或者光信号强度值。Specifically, if the wireless audio playback device is a Bluetooth headset, the Bluetooth headset includes a casing, a Bluetooth module, and a playback module. The Bluetooth module and the playback module are both located in the casing, and the Bluetooth module is used to establish a connection with the electronic device. Connect the relationship and transfer data, etc., and the playback module is used to play the acquired audio data. The case is provided with a contact sensor, which can detect the contact parameters entered by the user when contacting the case of the Bluetooth headset. The contact sensor may be Pressure sensor, proximity light sensor, etc., the contact parameter may be a pressure value or an optical signal intensity value.
当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,分别获取两个蓝牙耳机的接触参数,基于所述接触参数,确定所述第一蓝牙耳机和所述第二蓝牙耳机的佩戴状态。When two of the wireless audio playback devices are playing different audio data for mixing playback, the contact parameters of the two Bluetooth headsets are obtained, and based on the contact parameters, the first Bluetooth headset and the second Bluetooth headset are determined. Wearing status of Bluetooth headset.
进一步地,在分别获取两个蓝牙耳机与用户耳部之间的接触参数后,可以从两个蓝牙耳机中确定与用户左耳接触的第一蓝牙耳机,以及与用户右耳接触的第二蓝牙耳机。其中,以一个蓝牙耳机为例进行说明,该蓝牙耳机的接触传感器固定设置于耳机本体的目标位置上,当该蓝牙耳机安放于用户左耳时,该接触传感器可以检测到与用户左耳之间的接触面积和接触点,当该蓝牙耳机安放于用户右耳时,该接触传感器可以检测到用户右耳之间的接触点面积和接触点,由于该接触传感器的设置位置不变,因此,在该蓝牙耳机在用户左耳和用户右耳之间切换安放时,接触面积和接触点均不相同,因此,当检测到该蓝牙耳机的接触参数后,可以将该接触参数和预存的蓝牙耳机安放于用户左耳的接触参数以及蓝牙耳机安放于用户右耳的接触参数进行比较,以确定该蓝牙耳机的安放位置,即确定该蓝牙耳机为第一蓝牙耳机或第二蓝牙耳机。同样的,另一个蓝牙耳机也可以通过上述方式确定为第一蓝牙耳机或第二蓝牙耳机,从而可以基于所述接触参数,确定两个蓝牙耳机是否佩戴在用户的耳部,如果佩戴在用户的耳部,则判定该蓝牙耳机的佩戴状态为已佩戴状态,而如果未佩戴在用户的耳部,则判定该蓝牙耳机的佩戴状态为未佩戴状态。Further, after obtaining the contact parameters between the two Bluetooth headsets and the user's ear, the first Bluetooth headset in contact with the user's left ear and the second Bluetooth in contact with the user's right ear can be determined from the two Bluetooth headsets. headset. A Bluetooth headset is taken as an example for description. The contact sensor of the Bluetooth headset is fixedly set at the target position of the headset body. When the Bluetooth headset is placed in the left ear of the user, the contact sensor can detect Contact area and contact point of the Bluetooth headset when the Bluetooth headset is placed in the user's right ear, the contact sensor can detect the contact point area and contact point between the user's right ear. Since the setting position of the contact sensor is unchanged, When the Bluetooth headset is switched between the user's left ear and the user's right ear, the contact area and contact point are different. Therefore, after detecting the contact parameters of the Bluetooth headset, the contact parameters and the pre-stored Bluetooth headset can be placed. The contact parameters of the user's left ear and the contact parameters of the Bluetooth headset placed in the user's right ear are compared to determine the placement position of the Bluetooth headset, that is, the Bluetooth headset is determined to be the first Bluetooth headset or the second Bluetooth headset. Similarly, another Bluetooth headset can also be determined as the first Bluetooth headset or the second Bluetooth headset in the above manner, so that it can be determined whether the two Bluetooth headsets are worn on the user's ear based on the contact parameters. The ear, it is determined that the wearing state of the Bluetooth headset is a worn state, and if it is not worn on the user's ear, it is determined that the wearing state of the Bluetooth headset is an unworn state.
另外,还可以通过运动轨迹检测第一蓝牙耳机和第二蓝牙耳机是否佩戴在用户的耳朵上,具体地,分别检测所述第一蓝牙耳机的运动轨迹和所述第二蓝牙耳机的运动轨迹。In addition, it is also possible to detect whether the first Bluetooth headset and the second Bluetooth headset are worn on the user's ear by the motion trajectory, and specifically detect the motion trajectory of the first Bluetooth headset and the motion trajectory of the second Bluetooth headset, respectively.
作为一种方式,蓝牙耳机还包括加速度传感器和/陀螺仪,所述加速度传感器和/或陀螺仪设置于所述耳机本体内,用于检测该蓝牙耳机的运动轨迹并将检测到的运动轨迹发送至与之连接的电子设备,以供电子设备对蓝牙耳机的运动轨迹进行检测。具体地,可以通过设置于第一蓝牙耳机内的第一加速度传感器检测第一蓝牙耳机的运动轨迹并发送至电子设备,以及通过设置于第二蓝牙耳机内的第二加速度传感器检测第二蓝牙耳机的运动轨迹并发送至电子设备,从而实现分别监测该第一蓝牙耳机的运动轨迹和第二蓝牙耳机的运动轨迹。As a method, the Bluetooth headset further includes an acceleration sensor and / or a gyroscope, and the acceleration sensor and / or the gyroscope is disposed in the headset body, and is configured to detect the motion trajectory of the Bluetooth headset and send the detected motion trajectory. To the electronic device connected to it, use the power supply device to detect the movement track of the Bluetooth headset. Specifically, the movement track of the first Bluetooth headset can be detected by a first acceleration sensor provided in the first Bluetooth headset and sent to the electronic device, and the second Bluetooth headset can be detected by a second acceleration sensor provided in the second Bluetooth headset. The motion trajectory of the first Bluetooth headset and the second trajectory of the second Bluetooth headset are monitored separately.
其中,以陀螺仪为例,根据所述陀螺仪的定轴性以及蓝牙耳机相对于陀螺仪转轴方向的已知的预设姿态,当蓝牙耳机的姿态与预设姿态之间出现差别,产生俯仰、偏航或横滚的某一方向的运动时,因为该陀螺仪的转轴保持方向不变,检测蓝牙耳机杆相对于转轴的角度关系与预设姿态相对于转轴的角度关系发生变化,则可以确定蓝牙耳机的姿态变化,确定蓝牙耳机的运动轨迹。Taking the gyroscope as an example, according to the gyroscope's axiality and the known preset attitude of the Bluetooth headset with respect to the rotation axis direction of the gyroscope, when a difference occurs between the attitude of the Bluetooth headset and the preset attitude, pitching occurs. , Yaw or roll movement in a certain direction, because the rotation axis of the gyroscope remains the same direction, it is possible to detect the change in the angle relationship between the Bluetooth headset lever with respect to the rotation axis and the angle relationship between the preset attitude and the rotation axis. Determine the attitude change of the Bluetooth headset, and determine the movement track of the Bluetooth headset.
基于两个蓝牙耳机的运动轨迹确定两个蓝牙耳机的佩戴状态。The wearing state of the two Bluetooth headsets is determined based on the motion trajectories of the two Bluetooth headsets.
在本实施例中,通过设置于第一蓝牙耳机的耳机本体内的加速度传感器和/或陀螺仪检测到该第一蓝牙耳机的运动轨迹后,基于该运动轨迹判断该第一蓝牙耳机是否脱离用户左耳,可以理解的,当第一蓝牙耳机的运动轨迹表征有明显的弧度变化时,可以认为该第一蓝牙耳机脱离用户左耳,当第一蓝牙耳机的运动轨迹表征没有明显的弧度变化时,可以认为该第一蓝牙耳机没有脱离用户左耳。In this embodiment, after detecting the motion trajectory of the first Bluetooth headset through an acceleration sensor and / or a gyroscope provided in the headset body of the first Bluetooth headset, it is determined whether the first Bluetooth headset is detached from the user based on the motion trajectory. For the left ear, it can be understood that when the motion trajectory of the first Bluetooth headset has a significant radian change, it can be considered that the first Bluetooth headset is detached from the user's left ear. When the motion trajectory of the first Bluetooth headset has no obvious radian change It can be considered that the first Bluetooth headset is not separated from the left ear of the user.
在本实施例中,通过设置于第二蓝牙耳机的耳机本体内的加速度传感器和/或陀螺仪检测到该第二蓝牙耳机的运动轨迹后,基于该运动轨迹判断该第二蓝牙耳机是否脱离用户右耳,可以理解的,当第二蓝牙耳机的运动轨迹表征有明显的弧度变化时,可以认为该第二蓝牙耳机脱离用户右耳,当第二蓝牙耳机的运动轨迹表征没有明显的弧度变化时,可以认为该第二蓝牙耳机没有脱离用户右耳。In this embodiment, after detecting a motion trajectory of the second Bluetooth headset through an acceleration sensor and / or a gyroscope provided in the headset body of the second Bluetooth headset, it is determined whether the second Bluetooth headset is detached from the user based on the motion trajectory. For the right ear, it can be understood that when the motion trajectory of the second Bluetooth headset has a significant radian change, it can be considered that the second Bluetooth headset is detached from the user's right ear. When the motion trajectory of the second Bluetooth headset has no obvious radian change It can be considered that the second Bluetooth headset is not separated from the user's right ear.
S502:若所述无线音频播放设备的佩戴状态为未佩戴状态,则判定该无线音频播放设备处于预设状态,否则,判定该无线音频播放设备未处于预设状态。S502: If the wearing state of the wireless audio playback device is not worn, it is determined that the wireless audio playback device is in a preset state; otherwise, it is determined that the wireless audio playback device is not in a preset state.
S503:将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据。S503: Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
S504:将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音 频播放设备在混音播放过程中播放的音频数据为第二音频数据。S504: If the wireless audio playback device that is not in the preset state is used as the second wireless audio playback device, the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
S505:控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。S505: Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
因此,以立体声为例,且无线音频播放设备为蓝牙耳机,则用户佩戴第一蓝牙耳机和第二蓝牙耳机,且第一蓝牙耳机播放目标音频的左声道数据,而第二蓝牙耳机播放目标音频的右声道数据,且第一蓝牙耳机和第二蓝牙耳机同时播放目标音频,则用户通过第一蓝牙耳机和第二蓝牙耳机能够收听到目标音频的立体声效果。当用户摘下第一蓝牙耳机的时候,用户可以通过电子设备控制第二蓝牙耳机继续播放目标音频的左声道数据和右声道数据,以实现通过第二蓝牙耳机收听立体声效果。Therefore, taking stereo as an example and the wireless audio playback device is a Bluetooth headset, the user wears a first Bluetooth headset and a second Bluetooth headset, and the first Bluetooth headset plays the left channel data of the target audio, and the second Bluetooth headset plays the target The right channel data of the audio and the first Bluetooth headset and the second Bluetooth headset play the target audio at the same time, the user can listen to the stereo effect of the target audio through the first Bluetooth headset and the second Bluetooth headset. When the user takes off the first Bluetooth headset, the user can control the second Bluetooth headset through the electronic device to continue playing the left channel data and the right channel data of the target audio, so as to achieve a stereo effect through the second Bluetooth headset.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
另外,用户有使用蓝牙耳机接听电话的习惯,则虽然此时蓝牙耳机在佩戴状态,则用户依然有可能放弃使用其中一个蓝牙耳机收听音频数据,而用于接听电话。具体地,请参阅图6,示出了本申请又一实施例提供的一种音频播放方法,应用于上述电子设备,具体地,该方法包括:S601至S606。In addition, the user has a habit of answering calls using a Bluetooth headset. Although the Bluetooth headset is in the wearing state at this time, the user may still give up using one of the Bluetooth headsets to listen to audio data and use it to answer the call. Specifically, please refer to FIG. 6, which shows an audio playing method provided by another embodiment of the present application, which is applied to the above electronic device. Specifically, the method includes S601 to S606.
S601:当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,检测是否获取到音频播放请求,所述音频播放请求用于播放预设类型的音频。S601: When two wireless audio playback devices are playing different audio data to implement mixing playback, it is detected whether an audio playback request is obtained, and the audio playback request is used to play a preset type of audio.
具体地,音频播放请求的确定可以参考上述实施例。则该音频播放请求用于播放预设类型的音频,该预设类型的音频可以是语音也可以是视频中的音频等,于本申请实施例中,所述预设类型的音频为语音通话类型的音频。具体地,基于用户所操作的应用程序而输入的音频播放请求就能够确定该音频播放请求对应的音频的类型,例如,用户点击音乐播放软件的某个音频或视频的播放按钮而输入的音频播放请求,则该音频播放请求对应的音频的类型为纯音频类或视频类。Specifically, for the determination of the audio playback request, reference may be made to the foregoing embodiment. The audio playback request is used to play a preset type of audio. The preset type of audio may be voice or audio in a video. In the embodiment of the present application, the preset type of audio is a voice call type. Audio. Specifically, the audio playback request input based on the application operated by the user can determine the type of audio corresponding to the audio playback request, for example, the audio playback input by the user clicking a certain audio or video playback button of the music playback software Request, the audio type corresponding to the audio playback request is pure audio or video.
具体地,当电子设备来电时,即电话铃声或者振动提醒响起时,电子设备能够检测到,并在屏幕上显示来电界面。而用户在来电界面内点击接听键,以实现电子设备当前号码与来电号码建立通话连接。具体地,可以通过电子设备的系统内的电话管理器来监听电子设备的电话状态,由此能够监测到电子设备是否处于通话模式。则电话管理器为电子设备的系统内的应用程序模块,用户获取电子设备的通话状态,例如,当电子设备的系统为安卓系统时,该电话管理器为TelephonyManager。Specifically, when the electronic device receives an incoming call, that is, when a telephone ringtone or a vibration reminder sounds, the electronic device can detect and display an incoming call interface on the screen. The user clicks the answer key in the incoming call interface to establish a call connection between the current number of the electronic device and the incoming call number. Specifically, the phone status of the electronic device can be monitored through the phone manager in the system of the electronic device, so that it can be monitored whether the electronic device is in a call mode. The phone manager is an application module in the system of the electronic device, and the user obtains the call status of the electronic device. For example, when the system of the electronic device is an Android system, the phone manager is a TelephonyManager.
具体地,如图7所示,在电子设备来电时,显示接听界面,在给接听界面显示有接听按钮,用户能够点击该接听按钮以接通电话。具体地,在点击该接通按钮时,就获取到用户输入的音频播放请求,则该音频播放请求用户播放电子设备通话过程中的通话语音,即语音通话类型的音频。Specifically, as shown in FIG. 7, when the electronic device calls, the answering interface is displayed, and the answering button is displayed on the answering interface. The user can click the answering button to connect the call. Specifically, when the ON button is clicked, an audio playback request input by the user is obtained, and the audio playback requests the user to play the voice of a call during the call of the electronic device, that is, a voice call type audio.
S602:若获取到,确定所述音频播放请求对应的无线音频播放设备。S602: If acquired, determine a wireless audio playback device corresponding to the audio playback request.
则用户在接听通话的时候,可以通过默认的无线耳机播放通话过程中的音频数据,具体地,用户通过电子设备设置用于接听电话的无线耳机,可以是两个无线耳机,也可以是其中一个无线耳机,则在用户点击图7所示的接听按钮的时候,会输入音频播放请求,并且会通过默认设置的无线耳机接听该通话,即该音频播放请求对应的无线音频播放设备为预先设置的默认的无线音频播放设备,由此,就能够确定该音频播放请求所对应的无线音频播放设备。When the user answers the call, the user can play the audio data during the call through the default wireless headset. Specifically, the user sets the wireless headset for receiving the call through the electronic device, which can be two wireless headsets or one of them. Wireless headset, when the user clicks the answer button shown in Figure 7, an audio playback request will be input, and the call will be answered through the wireless headset set by default, that is, the wireless audio playback device corresponding to the audio playback request is a preset By default, the wireless audio playback device can determine the wireless audio playback device corresponding to the audio playback request.
作为另一种实施方式,在接听通话的时候,用户可以选择以哪个无线音频播放设备来接听该通话。具体地,如图8所示,在该界面上设置有两个接听按钮,分别为第一接听按钮和第二接听按钮,其中,第一接听按钮和第二接听按钮对应不同的无线耳机,具体地,第一接听按钮对应佩戴于左耳的无线耳机,第二接听按钮对应于佩戴于右耳的无线耳机,而具体的判定左耳和右耳的耳机的方式可以参考前述实施方式。用户点击其中一个接听按钮,就能够输入音频播放请求,电子设备对第一接听按钮和第二接听按钮检测,就能够确定该音频播放请求对应的无线耳机。As another implementation manner, when answering a call, the user can choose which wireless audio playback device to use to answer the call. Specifically, as shown in FIG. 8, two answer buttons are provided on the interface, namely a first answer button and a second answer button, wherein the first answer button and the second answer button correspond to different wireless headsets, specifically The first answer button corresponds to the wireless earphone worn on the left ear, and the second answer button corresponds to the wireless earphone worn on the right ear. For a specific method of determining the earphones of the left ear and the right ear, refer to the foregoing embodiment. The user can input an audio playback request by clicking one of the answer buttons, and the electronic device can determine the wireless headset corresponding to the audio playback request by detecting the first answer button and the second answer button.
S603:将所述音频播放请求对应的无线音频播放设备的使用状态判定为处于预设状态。S603: Determine the use state of the wireless audio playback device corresponding to the audio playback request as being in a preset state.
在用户欲使用某个无线耳机播放通话过程中的音频数据时,则表示该无线耳机不能再用于收听混音播放,而需要播放通话过程中的音频数据,则判定该音频播放请求对应的无线音频播放设备的使用状态判定为处于预设状态,而另外一个无线耳机作为未处于预定状态。When a user wants to use a certain wireless headset to play audio data during a call, it means that the wireless headset can no longer be used to listen to the mix playback, but needs to play the audio data during the call, then it is determined that the wireless playback corresponding to the audio playback request The use state of the audio playback device is determined to be in a preset state, and the other wireless headset is deemed not to be in a predetermined state.
另外,在上述的确定无线音频播放设备的佩戴状态为未佩戴状态,则判定该无线音频播放设备处于预设状态时,如果无线音频播放设备的佩戴状态为已佩戴状态,则再确定该无线音频播放设备是否欲播放预设类型的音频。In addition, when it is determined that the wearing state of the wireless audio playback device is an unworn state, it is determined that the wireless audio playback device is in a preset state, and if the wearing state of the wireless audio playback device is a worn state, the wireless audio device is determined again. Whether the playback device wants to play a preset type of audio.
具体地,以第一蓝牙耳机和第二蓝牙耳机为例,如果第一蓝牙耳机被摘下,即处于未佩戴状态,则确定第二蓝牙耳机是否欲播放预设类型的音频,如果是,则不执行后续S604至S606的步骤,因为,预设类型的音频的播放优先级比较高,例如,语音通话类型的音频的播放级别最高,能够优先其他类型的音频数据而先播放。Specifically, taking the first Bluetooth headset and the second Bluetooth headset as an example, if the first Bluetooth headset is taken off, that is, it is in an unworn state, it is determined whether the second Bluetooth headset wants to play a preset type of audio, and if so, then The subsequent steps S604 to S606 are not performed because the playback priority of the preset type of audio is higher, for example, the audio call type audio has the highest playback level, and other types of audio data can be prioritized and played first.
则作为一种实施方式,当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放 时,获取每个所述无线音频播放设备的佩戴状态,若所述无线音频播放设备的佩戴状态为未佩戴状态,则判定该无线音频播放设备处于预设状态,否则,检测是否获取到音频播放请求,所述音频播放请求用于播放预设类型的音频,若获取到,确定所述音频播放请求对应的无线音频播放设备,如果所述音频播放请求对应的无线音频播放设备的使用状态为已佩戴状态,则结束本次方法,否则,继续执行S604。Then, as an implementation manner, when two of the wireless audio playback devices are playing different audio data to implement mixing playback, the wearing status of each of the wireless audio playback devices is acquired. If the wearing state is the non-wearing state, it is determined that the wireless audio playback device is in a preset state; otherwise, it is detected whether an audio playback request is obtained, and the audio playback request is used to play a preset type of audio. The wireless audio playback device corresponding to the audio playback request, if the use status of the wireless audio playback device corresponding to the audio playback request is a worn state, the method is ended, otherwise, the process continues to S604.
作为另一种实施方式,还可以是在检测是否获取到音频播放请求之前,先确定两个无线耳机是否均处于佩戴状态,具体地,当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,获取每个所述无线音频播放设备的佩戴状态,若每个所述无线音频播放设备的佩戴状态均为已佩戴状态,则检测是否获取到音频播放请求,所述音频播放请求用于播放预设类型的音频;若获取到,确定所述音频播放请求对应的无线音频播放设备;将所述音频播放请求对应的无线音频播放设备的使用状态判定为处于预设状态。As another implementation manner, before detecting whether an audio playback request is obtained, it may be determined whether the two wireless headsets are in a wearing state. Specifically, when two wireless audio playback devices are playing different audio data, In order to achieve mixing playback, the wearing status of each of the wireless audio playback devices is acquired. If the wearing status of each of the wireless audio playback devices is a worn status, it is detected whether an audio playback request is obtained, and the audio The playback request is used to play a preset type of audio; if it is obtained, a wireless audio playback device corresponding to the audio playback request is determined; a use state of the wireless audio playback device corresponding to the audio playback request is determined to be in a preset state.
S604:将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据。S604: Use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data.
S605:将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据。S605: If the wireless audio playback device that is not in the preset state is used as the second wireless audio playback device, the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
S606:控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。S606: Control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
因此,以立体声为例,且无线音频播放设备为蓝牙耳机,则用户佩戴第一蓝牙耳机和第二蓝牙耳机,且第一蓝牙耳机播放目标音频的左声道数据,而第二蓝牙耳机播放目标音频的右声道数据,且第一蓝牙耳机和第二蓝牙耳机同时播放目标音频,则用户通过第一蓝牙耳机和第二蓝牙耳机能够收听到目标音频的立体声效果。当电子设备获取到来电请求,而用户使用第一蓝牙耳机接听该电话的时候,用户可以通过电子设备控制第二蓝牙耳机继续播放目标音频的左声道数据和右声道数据,以实现通过第二蓝牙耳机收听立体声效果,而第一蓝牙耳机能够播放通话过程中的音频,使得用户能够边接听电话边播放立体声音频。Therefore, taking stereo as an example and the wireless audio playback device is a Bluetooth headset, the user wears a first Bluetooth headset and a second Bluetooth headset, and the first Bluetooth headset plays the left channel data of the target audio, and the second Bluetooth headset plays the target The right channel data of the audio and the first Bluetooth headset and the second Bluetooth headset play the target audio at the same time, the user can listen to the stereo effect of the target audio through the first Bluetooth headset and the second Bluetooth headset. When the electronic device obtains the call request and the user uses the first Bluetooth headset to answer the call, the user can control the second Bluetooth headset through the electronic device to continue playing the left channel data and the right channel data of the target audio to achieve the The second Bluetooth headset listens to the stereo effect, and the first Bluetooth headset can play audio during a call, so that the user can play stereo audio while receiving a call.
另外,考虑到用户在接听电话过程中,不希望周围的声音太嘈杂或者声音太大,则需要对第二无线音频播放设备的播放音量进行调节,则具体地,所述控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放,包括:降低所述第二无线音频播放设备的播放音量,控制所述第二无线音频播放设备以降低后的播放音量同时播放第一音频数据和第二音频数据,以实现混音播放。In addition, considering that the user does not want the surrounding sound to be too noisy or too loud during the call answering process, the playback volume of the second wireless audio playback device needs to be adjusted. Specifically, controlling the second wireless audio device The audio playback device plays the first audio data and the second audio data at the same time to realize the mixed playback, including: reducing the playback volume of the second wireless audio playback device, and controlling the second wireless audio playback device to reduce the playback after The volume plays the first audio data and the second audio data at the same time to achieve mixed playback.
具体地,获取第二无线音频播放设备的播放音量,作为一种实施方式,电子设备发送音量获取请求至第二无线音频播放设备,第二无线音频播放设备在获取到音量获取请求之后,根据该音量获取请求反馈第二无线音频播放设备的播放音量。作为另一种实施方式,电子设备内设置有音频播放客户端,该音频播放客户端请求播放音频数据,并且用户通过音频播放客户端能够调节混音播放音频数据的播放音量,也就是说,能够设置第一无线音频播放设备或者第二无线音频播放设备播放音频数据时的播放音量。Specifically, to obtain the playback volume of the second wireless audio playback device, as an embodiment, the electronic device sends a volume acquisition request to the second wireless audio playback device. After the second wireless audio playback device acquires the volume acquisition request, The volume acquisition request feedbacks the playback volume of the second wireless audio playback device. As another implementation manner, an audio playback client is provided in the electronic device, the audio playback client requests to play audio data, and the user can adjust the playback volume of the audio data of the mixed playback through the audio playback client, that is, can Set the playback volume when the first wireless audio playback device or the second wireless audio playback device plays audio data.
然后,再获取电子设备播放预设类型的音频时的播放音量,即通话时的通话音量,确定二者的大小关系,如果第二无线音频播放设备的播放音量大于第一无线音频播放设备播放预设类型的音频时的播放音量,则降低所述第二无线音频播放设备的播放音量。示例性地,第一无线音频播放设备和第二无线音频播放设备均以第一音量播放音频数据以实现混音播放的效果,则用户使用第一无线音频播放设备接听电话,则接听电话时的通话音量为第二音量,则获取第一音量和第二音量的差值,根据该差值能够确定第一音量和第二音量的大小关系,如果第一音量大于第二音量,则将第一音量降低,具体地,可以是将第一音量降低到低于第二音量,更具体地,可以是获取零与第二音量的音量差的绝对值的一半,记为第三音量,则将第一音量调整为第二音量。Then, obtain the playback volume when the electronic device plays a preset type of audio, that is, the call volume during a call, and determine the relationship between the two. If the playback volume of the second wireless audio playback device is greater than that of the first wireless audio playback device, When the playback volume is set for the type of audio, the playback volume of the second wireless audio playback device is reduced. Exemplarily, the first wireless audio playback device and the second wireless audio playback device both play audio data at a first volume to achieve the effect of mixing playback. Then, when a user uses the first wireless audio playback device to answer a call, If the call volume is the second volume, the difference between the first volume and the second volume is obtained. Based on the difference, the relationship between the first volume and the second volume can be determined. If the first volume is greater than the second volume, the first volume is The volume reduction may be specifically lowering the first volume to be lower than the second volume, more specifically, it may be to obtain half of the absolute value of the volume difference between zero and the second volume, and record it as the third volume. One volume is adjusted to the second volume.
由此,能够使得用户一边接听电话一边收听混音播放的音频数据,并且,混音播放的音频数据的音量低于接听电话的通话音量,使得用户不会因为混音播放的音频数据的音量过大而无法听清楚通话时的语音。As a result, the user can listen to the audio data of the mixed audio while receiving the call, and the volume of the audio data of the mixed audio playback is lower than the volume of the call of the received telephone, so that the user does not overdo the audio data played by the audio mixing. Too big to hear the voice during a call.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
请参阅图9,其示出了本申请实施例提供的一种音频播放装置900的结构框图,该装置可以包括:检测单元901、第一确定单元902、第二确定单元903和播放单元904。Please refer to FIG. 9, which shows a structural block diagram of an audio playback device 900 according to an embodiment of the present application. The device may include a detection unit 901, a first determination unit 902, a second determination unit 903, and a playback unit 904.
检测单元901,用于当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态。A detecting unit 901 is configured to determine whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to implement mixed audio playback.
第一确定单元902,用于将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据。The first determining unit 902 is configured to use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data .
第二确定单元903,用于将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据。A second determining unit 903 is configured to use a wireless audio playback device that is not in a preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data.
播放单元904,用于控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。The playback unit 904 is configured to control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the devices and modules described above may refer to the corresponding processes in the foregoing method embodiments, and are not repeated here.
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。In the several embodiments provided in this application, the coupling between the modules may be electrical, mechanical, or other forms of coupling.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist separately physically, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or software functional modules.
请参考图10,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设备100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120、蓝牙模块140以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。Please refer to FIG. 10, which is a structural block diagram of an electronic device according to an embodiment of the present application. The electronic device 100 may be an electronic device capable of running an application program, such as a smart phone, a tablet computer, or an e-book. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, a Bluetooth module 140, and one or more application programs. One or more of the application programs may be stored in the memory 120 and stored in the memory 120. It is configured to be executed by one or more processors 110, and one or more programs are configured to execute the method as described in the foregoing method embodiment.
处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts in the entire electronic device 100, and executes or executes instructions, programs, code sets, or instruction sets stored in the memory 120 by calling or executing data stored in the memory 120 to execute Various functions and processing data of the electronic device 100. Optionally, the processor 110 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). To implement a hardware form. The processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem. Among them, the CPU mainly handles the operating system, user interface, and application programs; the GPU is responsible for rendering and rendering of the displayed content; the modem is used for wireless communication. It can be understood that the modem may not be integrated into the processor 110, and may be implemented by a single communication chip.
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 120 may include Random Access Memory (RAM), and may also include Read-Only Memory. The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , Instructions for implementing the following method embodiments, and the like. The storage data area may also store data (such as phonebook, audio and video data, and chat history data) created by the terminal 100 during use.
蓝牙模块140用于实现电子设备与蓝牙设备之间的蓝牙连接,以及与蓝牙设备之间的数据交互。具体地,可以与蓝牙设备通过蓝牙协议5.0/4.2/4.1/2.1/2.0,也可以通过蓝牙低能耗技术(Bluetooh Low Energy,BLE)、蓝牙增强速率技术(Enhanced Data Rate,EDR)或者蓝牙基本速率(Base Rate,BR)等。则蓝牙模块140可以包括功率放大器、无线收发器、收发切换器、低噪声放大器以及天线等。发送信号时,收发器本身会直接输出小功率的微弱的射频信号,送至功率放大器(Power Amplifier,PA)进行功率放大,然后通过收发切换器(Transmit/Receive Switch)经由天线(Antenna)辐射至空间。接收信号时,天线会感应到空间中的电磁信号,通过切换器之后送至低噪声放大器(Low Noise Amplifier,LNA)进行放大,这样,放大后的信号就可以直接送给收发器进行处理,进行解调,该蓝牙模块140可以使用2.4GHz频段。The Bluetooth module 140 is configured to implement a Bluetooth connection between the electronic device and the Bluetooth device, and data interaction with the Bluetooth device. Specifically, it can communicate with Bluetooth devices through the Bluetooth protocol 5.0 / 4.2 / 4.1 / 2.1 / 2.0, or through Bluetooth Low Energy (BLE), Enhanced Data Rate (EDR), or Bluetooth basic rate. (Base, Rate, BR) and so on. The Bluetooth module 140 may include a power amplifier, a wireless transceiver, a transceiver switch, a low-noise amplifier, and an antenna. When transmitting a signal, the transceiver itself will output a weak RF signal of low power directly, send it to a Power Amplifier (PA) for power amplification, and then radiate it to the antenna via Antenna through the Transmit / Receive Switch. space. When receiving a signal, the antenna will sense the electromagnetic signal in the space, and then send it to a Low Noise Amplifier (LNA) for amplification after switching, so that the amplified signal can be sent directly to the transceiver for processing. For demodulation, the Bluetooth module 140 can use the 2.4 GHz frequency band.
请参考图11,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质1100中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 11, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable medium 1100 stores program code, and the program code can be called by a processor to execute a method described in the foregoing method embodiment.
计算机可读存储介质1100可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质1100包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质1100具有执行上述方法中的任何方法步骤的程序代码1110的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1110可以例如以适当形式进行压缩。The computer-readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1100 has a storage space of a program code 1110 for performing any of the method steps in the above method. These program codes can be read from or written into one or more computer program products. The program code 1110 may be compressed in a suitable form, for example.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实 施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to describe the technical solution of the present application, rather than limiting it. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still Modifications to the technical solutions described in the foregoing embodiments, or equivalent replacements of some of the technical features thereof; and these modifications or replacements do not drive the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种音频播放方法,其特征在于,应用于电子设备,所述电子设备能够同时连接两个无线音频播放设备,所述方法包括:An audio playing method, which is characterized in that it is applied to an electronic device capable of connecting two wireless audio playing devices at the same time. The method includes:
    当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态;Determining whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to achieve mixed audio playback;
    将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据;Using the wireless audio playback device in a preset state as the first wireless audio playback device, the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data;
    将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据;Using a wireless audio playback device that is not in a preset state as the second wireless audio playback device, the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data;
    控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。And controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement mixing playback.
  2. 根据权利要求1所述的方法,其特征在于,所述无线音频播放设备为无线耳机,所述判断每个所述无线音频播放设备是否处于预设状态,包括:The method according to claim 1, wherein the wireless audio playback device is a wireless headset, and the determining whether each of the wireless audio playback devices is in a preset state comprises:
    获取每个所述无线音频播放设备的佩戴状态;Acquiring a wearing state of each of the wireless audio playback devices;
    若所述无线音频播放设备的佩戴状态为未佩戴状态,则判定该无线音频播放设备处于预设状态,否则,判定该无线音频播放设备未处于预设状态。If the wearing state of the wireless audio playback device is an unworn state, it is determined that the wireless audio playback device is in a preset state; otherwise, it is determined that the wireless audio playback device is not in a preset state.
  3. 根据权利要求2所述的方法,其特征在于,所述获取每个所述无线音频播放设备的佩戴状态,包括:The method according to claim 2, wherein the acquiring a wearing state of each of the wireless audio playback devices comprises:
    分别获取每个所述无线音频播放设备的接触参数,所述接触参数为用户接触所述无线音频播放设备时输入的参数;Obtaining contact parameters of each of the wireless audio playback devices, the contact parameters being parameters input by a user when contacting the wireless audio playback device;
    基于所述接触参数,确定每个所述无线音频播放设备的佩戴状态。Based on the contact parameters, a wearing state of each of the wireless audio playback devices is determined.
  4. 根据权利要求2所述的方法,其特征在于,所述获取每个所述无线音频播放设备的佩戴状态,包括:The method according to claim 2, wherein the acquiring a wearing state of each of the wireless audio playback devices comprises:
    分别获取所述第一无线音频播放设备和所述第二无线音频播放设备的运动轨迹;Respectively acquiring motion trajectories of the first wireless audio playback device and the second wireless audio playback device;
    基于所述运动轨迹,确定每个所述无线音频播放设备的佩戴状态。Based on the motion trajectory, a wearing state of each of the wireless audio playback devices is determined.
  5. 根据权利要求1所述的方法,其特征在于,所述无线音频播放设备为无线耳机,所述判断每个所述无线音频播放设备是否处于预设状态,包括:The method according to claim 1, wherein the wireless audio playback device is a wireless headset, and the determining whether each of the wireless audio playback devices is in a preset state comprises:
    检测是否获取到音频播放请求,所述音频播放请求用于播放预设类型的音频;Detecting whether an audio playback request is obtained, where the audio playback request is used to play a preset type of audio;
    若获取到,确定所述音频播放请求对应的无线音频播放设备;If obtained, determining a wireless audio playback device corresponding to the audio playback request;
    将所述音频播放请求对应的无线音频播放设备的使用状态判定为处于预设状态。The use state of the wireless audio playback device corresponding to the audio playback request is determined to be in a preset state.
  6. 根据权利要求5所述的方法,其特征在于,所述检测是否获取到音频播放请求,包括:The method according to claim 5, wherein the detecting whether an audio playback request is obtained comprises:
    确定每个所述无线音频播放设备是否均为已佩戴状态;Determining whether each of the wireless audio playback devices is in a worn state;
    如果是已佩戴状态,则检测是否获取到音频播放请求。If it is worn, it is detected whether an audio playback request is obtained.
  7. 根据权利要求5-6所述的方法,其特征在于,所述预设类型的音频为语音通话类型的音频。The method according to claim 5-6, wherein the preset type of audio is a voice call type audio.
  8. 根据权利要求7所述的方法,其特征在于,所述控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放,包括:The method according to claim 7, wherein the controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time so as to realize the mixing playback comprises:
    降低所述第二无线音频播放设备的播放音量;Reducing the playback volume of the second wireless audio playback device;
    控制所述第二无线音频播放设备以降低后的播放音量同时播放第一音频数据和第二音频数据,以实现混音播放。And controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time after the reduced playback volume, so as to implement mixing playback.
  9. 根据权利要求8所述的方法,其特征在于,所述降低所述第二无线音频播放设备的播放音量,包括:The method according to claim 8, wherein the reducing the playback volume of the second wireless audio playback device comprises:
    获取所述第二无线音频播放设备的播放音量;Acquiring the playback volume of the second wireless audio playback device;
    获取所述第一无线音频播放设备播放预设类型的音频时的播放音量;Acquiring a playback volume when the first wireless audio playback device plays a preset type of audio;
    判断所述第二无线音频播放设备的播放音量是否大于所述第一无线音频播放设备播放预设类型的音频时的播放音量;Determining whether the playback volume of the second wireless audio playback device is greater than the playback volume when the first wireless audio playback device plays a preset type of audio;
    如果大于,则降低所述第二无线音频播放设备的播放音量。If it is greater, then decrease the playback volume of the second wireless audio playback device.
  10. 根据权利要求1所述的方法,其特征在于,所述判断每个所述无线音频播放设备是否处于预设状态,包括:The method according to claim 1, wherein the determining whether each of the wireless audio playback devices is in a preset state comprises:
    获取每个所述无线音频播放设备的工作状态;Acquiring the working status of each of the wireless audio playback devices;
    若所述无线音频播放设备的工作状态为掉线状态,则判定该无线音频播放设备处于预设状态, 否则,判定该无线音频播放设备未处于预设状态。If the working state of the wireless audio playback device is offline, it is determined that the wireless audio playback device is in a preset state; otherwise, it is determined that the wireless audio playback device is not in a preset state.
  11. 根据权利要求10所述的方法,其特征在于,所述掉线状态为所述电子设备与所述无线音频播放设备之间的断开连接;The method according to claim 10, wherein the disconnected state is a disconnected connection between the electronic device and the wireless audio playback device;
    所述判定该无线音频播放设备处于预设状态之前,包括:Before determining that the wireless audio playback device is in a preset state, the method includes:
    确定所述无线音频播放设备是否为关闭状态;Determining whether the wireless audio playback device is off;
    如果所述无线音频播放设备为关闭状态,则确定所述电子设备与线无线音频播放设备之间的断开连接。If the wireless audio playback device is in the off state, it is determined that the electronic device is disconnected from the wireless audio playback device.
  12. 根据权利要求10所述的方法,其特征在于,所述掉线状态为所述电子设备与所述无线音频播放设备之间的断开连接;The method according to claim 10, wherein the disconnected state is a disconnected connection between the electronic device and the wireless audio playback device;
    所述判定该无线音频播放设备处于预设状态之前,还包括:Before determining that the wireless audio playback device is in a preset state, the method further includes:
    确定所述无线音频播放设备与所述电子设备之间的通信链路是否故障;Determining whether a communication link between the wireless audio playback device and the electronic device is faulty;
    如果故障,则确定所述电子设备与线无线音频播放设备之间的断开连接。If it fails, it is determined that the electronic device is disconnected from the wireless audio playback device.
  13. 根据权利要求10所述的方法,其特征在于,所判定该无线音频播放设备处于预设状态之前,包括:The method according to claim 10, wherein before the determining that the wireless audio playback device is in a preset state, comprises:
    发送一个信标至每个所述无线音频播放设备;Sending a beacon to each said wireless audio playback device;
    判断在预设时间内是否接收到所述无线音频播放设备发送的返回结果;Determining whether a return result sent by the wireless audio playback device is received within a preset time;
    若在预设时间内未获取到所述无线音频播放设备发送的返回结果,则确定所述无线音频播放设备的工作状态为掉线状态。If the return result sent by the wireless audio playback device is not obtained within a preset time, it is determined that the working state of the wireless audio playback device is an offline state.
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:The method according to claim 13, further comprising:
    若在预设时间内获取到所述无线音频播放设备发送的返回结果,则确定所述无线音频播放设备的工作状态为非掉线状态。If a return result sent by the wireless audio playback device is obtained within a preset time, it is determined that the working state of the wireless audio playback device is a non-dropped state.
  15. 根据权利要求1-14所述的方法,其特征在于,所述控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放,包括:The method according to claim 1-14, wherein the controlling the second wireless audio playback device to play the first audio data and the second audio data at the same time to implement the mixed audio playback comprises:
    控制所述第二无线音频播放设备继续播放所述第二音频数据;Controlling the second wireless audio playback device to continue playing the second audio data;
    以第一播放进度继续播放所述第一音频数据。Continue playing the first audio data at a first playback progress.
  16. 根据权利要求15所述的方法,其特征在于,所述以第一播放进度继续播放所述第一音频数据之前,包括:The method according to claim 15, wherein before continuing to play the first audio data at a first playback progress, comprises:
    当确定所述无线音频播放设备播放时,记录此时的时间点,得到第一时间点;When it is determined that the wireless audio playback device is playing, record the time point at this time to obtain the first time point;
    确定所述第一时间点对应的第一音频数据的播放进度,将该播放进度作为第一播放进度。Determine the playback progress of the first audio data corresponding to the first time point, and use the playback progress as the first playback progress.
  17. 根据权利要求1-16任一所述的方法,其特征在于,当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态,包括:The method according to any one of claims 1 to 16, characterized in that, when two of the wireless audio playback devices are playing different audio data to realize mixed playback, it is determined whether each of the wireless audio playback devices is in Preset states, including:
    当两个所述无线音频播放设备中,一个无线音频播放设备正在播放音频数据的左声道数据,另一个无线音频播放设备正在播放所述音频数据的右声道数据以实现所述音频数据的立体声播放时,判断每个所述无线音频播放设备是否处于预设状态。When two of the wireless audio playback devices, one wireless audio playback device is playing the left channel data of the audio data, and the other wireless audio playback device is playing the right channel data of the audio data to implement the audio data. During stereo playback, it is determined whether each of the wireless audio playback devices is in a preset state.
  18. 一种音频播放装置,其特征在于,应用于电子设备,所述电子设备能够同时连接两个无线音频播放设备,所述音频播放装置包括:An audio playback device, which is characterized in that it is applied to an electronic device that can connect two wireless audio playback devices at the same time. The audio playback device includes:
    检测单元,用于当两个所述无线音频播放设备正在播放不同的音频数据以实现混音播放时,判断每个所述无线音频播放设备是否处于预设状态;A detecting unit, configured to determine whether each of the wireless audio playback devices is in a preset state when two of the wireless audio playback devices are playing different audio data to implement mixing playback;
    第一确定单元,用于将处于预设状态的无线音频播放设备作为第一无线音频播放设备,则所述第一无线音频播放设备在混音播放过程中播放的音频数据为第一音频数据;A first determining unit, configured to use the wireless audio playback device in a preset state as the first wireless audio playback device, and then the audio data played by the first wireless audio playback device during the mixing playback process is the first audio data;
    第二确定单元,用于将未处于预设状态的无线音频播放设备作为第二无线音频播放设备,则所述第二无线音频播放设备在混音播放过程中播放的音频数据为第二音频数据;A second determining unit, configured to use a wireless audio playback device that is not in a preset state as the second wireless audio playback device, and then the audio data played by the second wireless audio playback device during the mixing playback process is the second audio data ;
    播放单元,用于控制所述第二无线音频播放设备同时播放第一音频数据和第二音频数据,以实现混音播放。The playback unit is configured to control the second wireless audio playback device to play the first audio data and the second audio data at the same time, so as to implement the mixed audio playback.
  19. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    一个或多个处理器,所述一个或多个处理器能够同时连接两个无线音频播放设备;One or more processors capable of simultaneously connecting two wireless audio playback devices;
    存储器;Memory
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1-17任一项所述的方法。One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute as The method according to any one of claims 1-17.
  20. 一种计算机可读介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行所述权利要求1-17任一项所述方法。A computer-readable medium, characterized in that the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1-17.
PCT/CN2019/097146 2018-09-30 2019-07-22 Audio playing method and apparatus, electronic device and computer-readable medium WO2020063069A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811161376.5A CN109379490B (en) 2018-09-30 2018-09-30 Audio playing method and device, electronic equipment and computer readable medium
CN201811161376.5 2018-09-30

Publications (1)

Publication Number Publication Date
WO2020063069A1 true WO2020063069A1 (en) 2020-04-02

Family

ID=65402891

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/097146 WO2020063069A1 (en) 2018-09-30 2019-07-22 Audio playing method and apparatus, electronic device and computer-readable medium

Country Status (2)

Country Link
CN (1) CN109379490B (en)
WO (1) WO2020063069A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109379490B (en) * 2018-09-30 2021-02-05 Oppo广东移动通信有限公司 Audio playing method and device, electronic equipment and computer readable medium
CN109831833B (en) * 2019-03-18 2021-01-05 成都极客通科技有限公司 Emergency call-in system and method based on sound mixing control
CN110505610A (en) * 2019-04-30 2019-11-26 努比亚技术有限公司 Communication management method, equipment, system and readable storage medium storing program for executing
WO2022087924A1 (en) * 2020-10-28 2022-05-05 Oppo广东移动通信有限公司 Audio control method and device
WO2024040527A1 (en) * 2022-08-25 2024-02-29 Qualcomm Incorporated Spatial audio using a single audio device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100020998A1 (en) * 2008-07-28 2010-01-28 Plantronics, Inc. Headset wearing mode based operation
CN104159173A (en) * 2014-08-27 2014-11-19 宇龙计算机通信科技(深圳)有限公司 Earphone, earphone application method, earphone control method and device as well as mobile terminal
CN105472496A (en) * 2015-11-21 2016-04-06 惠州Tcl移动通信有限公司 Bluetooth earphone and automatic on-off method thereof
CN106341757A (en) * 2016-09-30 2017-01-18 宇龙计算机通信科技(深圳)有限公司 Sound source simultaneous playing method, device and terminal
CN108076306A (en) * 2017-12-29 2018-05-25 中兴通讯股份有限公司 Meeting implementation method, device, equipment and system, computer readable storage medium
CN108108146A (en) * 2018-01-19 2018-06-01 深圳市沃特沃德股份有限公司 The method and playback equipment that multiple playback equipments are played simultaneously
CN109379490A (en) * 2018-09-30 2019-02-22 Oppo广东移动通信有限公司 Audio frequency playing method, device, electronic equipment and computer-readable medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107295434A (en) * 2017-05-26 2017-10-24 广东思派康电子科技有限公司 TWS earphones and realize the vocal music of TWS earphones with the computer-readable recording medium broadcast

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100020998A1 (en) * 2008-07-28 2010-01-28 Plantronics, Inc. Headset wearing mode based operation
CN104159173A (en) * 2014-08-27 2014-11-19 宇龙计算机通信科技(深圳)有限公司 Earphone, earphone application method, earphone control method and device as well as mobile terminal
CN105472496A (en) * 2015-11-21 2016-04-06 惠州Tcl移动通信有限公司 Bluetooth earphone and automatic on-off method thereof
CN106341757A (en) * 2016-09-30 2017-01-18 宇龙计算机通信科技(深圳)有限公司 Sound source simultaneous playing method, device and terminal
CN108076306A (en) * 2017-12-29 2018-05-25 中兴通讯股份有限公司 Meeting implementation method, device, equipment and system, computer readable storage medium
CN108108146A (en) * 2018-01-19 2018-06-01 深圳市沃特沃德股份有限公司 The method and playback equipment that multiple playback equipments are played simultaneously
CN109379490A (en) * 2018-09-30 2019-02-22 Oppo广东移动通信有限公司 Audio frequency playing method, device, electronic equipment and computer-readable medium

Also Published As

Publication number Publication date
CN109379490B (en) 2021-02-05
CN109379490A (en) 2019-02-22

Similar Documents

Publication Publication Date Title
WO2020063047A1 (en) Audio playback method and apparatus, electronic device and storage medium
WO2020063069A1 (en) Audio playing method and apparatus, electronic device and computer-readable medium
WO2020063046A1 (en) Audio playback method and device, electronic device and storage medium
WO2019090726A1 (en) Method for selecting bluetooth device, terminal, and system
US10950238B2 (en) Bluetooth speaker base, method and system for controlling thereof
CN109151566B (en) Audio playing method and device, electronic equipment and computer readable medium
WO2021184920A1 (en) Method and apparatus for masking sound, and terminal device
WO2017181365A1 (en) Earphone channel control method, related apparatus, and system
US20040147282A1 (en) Electronic apparatus having a wireless communication device communicating with at least two device
KR20090007694A (en) Audio headset
WO2020019820A1 (en) Microphone hole blockage detection method and related product
US10827455B1 (en) Method and apparatus for sending a notification to a short-range wireless communication audio output device
WO2020063065A1 (en) Audio transmission method and apparatus, electronic device, and storage medium
CN114245328B (en) Voice call transfer method and electronic equipment
WO2019174492A1 (en) Voice call data detection method, device, storage medium and mobile terminal
WO2024055494A1 (en) Call method and apparatus based on bluetooth earphone, and storage medium
KR20170043319A (en) Electronic device and audio ouputting method thereof
US20220286538A1 (en) Earphone device and communication method
WO2018035868A1 (en) Method for outputting audio, electronic device, and storage medium
US11665271B2 (en) Controlling audio output
US10735881B2 (en) Method and apparatus for audio transfer when putting on/removing headphones plus communication between devices
WO2020019822A1 (en) Microphone hole blockage detecting method and related product
WO2024060750A1 (en) Bluetooth switching method and apparatus, bluetooth connection method and apparatus, and electronic device
WO2023185589A1 (en) Volume control method and electronic device
WO2024119926A1 (en) Earphone fitting degree detection method and earphone

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: 19867808

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: 19867808

Country of ref document: EP

Kind code of ref document: A1