Sound channel switching method and electronic equipment

文档序号:11449 发布日期:2021-09-17 浏览:26次 中文

阅读说明:本技术 一种声道切换方法及电子设备 (Sound channel switching method and electronic equipment ) 是由 赵登 于 2020-03-16 设计创作,主要内容包括:本发明提供一种声道切换方法及电子设备,所述声道切换方法包括:获取左声道音频信号和右声道音频信号;在第二电子设备处于第一佩戴状态的情况下,将左声道音频信号和右声道音频信号按第一编码序列编码后发送至第二电子设备;在第二电子设备处于第二佩戴状态的情况下,将左声道音频信号和右声道音频信号按第二编码序列编码后发送至第二电子设备;其中,在第一编码序列中,左声道音频信号与右声道音频信号交替设置,所述左声道音频信号位于第一位置;在第二编码序列中,左声道音频信号和右声道音频信号交替设置,所述右声道音频信号位于所述第一位置。本发明提供的技术方案解决了现有的电子设备容易造成用户听感体验较差的问题。(The invention provides a sound channel switching method and electronic equipment, wherein the sound channel switching method comprises the following steps: acquiring a left channel audio signal and a right channel audio signal; under the condition that the second electronic equipment is in the first wearing state, the left channel audio signal and the right channel audio signal are coded according to the first coding sequence and then are sent to the second electronic equipment; under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment; in the first coding sequence, left channel audio signals and right channel audio signals are alternately arranged, and the left channel audio signals are located at a first position; in the second coding sequence, a left channel audio signal and a right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position. The technical scheme provided by the invention solves the problem that the existing electronic equipment is easy to cause poor user listening experience.)

1. A channel switching method is applied to a first electronic device, and the first electronic device is connected with a second electronic device, and is characterized by comprising the following steps:

acquiring a left channel audio signal and a right channel audio signal;

under the condition that the second electronic equipment is in a first wearing state, the left channel audio signal and the right channel audio signal are coded according to a first coding sequence and then are sent to the second electronic equipment;

under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

2. The method of claim 1, wherein after obtaining the left channel audio signal and the right channel audio signal, the method further comprises:

acquiring a preset coding duration for coding the left channel audio signal and the right channel audio signal by the first electronic device;

splitting the left channel audio signal and the right channel audio signal into a plurality of first left channel audio signals and a plurality of first right channel audio signals meeting the preset coding duration respectively;

under the condition that the second electronic equipment is in a first wearing state, the left channel audio signal and the right channel audio signal are coded according to a first coding sequence and then are sent to the second electronic equipment, and the method comprises the following steps:

under the condition that the second electronic equipment is in a first wearing state, configuring the first left channel audio signal at a first preset position in a first coding sequence, configuring the first right channel audio signal at a second preset position, coding a plurality of first left channel audio signals and a plurality of first right channel audio signals according to the first coding sequence, and then sending the coded signals to the second electronic equipment;

under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment, and the method comprises the following steps:

under the condition that the second electronic equipment is in a second wearing state, the first left channel audio signal is configured at the second preset position in a second coding sequence, the first right channel audio signal is configured at the first preset position, and the plurality of first left channel audio signals and the plurality of first right channel audio signals are coded according to the second coding sequence and then are sent to the second electronic equipment.

3. The method of claim 2, wherein the preset coding duration is a duration of one frame of audio, or wherein the preset coding duration is a duration of one signal slot.

4. The method of claim 1, wherein the second electronic device is a headset comprising a left headset and a right headset; in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

5. A channel switching method is applied to a second electronic device, and is characterized by comprising the following steps:

receiving an audio signal sent by first electronic equipment;

decoding the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence under the condition that the second electronic equipment is in a first wearing state;

decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

6. An electronic device, the electronic device being a first electronic device, the electronic device being connected to a second electronic device, the electronic device comprising:

the acquisition module is used for acquiring a left channel audio signal and a right channel audio signal;

the encoding module is used for encoding the left channel audio signal and the right channel audio signal according to a first encoding sequence and then sending the encoded signals to the second electronic equipment under the condition that the second electronic equipment is in a first wearing state;

the encoding module is further configured to: under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

7. The electronic device of claim 6, wherein the acquisition module is further configured to:

acquiring a preset coding duration for coding the left channel audio signal and the right channel audio signal by the first electronic device;

splitting the left channel audio signal and the right channel audio signal into a plurality of first left channel audio signals and a plurality of first right channel audio signals meeting the preset coding duration respectively;

the encoding module is further configured to:

under the condition that the second electronic equipment is in a first wearing state, configuring the first left channel audio signal at a first preset position in a first coding sequence, configuring the first right channel audio signal at a second preset position, coding a plurality of first left channel audio signals and a plurality of first right channel audio signals according to the first coding sequence, and then sending the coded signals to the second electronic equipment;

under the condition that the second electronic equipment is in a second wearing state, the first left channel audio signal is configured at the second preset position in a second coding sequence, the first right channel audio signal is configured at the first preset position, and the plurality of first left channel audio signals and the plurality of first right channel audio signals are coded according to the second coding sequence and then are sent to the second electronic equipment.

8. The electronic device of claim 7, wherein the preset encoding duration is a duration of one frame of audio, or wherein the preset encoding duration is a duration of one signal slot.

9. The electronic device of claim 6, wherein the second electronic device is a headset comprising a left headset and a right headset; in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

10. An electronic device, the electronic device being a second electronic device, the electronic device comprising:

the receiving module is used for receiving the audio signal sent by the first electronic equipment;

the decoding module is used for decoding the audio signals into left channel audio signals and right channel audio signals according to a first decoding sequence under the condition that the second electronic equipment is in a first wearing state;

the decoding module is further configured to: decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

Technical Field

The present invention relates to the field of communications technologies, and in particular, to a method for switching a sound channel and an electronic device.

Background

With the development of wireless communication technology and the gradual expansion of the market, the application of wireless transmission technology of audio, such as bluetooth transmission technology, in wireless communication is also becoming more and more widespread. At present, an electronic device generally decodes an audio file into left and right channel audio information, packages the audio information and sends the audio information to an earphone end, and then a left earphone extracts the left channel audio information from the left channel audio information, and a right earphone extracts the right channel audio information from the right channel audio information, and plays the audio information after amplification. However, when a user wears the left and right earphones reversely, the left and right channel audio information decoded and sent by the electronic device is not transmitted to the corresponding left ear or right ear, and the user often needs to take off the earphones to wear the earphones again, which brings bad listening experience to the user.

Disclosure of Invention

The embodiment of the invention provides a sound channel switching method and electronic equipment, and aims to solve the problem that existing electronic equipment is poor in listening experience of a user because left and right sound channel audio information is not transmitted to corresponding left ears or right ears easily due to the fact that the user wears left and right earphones reversely.

In order to solve the technical problem, the invention is realized as follows:

in a first aspect, an embodiment of the present invention provides a channel switching method, which is applied to a first electronic device, where the first electronic device is connected to a second electronic device, and the channel switching method includes:

acquiring a left channel audio signal and a right channel audio signal;

under the condition that the second electronic equipment is in a first wearing state, the left channel audio signal and the right channel audio signal are coded according to a first coding sequence and then are sent to the second electronic equipment;

under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

In a second aspect, an embodiment of the present invention further provides a channel switching method, which is applied to a second electronic device, where the channel switching method includes:

receiving an audio signal sent by first electronic equipment;

decoding the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence under the condition that the second electronic equipment is in a first wearing state;

decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device is a first electronic device, and the electronic device is connected to a second electronic device, and the electronic device includes:

the acquisition module is used for acquiring a left channel audio signal and a right channel audio signal;

the encoding module is used for encoding the left channel audio signal and the right channel audio signal according to a first encoding sequence and then sending the encoded signals to the second electronic equipment under the condition that the second electronic equipment is in a first wearing state;

the encoding module is further configured to: under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

In a fourth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device is a second electronic device, and the electronic device includes:

the receiving module is used for receiving the audio signal sent by the first electronic equipment;

the decoding module is used for decoding the audio signals into left channel audio signals and right channel audio signals according to a first decoding sequence under the condition that the second electronic equipment is in a first wearing state;

the decoding module is further configured to: decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

In a fifth aspect, embodiments of the present invention further provide an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program, when executed by the processor, implements the steps of the channel switching method according to the first aspect, or the computer program, when executed by the processor, implements the steps of the channel switching method according to the second aspect.

In a sixth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of the channel switching method according to the first aspect, or the computer program, when being executed by the processor, implementing the steps of the channel switching method according to the second aspect.

In the embodiment of the invention, first electronic equipment acquires a left channel audio signal and a right channel audio signal; under the condition that the second electronic equipment is in a first wearing state, the left channel audio signal and the right channel audio signal are coded according to a first coding sequence and then are sent to the second electronic equipment; under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment; wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position. Therefore, the first electronic equipment can automatically complete the switching between the left channel audio and the right channel audio according to the wearing state of the second electronic equipment without changing the wearing state of the second electronic equipment by a user, so that the left channel audio can be still heard by the left ear of the user, the right channel audio can be still heard by the right ear of the user, the user can be guaranteed to have better listening experience, and the user operation is simplified.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.

Fig. 1 is a flowchart of a channel switching method according to an embodiment of the present invention;

FIG. 1a is a schematic diagram of a left channel audio signal and a right channel audio signal encoded according to a first encoding sequence applied to the channel switching method provided in FIG. 1;

FIG. 1b is a schematic diagram of a left channel audio signal and a right channel audio signal encoded according to a second encoding sequence applied to the channel switching method provided in FIG. 1;

fig. 2 is a flowchart of another channel switching method according to an embodiment of the present invention;

FIG. 3 is a block diagram of an electronic device according to an embodiment of the present invention;

FIG. 4 is a block diagram of another electronic device provided by an embodiment of the invention;

fig. 5 is a block diagram of another electronic device provided in an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Referring to fig. 1, fig. 1 is a flowchart of a channel switching method according to an embodiment of the present invention, where the channel switching method is applied to a first electronic device, and the first electronic device is connected to a second electronic device, for example, through a wired connection or a wireless connection, such as a bluetooth connection or a WIFI connection. The first electronic device is an audio transmission device, such as a mobile phone, a computer, a tablet computer and the like; the second electronic device is an audio playing device, such as an earphone, a sound device, and the like.

As shown in fig. 1, the channel switching method includes the steps of:

step 101, obtaining a left channel audio signal and a right channel audio signal.

It is understood that the left channel audio signal and the right channel audio signal may be audio signals to be played or being played by the first electronic device. For example, when the first electronic device receives a touch operation performed by a user on a music play button, the first electronic device plays audio, and the first electronic device can decode the played audio into a left channel audio signal and a right channel audio signal.

And 102, under the condition that the second electronic equipment is in a first wearing state, coding the left channel audio signal and the right channel audio signal according to a first coding sequence and then sending the coded signals to the second electronic equipment.

Optionally, the second electronic device is an earphone, the earphone includes a left earphone and a right earphone, and the wearing state of the earphone is related to the wearing positions of the left earphone and the right earphone. For example, in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the left earphone is worn on the right ear, and the right earphone is worn on the left ear.

In the embodiment of the invention, the first electronic device acquires that the earphone is in the first wearing state, so that the wearing positions of the current left earphone and right earphone can be known, the left channel audio signal and the right channel audio signal can be coded according to the first coding sequence according to the wearing positions of the left earphone and the right earphone, and the coded left channel audio signal and the coded right channel audio signal are sent to the earphone, so that the right channel audio is heard by the right ear of a user, the left channel audio is heard by the left ear, and the better listening experience of the user is ensured.

For example, if the left earphone is worn on the left ear and the right earphone is worn on the right ear in the first wearing state, the first electronic device encodes the left channel audio signal and the right channel audio signal according to the first encoding sequence, so that the left earphone receives the left channel audio signal and the right earphone receives the right channel audio signal. If the left earphone is worn on the right ear and the right earphone is worn on the left ear in the second wearing state, the first electronic device encodes the left channel audio signal and the right channel audio signal according to the first encoding sequence, the left earphone receives the right channel audio signal, and the right earphone receives the left channel audio signal. Therefore, the user can be ensured to have better listening experience.

It should be noted that, before the step 102, the method may further include: and acquiring the wearing state of the second electronic equipment, namely acquiring the wearing positions of the left earphone and the right earphone. Optionally, the left earphone and/or the right earphone may be provided with an infrared sensor, and the first electronic device determines the wearing position of the left earphone and the wearing position of the right earphone by receiving an infrared signal of the infrared sensor. For example, the infrared sensor is arranged on the left earphone, when the left earphone is worn on the left ear, the infrared sensor is in an exposed state, the infrared signal cannot be blocked, and if the left earphone is worn on the right ear, the infrared sensor is close to the helix, and the infrared signal emitted by the infrared sensor is reflected by the helix; the first electronic device may determine a wearing position of the left earphone by detecting a time length for receiving the infrared signal, determine that the left earphone is worn on the left ear if the infrared signal is received within a preset time length, and determine that the left earphone is worn on the right ear if the infrared signal is not received within the preset time length. Of course, the first electronic device may also detect the wearing positions of the left and right earphones by other methods, such as a gravity sensor and an angle sensor, which are not described in detail in this embodiment of the present invention.

And 103, under the condition that the second electronic equipment is in a second wearing state, coding the left channel audio signal and the right channel audio signal according to a second coding sequence and then sending the coded signals to the second electronic equipment.

Wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

It should be noted that, in the first coding sequence and the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged. For example, referring to fig. 1a, in a first coding sequence a1, a left channel audio signal and a right channel audio signal in a frame of audio are coded in the order of left, right, and left; referring to fig. 1b, in the second coding sequence a2, a left channel audio signal and a right channel audio signal in a frame of audio are coded in the order of right, left, and right; wherein, a frame of audio also comprises a delay signal. Alternatively, a plurality of (or one) left channel audio signals as a whole may be alternately arranged with a plurality of (or one) right channel audio signals as a whole, for example, one frame of audio is all left channel audio signals, the next frame of audio is all right channel audio signals, and the next frame of audio is all left channel audio signals … ….

In order to better describe the solution of the embodiment of the present invention, the following description will specifically describe that the second electronic device is an earphone, and the earphone includes a left earphone and a right earphone. Wherein, in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

Therefore, when the headset is in the first wearing state, the left headset is worn on the left ear, the right headset is worn on the right ear, and the first electronic device encodes the left channel audio signal and the right channel audio signal according to the first encoding sequence, so that the left headset receives the left channel audio signal, and the right headset receives the right channel audio signal. When the earphone is in the second wearing state, the left earphone is worn on the right ear, the right earphone is worn on the left ear, the first electronic device encodes the left channel audio signal and the right channel audio signal according to the second encoding sequence, the left earphone receives the right channel audio signal, the right earphone receives the left channel audio signal, the right earphone still receives the right channel audio, and the left earphone still receives the left channel audio. Therefore, even if the wearing positions of the earphones are not right, the earphones do not need to be replaced by a user, the left ear still hears the left channel audio, and the right ear still hears the right channel audio, so that the listening experience of the user is ensured, and the user operation is simplified.

In this embodiment of the present invention, after the step 101, the method may further include:

acquiring a preset coding duration for coding the left channel audio signal and the right channel audio signal by the first electronic device;

splitting the left channel audio signal and the right channel audio signal into a plurality of first left channel audio signals and a plurality of first right channel audio signals meeting the preset coding duration respectively;

in this case, the step 102 includes:

under the condition that the second electronic equipment is in a first wearing state, configuring the first left channel audio signal at a first preset position in a first coding sequence, configuring the first right channel audio signal at a second preset position, coding a plurality of first left channel audio signals and a plurality of first right channel audio signals according to the first coding sequence, and then sending the coded signals to the second electronic equipment;

the step 103 comprises:

under the condition that the second electronic equipment is in a second wearing state, the first left channel audio signal is configured at the second preset position in a second coding sequence, the first right channel audio signal is configured at the first preset position, and the plurality of first left channel audio signals and the plurality of first right channel audio signals are coded according to the second coding sequence and then are sent to the second electronic equipment.

The preset coding duration is duration of a frame of audio, or the preset coding duration is duration of a signal time slot. For example, the preset coding duration is a duration of a signal timeslot, and then one coding duration corresponds to one first left channel audio signal or one first right channel audio signal. Assuming that one frame of audio includes 5 channel audio signal slots and one delay signal slot, one frame of audio also includes 5 channel audio signals; as shown in fig. 1a, in the first coding sequence, 5 channel audio signals included in one frame of audio are respectively a first left channel audio signal, a first right channel audio signal, and a first left channel audio signal, and are sequentially ordered; as shown in fig. 1b, in the second coding sequence, the 5 channel audio signals included in one frame of audio are respectively a first right channel audio signal, a first left channel audio signal, and a first right channel audio signal, and are sequentially ordered. Thus, the coding position of the left channel audio signal in the first coding sequence corresponds to the coding position of the right channel audio signal in the second coding sequence, and the coding position of the right channel audio signal in the first coding sequence corresponds to the coding position of the left channel audio signal in the second coding sequence. It should be noted that the first preset position of the first left channel audio signal configuration is the first position in the first coding sequence; the first preset position of the first right channel audio signal configuration is said first position in the second encoded sequence.

Or, when the encoding duration is the duration of one frame of audio, then the one frame of audio is all left channel audio, or all right channel audio. For example, assuming that the target audio transmitted by the first electronic device includes 3 frames of audio, in the first encoding sequence, a plurality of first left channel audio signals are configured in the first frame of audio and the third frame of audio, and a plurality of first right channel audio signals are configured in the second frame of audio; and configuring a plurality of first right channel audio signals in the first frame audio and the third frame audio and configuring a plurality of first left channel audio signals in the second frame audio in the second coding sequence. In this case, the first position is also the position of the first frame of audio.

In the embodiment of the invention, first electronic equipment acquires a left channel audio signal and a right channel audio signal; under the condition that the second electronic equipment is in a first wearing state, the left channel audio signal and the right channel audio signal are coded according to a first coding sequence and then are sent to the second electronic equipment; under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment; wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position. Therefore, the first electronic equipment can automatically complete the switching between the left channel audio and the right channel audio according to the wearing state of the second electronic equipment without changing the wearing state of the second electronic equipment by a user, so that the left channel audio can be still heard by the left ear of the user, the right channel audio can be still heard by the right ear of the user, the user can be guaranteed to have better listening experience, and the user operation is simplified.

Referring to fig. 2, fig. 2 is a flowchart of another sound channel switching method according to an embodiment of the present invention, where the sound channel switching method is applied to a second electronic device, and the second electronic device is connected to a first electronic device, for example, through a wired connection or a wireless connection, such as a bluetooth connection. The first electronic device is an audio transmission device, such as a mobile phone, a computer, a tablet computer and the like; the second electronic device is an audio playing device, such as an earphone, a sound device, and the like.

As shown in fig. 2, the channel switching method includes the steps of:

step 201, receiving an audio signal sent by a first electronic device.

It is understood that the second electronic device can receive the audio signal transmitted by the first electronic device when connected with the first electronic device. The audio signals comprise coded left channel audio signals and right channel audio signals.

Step 202, decoding the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence under the condition that the second electronic device is in the first wearing state.

In order to better describe the solution of the embodiment of the present invention, the following description will specifically describe that the second electronic device is an earphone, and the earphone includes a left earphone and a right earphone. Wherein, in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

It can be understood that, when the earphone is in the first wearing state, that is, the left earphone is worn on the left ear of the user, and the right earphone is worn on the right ear, the earphone decodes the received audio signal into the left channel audio signal and the right channel audio signal according to the first decoding sequence, so that the left earphone receives the left channel audio signal, and the right earphone receives the right channel audio signal. Therefore, the left ear of the user can hear the left channel audio, and the right ear can hear the right channel audio, so that the user can enjoy better listening experience.

It should be noted that the earphone may be a left earphone or a right earphone for receiving the target audio. For example, the target audio sent by the first electronic device is received by the left earphone, and the left earphone decodes the received target audio to obtain a left channel audio signal and a right channel audio signal, and can send the right channel audio signal to the right earphone.

Step 203, decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state.

Wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position. For example, in the first decoding sequence, the left channel audio signal and the right channel audio signal may be decoded in the order of left, right, left, right … …, and in the second decoding sequence, the left channel audio signal and the right channel audio signal are decoded in the order of right, left, right, left … ….

When the earphone is in the second wearing state, the left earphone is worn on the right ear, the right earphone is worn on the left ear, and the earphone decodes the received audio signals into left channel audio signals and right channel audio signals according to the second decoding sequence, so that the left earphone receives the right channel audio signals, and the right earphone receives the left channel audio signals. Therefore, the left ear of the user still hears the left channel audio, and the right ear still hears the right channel audio, so that the user can enjoy better listening experience.

It should be noted that, the earphone may set the corresponding decoding rule by obtaining the encoding rule of the audio signal by the first electronic device. In the embodiment of the present invention, the earphone may acquire a first encoding rule and a second encoding rule of the first electronic device, and further set a corresponding first decoding rule according to the first encoding rule and set a corresponding second decoding rule according to the second encoding rule; under the first decoding rule, the first electronic equipment encodes the left channel audio signal and the right channel audio signal according to a first encoding sequence, and under the second decoding rule, the left channel audio signal and the right channel audio signal are encoded according to a second encoding sequence.

Or, the first electronic device may also directly send the first decoding rule and the second decoding rule to the headset, so that the headset can decode the left channel audio signal and the right channel audio signal according to the first decoding sequence under the first decoding rule; and decoding the left channel audio signal and the right channel audio signal according to a second decoding sequence under a second decoding rule. Therefore, the flow of the earphone for specifying the decoding rule is simplified, the earphone directly decodes the audio file according to the decoding rule sent by the first electronic device, and the decoding error can be avoided.

In the technical scheme provided by the embodiment of the invention, after the second electronic equipment receives the audio signal sent by the first electronic equipment; decoding the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence under the condition that the second electronic equipment is in a first wearing state; decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state; wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position. Therefore, the second electronic equipment can automatically complete the switching between the left channel audio and the right channel audio based on the wearing state of the second electronic equipment without changing the wearing state of the second electronic equipment by a user, so that the left channel audio and the right channel audio can be still heard by the left ear and the right ear of the user, the user can be guaranteed to have better listening experience, and the user operation is simplified.

Referring to fig. 3, fig. 3 is a structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device is a first electronic device, and the electronic device is connected to a second electronic device. As shown in fig. 3, the electronic device 300 includes:

an obtaining module 301, configured to obtain a left channel audio signal and a right channel audio signal;

the encoding module 302 is configured to, when the second electronic device is in a first wearing state, encode the left channel audio signal and the right channel audio signal according to a first encoding sequence and send the encoded left channel audio signal and right channel audio signal to the second electronic device;

the encoding module 302 is further configured to: under the condition that the second electronic equipment is in a second wearing state, the left channel audio signal and the right channel audio signal are coded according to a second coding sequence and then are sent to the second electronic equipment;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

Optionally, the obtaining module 301 is further configured to:

acquiring a preset coding duration for coding the left channel audio signal and the right channel audio signal by the first electronic device;

splitting the left channel audio signal and the right channel audio signal into a plurality of first left channel audio signals and a plurality of first right channel audio signals meeting the preset coding duration respectively;

the encoding module 302 is further configured to:

under the condition that the second electronic equipment is in a first wearing state, configuring the first left channel audio signal at a first preset position in a first coding sequence, configuring the first right channel audio signal at a second preset position, coding a plurality of first left channel audio signals and a plurality of first right channel audio signals according to the first coding sequence, and then sending the coded signals to the second electronic equipment;

under the condition that the second electronic equipment is in a second wearing state, the first left channel audio signal is configured at the second preset position in a second coding sequence, the first right channel audio signal is configured at the first preset position, and the plurality of first left channel audio signals and the plurality of first right channel audio signals are coded according to the second coding sequence and then are sent to the second electronic equipment.

Optionally, the preset coding duration is a duration of a frame of audio, or the preset coding duration is a duration of a signal timeslot.

Optionally, the second electronic device is an earphone, and the earphone includes a left earphone and a right earphone; in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

It should be noted that, the electronic device 300 can implement each process of the embodiment of the channel switching method described in fig. 1, and can achieve the same technical effect, and for avoiding repetition, details are not described here again.

In the embodiment of the present invention, the electronic device 300 can automatically complete the switching between the left channel audio and the right channel audio according to the wearing state of the second electronic device, without the need of the user to change the wearing state of the second electronic device, so as to ensure that the left ear of the user still listens to the left channel audio and the right ear still listens to the right channel audio, thereby ensuring that the user has better listening experience and simplifying the user operation.

Referring to fig. 4, fig. 4 is a structural diagram of another electronic device according to an embodiment of the present invention, where the electronic device is a second electronic device. As shown in fig. 4, the electronic device 400 includes:

a receiving module 401, configured to receive an audio signal sent by a first electronic device;

a decoding module 402, configured to, when the second electronic device is in the first wearing state, decode the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence;

the decoding module 402 is further configured to: decoding the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence when the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

It should be noted that the electronic device 400 can implement each process of the embodiment of the channel switching method described in fig. 2, and can achieve the same technical effect, and for avoiding repetition, details are not described here again.

In the embodiment of the present invention, the electronic device 400 can automatically complete the switching between the left channel audio and the right channel audio based on the wearing state thereof, and the wearing state of the electronic device 400 does not need to be changed by the user, so as to ensure that the left ear of the user still listens to the left channel audio and the right ear still listens to the right channel audio, thereby ensuring that the user has better listening experience and simplifying the user operation.

Referring to fig. 5, fig. 5 is a block diagram of another electronic device implementing an embodiment of the invention. As shown in fig. 5, the electronic device 500 includes, but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will appreciate that the electronic device configuration illustrated in FIG. 5 does not constitute a limitation of the electronic device 500, and that the electronic device 500 may include more or fewer components than illustrated, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device 500 includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.

In one embodiment of the invention, the electronic device 500 is a first electronic device, and the electronic device 500 is connected to a second electronic device.

Wherein, the processor 510 is configured to:

acquiring a left channel audio signal and a right channel audio signal;

the radio frequency unit 501 is configured to, when the second electronic device is in a first wearing state, encode the left channel audio signal and the right channel audio signal according to a first encoding sequence and send the encoded left channel audio signal and right channel audio signal to the second electronic device;

the radio frequency unit 501 is further configured to, when the second electronic device is in a second wearing state, encode the left channel audio signal and the right channel audio signal according to a second encoding sequence and send the encoded left channel audio signal and right channel audio signal to the second electronic device;

wherein, in the first coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second coding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

Optionally, the processor 510 is further configured to:

acquiring a preset coding duration for coding the left channel audio signal and the right channel audio signal by the first electronic device;

splitting the left channel audio signal and the right channel audio signal into a plurality of first left channel audio signals and a plurality of first right channel audio signals meeting the preset coding duration respectively;

the radio frequency unit 501 is further configured to:

under the condition that the second electronic equipment is in a first wearing state, configuring the first left channel audio signal at a first preset position in a first coding sequence, configuring the first right channel audio signal at a second preset position, coding a plurality of first left channel audio signals and a plurality of first right channel audio signals according to the first coding sequence, and then sending the coded signals to the second electronic equipment;

the radio frequency unit 501 is further configured to configure the first left channel audio signal at the second preset position in a second coding sequence, configure the first right channel audio signal at the first preset position, and encode the plurality of first left channel audio signals and the plurality of first right channel audio signals according to the second coding sequence and send the encoded signals to the second electronic device when the second electronic device is in the second wearing state.

Optionally, the preset coding duration is a duration of a frame of audio, or the preset coding duration is a duration of a signal timeslot.

Optionally, the second electronic device is an earphone, and the earphone includes a left earphone and a right earphone; in the first wearing state, the left earphone is worn on the left ear, and the right earphone is worn on the right ear; in the second wearing state, the right earphone is worn on the left ear, and the left earphone is worn on the right ear.

In this embodiment, the electronic device 500 can implement each process of the embodiment of the channel switching method described in fig. 1, and can achieve the same technical effect, and for avoiding repetition, the details are not described here again.

In another embodiment of the present invention, electronic device 500 is a second electronic device. The radio frequency unit 501 is configured to: receiving an audio signal sent by first electronic equipment;

a processor 510, configured to decode the audio signal into a left channel audio signal and a right channel audio signal according to a first decoding sequence if the second electronic device is in a first wearing state;

a processor 510, further configured to decode the audio signal into the left channel audio signal and the right channel audio signal according to a second decoding sequence if the second electronic device is in a second wearing state;

wherein, in the first decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the left channel audio signal is located at a first position; in the second decoding sequence, the left channel audio signal and the right channel audio signal are alternately arranged, and the right channel audio signal is located at the first position.

In this embodiment, the electronic device 500 can implement each process of the embodiment of the channel switching method described in fig. 2, and can achieve the same technical effect, and for avoiding repetition, the details are not described here again.

It should be understood that, in the embodiment of the present invention, the radio frequency unit 501 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 510; in addition, the uplink data is transmitted to the base station. In general, radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 501 can also communicate with a network and other devices through a wireless communication system.

The electronic device 500 provides the user with wireless broadband internet access via the network module 502, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.

The audio output unit 503 may convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output as sound. Also, the audio output unit 503 may also provide audio output related to a specific function performed by the electronic apparatus 500 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, a receiver, and the like.

The input unit 504 is used to receive an audio or video signal. The input Unit 504 may include a Graphics Processing Unit (GPU) 5041 and a microphone 5042, and the Graphics processor 5041 processes image data of a still image or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 506. The image frames processed by the graphics processor 5041 may be stored in the memory 509 (or other computer-readable storage medium) or transmitted via the radio frequency unit 501 or the network module 502. The microphone 5042 may receive sounds and may be capable of processing such sounds into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 501 in case of the phone call mode.

The electronic device 500 also includes at least one sensor 505, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel 5051 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 5051 and/or a backlight when the electronic device 500 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 505 may also include fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which are not described in detail herein.

The display unit 506 is used to display information input by the user or information provided to the user. The Display unit 506 may include a Display panel 5051, and the Display panel 5051 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.

The user input unit 507 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device 500. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. Touch panel 5071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 5071 using a finger, stylus, or any suitable object or attachment). The touch panel 5071 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 510, and receives and executes commands sent by the processor 510. In addition, the touch panel 5071 may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 5071, the user input unit 507 may include other input devices 5072. In particular, other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.

Further, a touch panel 5071 may be overlaid on the display panel 5051, and when the touch panel 5071 detects a touch operation thereon or thereabout, the touch panel is transmitted to the processor 510 to determine the type of touch event, and then the processor 510 provides a corresponding visual output on the display panel 5051 according to the type of touch event. Although in fig. 5, the touch panel 5071 and the display panel 5051 are implemented as two separate components to implement the input and output functions of the electronic device 500, in some embodiments, the touch panel 5071 and the display panel 5051 may be integrated to implement the input and output functions of the electronic device 500, and are not limited herein.

The interface unit 508 is an interface for connecting an external device to the electronic apparatus 500. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 508 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the electronic apparatus 500 or may be used to transmit data between the electronic apparatus 500 and external devices.

The memory 509 may be used to store software programs as well as various data. The memory 509 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 509 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.

The processor 510 is a control center of the electronic device 500, connects various parts of the whole electronic device 500 by using various interfaces and lines, and performs various functions of the electronic device 500 and processes data by running or executing software programs and/or modules stored in the memory 509 and calling data stored in the memory 509, thereby performing overall monitoring of the electronic device 500. Processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 510.

The electronic device 500 may further include a power supply 511 (e.g., a battery) for supplying power to various components, and preferably, the power supply 511 may be logically connected to the processor 510 via a power management system, so as to implement functions of managing charging, discharging, and power consumption via the power management system.

In addition, the electronic device 500 includes some functional modules that are not shown, and are not described in detail herein.

Optionally, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the above embodiment of the channel switching method, and can achieve the same technical effect, and details are not repeated here to avoid repetition.

An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned embodiment of the channel switching method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.

It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.

The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:红外信号处理方法和装置、电子设备和可读存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类