This application relates to the field of communication technologies, and specifically relates to a sound channel switching method and apparatus, and an electronic device.
Currently, many electronic devices are equipped with a plurality of speakers, and audio of different sound channels is played by using speakers in different orientations, to implement a stereo play effect. Taking an electronic device with four speakers as an example, a left sound channel is generally played by using two speakers at the top of the electronic device, and a right sound channel is played by using two speakers at the bottom to implement a stereo effect. However, when the electronic device switches a state, for example, is rotated or folded, an orientation of a speaker changes. In this case, sound channel signals played by some speakers do not match human ears, thereby affecting a stereo play effect.
According to a first aspect, an embodiment of this application provides a sound channel switching method, applied to an electronic device, where the method includes:
According to a second aspect, an embodiment of this application provides a sound channel switching apparatus, applied to an electronic device, where the sound channel switching apparatus includes:
According to a third aspect, an embodiment of this application provides an electronic device. The electronic device includes a processor, a memory, and a program or an instruction that is stored in the memory and that can be run on the processor, and the program or the instruction is executed by the processor to implement the steps of the sound channel switching method according to the first aspect.
According to a fourth aspect, an embodiment of this application provides a readable storage medium. The readable storage medium stores a program or an instruction, and the program or the instruction is executed by a processor to implement the steps of the sound channel switching method according to the first aspect.
According to a fifth aspect, an embodiment of this application provides a chip. The chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement the steps of the sound channel switching method according to the first aspect.
According to a sixth aspect, an embodiment of this application provides a computer program product. The program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement the steps of the sound channel switching method according to the first aspect.
According to a seventh aspect, an embodiment of this application provides an electronic device. The electronic device is configured to perform the steps of the sound channel switching method according to the first aspect.
The following clearly describes the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Apparently, the described embodiments are some but not all of the embodiments of this application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of this application shall fall within the protection scope of this application.
In the specification and claims of this application, the terms “first”, “second”, and the like are intended to distinguish between similar objects but do not describe a specific order or sequence. It should be understood that, the terms used in such a way is interchangeable in proper circumstances, so that the embodiments of this application can be implemented in an order other than the order illustrated or described herein. Objects classified by “first” and “second” are usually of a same type, and the number of objects is not limited. For example, there may be one or more first objects. In addition, in the specification and the claims, “and/or” represents at least one of connected objects, and a character “/” generally represents an “or” relationship between associated objects.
With reference to the accompanying drawings, a sound channel switching method provided in the embodiments of this application is described in detail by using specific embodiments and application scenarios thereof.
Step 101: Obtain a state change parameter of the electronic device in a case that the electronic device plays audio and a target state of the electronic device changes.
The state change parameter includes a folding angle, a rotation angle, or a scaling amplitude, and the scaling amplitude is a scaling amplitude of a screen of the electronic device.
This embodiment of this application may be applied to an electronic device with a foldable screen, an electronic device with a rollable screen, or a common electronic device, and is applied to an electronic device with a plurality of speakers, for example, an electronic device with four speakers, where two speakers are disposed on the top of the electronic device, and two speakers are disposed on the bottom of the electronic device. For the foldable or electronic device with a rollable screen, when the electronic device is in a stretched state, one speaker at the top and one speaker at the bottom are on the left side of the electronic device, and the other speaker at the top and the other speaker at the bottom are on the right side of the electronic device. When the electronic device switches from a portrait state to a landscape state, the two speakers at the top are located on the left or right side of the electronic device, and correspondingly, the two speakers at the bottom are located on the right or left side of the electronic device.
The target state may be a folding state, a rotation state, a scaling state, or the like, and correspondingly, the state change parameter may be a folding angle, a rotation angle, a scaling amplitude, or the like.
For the electronic device with a foldable screen, a folding angle of the electronic device may be obtained when a folding state of the electronic device with a foldable screen changes, for example, when the electronic device with a foldable screen is folded or stretched. This may be specifically obtained by detecting the folding angle in real time.
When a rotation state of the electronic device changes, for example, the electronic device is rotated clockwise or counterclockwise to switch between landscape use and portrait use, the rotation angle of the electronic device may be specifically obtained by detecting the rotation angle in real time.
For the electronic device with a rollable screen, a scaling amplitude of the electronic device may be obtained when a scaling state of the electronic device changes, for example, a rollable screen is stretched or contracted. This may be obtained by detecting the scaling amplitude in real time.
In the related technology, when the electronic device is in a normal portrait state, a speaker at the top generally plays audio on a left sound channel, and a speaker at the bottom plays audio on a right sound channel. However, when the electronic device is rotated, folded, or scaled, orientations of some speakers of the electronic device change accordingly. For example, as shown in
In this embodiment of this application, considering that orientations of some speakers of the electronic device change when the target state of the electronic device changes, if an existing playing sound channel of each speaker keeps unchanged, some left speakers may play audio on a right sound channel, and some right speakers may play audio on a left sound channel, which do not match human hearing, and affects a human sense of hearing, that is, a stereo play effect becomes poor. Therefore, to obtain a better stereo play effect, sound channels may be switched for speakers whose orientations change and playing sound channels do not match current orientations, to ensure that sound channel audio played by each speaker of the electronic device after the target state changes keep matching with human ears. In addition, to ensure an audio play effect in the process of changing the target state and avoid problems such as stuttering or silence, sound channel signals of these speakers may be fused according to a real-time state change parameter of the electronic device. For example, for a speaker that originally plays a left sound channel signal, the left sound channel signal and the sound right sound channel signal may be fused in a corresponding ratio according to a current state change parameter, so that the speaker plays a fused sound channel signal.
Step 102: Fuse a first sound channel signal and a second sound channel signal according to the state change parameter in a first fusion manner to obtain a third sound channel signal, and fuse the first sound channel signal and the second sound channel signal in a second fusion manner to obtain a fourth sound channel signal.
Therefore, in this step, the first sound channel signal and the second sound channel signal in audio currently played by the electronic device may be obtained. Specifically, different sound channel signals may be obtained in real time from an audio digital signal processor (aDSP), where the first sound channel signal and the second sound channel signal may be respectively a left sound channel signal and a right sound channel signal. Certainly, the first sound channel signal and the second sound channel signal may be sound channel signals other than the left sound channel signal and the right sound channel signal in a scenario in which there are more sound channels such as a front sound channel and a back sound channel.
Then, the first sound channel signal and the second sound channel signal may be fused according to the current state change parameter of the electronic device in the first fusion manner, to obtain the fused third sound channel signal, and the first sound channel signal and the second sound channel signal may be fused in the second fusion manner, to obtain the fused fourth sound channel signal. Specifically, a fusion ratio coefficient may be determined based on the state change parameter, and one sound channel signal is fused to another sound channel signal according to the ratio coefficient. For example, when it is determined that the fusion ratio coefficient is 0.3, the first fusion manner may be that the second sound channel signal is multiplied by 0.3 to be fused into the first sound channel signal, and the second fusion manner may be that the first sound channel signal is multiplied by 0.3 to be fused into the second sound channel signal. Alternatively, the first sound channel signal and the second sound channel signal may be fused according to a ratio of 7:3 to obtain the third sound channel signal, and the first sound channel signal and the second sound channel signal may be fused according to a ratio of 3:7 to obtain the fourth sound channel signal.
It should be noted that, after the target state of the electronic device changes to a desired state, for example, after the screen is completely stretched or is switched from a portrait state to a landscape state, the first fusion manner may be switching the first sound channel signal to the second sound channel signal, and the second fusion manner may be switching the second sound channel signal to the first sound channel signal. In this case, the third sound channel signal is the second sound channel signal, and the fourth sound channel signal is the first sound channel signal.
Optionally, step 102 includes:
That is, in an embodiment, when the first sound channel signal and the second sound channel signal are fusing, spectrum amplitude values of the first sound channel signal and the second sound channel signal may be separately obtained in frequency domain, so as to obtain the first spectrum amplitude value and the second spectrum amplitude value. Then, the determining a fusion component according to the state change parameter, the first spectrum amplitude value, and the second spectrum amplitude value may be specifically determining a change ratio of the target state based on the state change parameter, and using a corresponding ratio of a difference between the first spectrum amplitude value and the second spectrum amplitude value as the fusion component of the sound channel signal.
Then, first operation processing such as simple addition/subtraction processing or weighting processing may be performed on the first spectrum amplitude value and the fusion component to obtain the third spectrum amplitude value, and second operation processing such as simple addition/subtraction processing or weighting processing is performed on the second spectrum amplitude value and the fusion component to obtain the fourth spectrum amplitude value, where the third spectrum amplitude value is a spectrum amplitude value of the fused third sound channel signal, and the fourth spectrum amplitude value is a spectrum amplitude value of the fused fourth sound channel signal. The third spectrum amplitude value and the fourth spectrum amplitude value may be separately converted into sound channel signals in time domain, to obtain the third sound channel signal and the fourth sound channel signal.
In this way, in this embodiment, corresponding fusion may be performed on the first sound channel signal and the second sound channel signal according to a state change of the electronic device, to ensure a stereo play effect after channel switching.
When the spectrum amplitude values of the first sound channel signal and the second sound channel signal are obtained, amplitude characteristics in frequency domain may be obtained by obtaining time domain signal characteristics of the signals and then performing transform on the time domain signal characteristics. In other words, the separately obtaining a first spectrum amplitude value of the first sound channel signal and a second spectrum amplitude value of the second sound channel signal may include:
That is, the amplitude characteristics of the first sound channel signal and the second sound channel signal in frequency domain may be separately obtained, and then Fourier transform is separately performed on the amplitude characteristics of the first sound channel signal and the second sound channel signal in frequency domain. Finally, the transform amplitude characteristics are converted into spectrum amplitude values, to obtain the first spectrum amplitude value of the first sound channel signal and the second spectrum amplitude value of the second sound channel signal.
For example, an amplitude characteristic X1 of a left sound channel signal x1 in frequency domain and an amplitude characteristic X2 of a right sound channel signal x2 in frequency domain may be obtained in real time from the aDSP, and fast Fourier transform is performed on the left and right sound channel signals. A transform formula is X(k)=Σj=1Nx(j)ωN(i−1)(k−1), where ωN=e(−2πi)N. Then, the amplitude characteristics are obtained by transforming the left and right sound channel signals are converted into spectrum amplitude values, where the spectrum amplitude value of the left sound channel signal may be represented as X1(k)′=|20×log10X1(k)|, and the spectrum amplitude value of the right sound channel signal may be represented as X2(k)′=|20×log10 X2(k)|.
In this way, the spectrum amplitude values of the first sound channel signal and the second sound channel signal can be quickly obtained in this embodiment.
Optionally, the determining a fusion component according to the state change parameter, the first spectrum amplitude value, and the second spectrum amplitude value includes:
That is, in an embodiment, the state coefficient may be determined according to the state change parameter and the maximum change value of the target state. For example, the state coefficient may be determined according to a ratio of the state change parameter to the maximum change value of the target state, and then the product of the difference between the first spectrum amplitude value and the second spectrum amplitude value and the state coefficient is used as the fusion component.
The maximum change value of the target state may be specifically determined according to a specific type of the target state or a type of the state change parameter. In an embodiment, when the state change parameter is a folding angle, the maximum change value of the target state is 180 degrees;
For example, for folding state, because a maximum folding angle is 180 degrees, the maximum change value of the folding state may be 180 degrees. For a rotation state, considering that an orientation of a speaker changes each time when the electronic device with a foldable screen is rotated by 90 degrees in a stretched state, so as a maximum value of the rotation state may be determined as 90 degrees. In another case, for the common electronic device, a case that the electronic device is flipped leftwards and rightwards in a landscape state may also be considered, and in this case, a maximum value of the rotation state may be 180 degrees each time. For a scaling state, a maximum scaling amplitude of a screen such as a rollable screen of the electronic device may be a maximum value of the scaling state, that is, the maximum scaling amplitude is a difference between a screen length of the rollable screen when the rollable screen is fully stretched and a screen length of the rollable screen when the rollable screen is completely contracted.
A maximum folding angle of 180 degrees is used as an example. It is assumed that a current folding angle is a, and a state coefficient σ may be α/180°. An expected fusion component delta may be obtained by multiplying a difference between spectrum amplitude values of left and right sound channels (that is, a frequency domain characteristic difference between the two sound channels) by the state coefficient σ, that is, delta=σ·[X1(k)′−X2(k)′], where 0≤σ≤1.
In this way, the fusion component that is consistent with the change of the target state can be quickly obtained by means of calculation in this implementation, to ensure a subsequent sound channel fusion effect.
Optionally, the performing first operation processing on the first spectrum amplitude value and the fusion component to obtain a third spectrum amplitude value of the fused third sound channel signal includes:
That is, after the fusion component is determined in the foregoing manner, the fusion component may be added to or subtracted from the spectrum amplitude values of the first sound channel signal and the second sound channel signal to obtain the spectrum amplitude values of the fused sound channel signals. Specifically, the fusion component is subtracted from the first spectrum amplitude value to obtain the third spectrum amplitude value of the fused third sound channel signal, and the second spectrum amplitude value is added to the fusion component to obtain the fourth spectrum amplitude value of the fused fourth sound channel signal.
For example, when the fusion component is delta=σ·[X1(k)′−X2(k)′], a spectrum amplitude value of a fused new left sound channel may be X1 (k)′-delta, and a spectrum amplitude value of a fused new right sound channel may be X2(k)′+delta.
It should be noted that, when the fusion component is calculated in the foregoing manner, the difference between the second spectrum amplitude value and the first spectrum amplitude value may be multiplied by the state coefficient to obtain the fusion component, that is, delta=σ·[X2(k)′−X1(k)′]. In this calculation manner, the first spectrum amplitude value may be correspondingly added to the fusion component to obtain the fused third spectrum amplitude value, and the fusion component is subtracted from the second spectrum amplitude value to obtain the fused fourth spectrum amplitude value.
After the fused sound channel spectrum amplitude value is obtained by means of calculation, the fused sound channel spectrum amplitude value may be restored to a time domain signal, that is, fast Fourier inverse transform may be performed on the third spectrum amplitude value and the fourth spectrum amplitude value to obtain the third sound channel signal and the fourth sound channel signal in time domain. A calculation formula of fast Fourier inverse transform may be X′(k)=(1/N)Σk=1Nx′(k)ωN−(j−1)(k−1), where ωN=e(−2πi)/N.
In this way, simple calculation processing is performed on the spectrum amplitude values of the two sound channel signals based on the state coefficient in this implementation, so that the two sound channel signals can be fused and switched. In addition, the two sound channel signals are fused in ratio according to the state variable amount, thereby ensuring a smooth sound channel fusing effect.
Step 103: Control a first speaker to switch from playing the first sound channel signal to playing the third sound channel signal, and control a second speaker to switch from playing the second sound channel signal to playing the fourth sound channel signal, where before a sound channel signal is switched, sound channels played by the first speaker and the second speaker do not match orientations in which the first speaker and the second speaker are located.
After the first sound channel signal and the second sound channel signal are fused, an orientation may be changed according to a current change of the target state, so that sound channel switching is performed on a speaker whose original playing sound channel does not match the current orientation. Specifically, for a speaker whose playing sound channel is the first sound channel signal before the target state changes and whose sound channel signal does not match the current orientation, the playing sound channel may be switched to the third sound channel signal, and for a speaker whose playing sound channel is the second sound channel signal before the target state changes and whose sound channel signal does not match the current orientation, the playing sound channel may be switched to the fourth sound channel signal, to complete the playing sound channel of the speaker switching following the target state.
The first speaker may be a speaker whose original playing sound channel is the first sound channel signal and whose orientation is about to change with the change of target state or is no longer suitable for the first sound channel signal after the change. The second speaker may be a speaker whose original playing sound channel is the second sound channel signal and whose orientation changes with the target state and is about to change or is no longer suitable for the second sound channel signal after the change.
For example, when the electronic device 20 is switched from a folding state shown in
Optionally, before step 103, the method further includes:
That is, in an implementation, when it is detected that the target state of the electronic device changes, an orientation of each speaker of the electronic device after the target state changes may be predicted. For example, for an electronic device with a foldable screen, when the electronic device with a foldable screen is gradually stretched from a folding state, an orientation of each speaker at the top and at the bottom after the stretching may be predicted, or when the electronic device switches from a portrait state to a landscape state, an orientation of each speaker after the switching may be predicted.
It may be determined, according to the predicted orientation, whether a sound channel currently played by each speaker matches the changed orientation. For example, as shown in
In this way, a speaker whose sound channel needs to be switched may be determined according to an orientation of each speaker after the target state changes and the currently played sound channel signal, and the first speaker and the second speaker are further determined according to a playing sound channel of the speaker whose sound channel needs to be switched. In this implementation, the speaker with the to-be-switched sound channel can be determined more accurately and quickly.
With reference to
When the electronic device 20 with a foldable screen plays music or a video in a folding state, the top speaker 21 and the top speaker 23 (or the bottom speaker 22 and the bottom speaker 24) play audio on a left sound channel, and the bottom speaker 22 and the bottom speaker 24 (or the top speaker 21 and the top speaker 23) play audio on a right sound channel.
When the electronic device 20 with a foldable screen plays music or a video in a stretched state, the top speaker 21 and the bottom speaker 22 (or the top speaker 23 and the bottom speaker 24) play audio on a left sound channel, and the top speaker 23 and the bottom speaker 24 (or the top speaker 21 and the bottom speaker 22) play audio on a right sound channel.
When the electronic device 20 with a foldable screen changes between the two states: from being folded to being stretched or being stretched to being folded, playing sound channels of the top speaker 21 and the bottom speaker 24 (or the bottom speaker 22 and the top speaker 23) remain unchanged, and the bottom speaker 22 and the top speaker 23 (or the top speaker 21 and the bottom speaker 24) perform sound channel fusion switching as the folding state changes. When the state coefficient σ is transited from 0 to 1 (or from 1 to 0), sound channel switching is completed and ended. That is, when the change of the electronic device 20 with a foldable screen between the two states: from being folded to being stretched (or being stretched to being folded), all switching between the left and right sound channels is implemented.
As shown in
In
In
In
In
A sound channel fusion switching principle is the same as that in the foregoing manner. Frequency domain approximation may be performed following a device state coefficient σ, and left and right sound channel signals are separately processed to perform sound channel fusion switching, where σ is a ratio of an angle of screen flip. As shown in
Starting from
The top speaker 21 sequentially performs sound channel fusion switching from the left sound channel, the right sound channel, and the right sound channel to the left sound channel.
The bottom speaker 22 sequentially performs sound channel fusion switching from the left sound channel, the left sound channel, and the right sound channel to the right sound channel.
The top speaker 23 sequentially performs sound channel fusion switching from the right sound channel, the right sound channel, and the left sound channel to the left sound channel.
The bottom speaker 24 sequentially performs sound channel fusion switching from the right sound channel, the left sound channel, and the left sound channel to the right sound channel.
In this way, when the electronic device 20 with a foldable screen is stretched to play music or a video, sound channel fusion switching may be smoothly performed regardless of how a placement state is switched, and no phenomenon of interruption or stuttering occurs in a sound switching process.
For example, in a process in which the electronic device 20 with a foldable screen rotates from
According to the sound channel fusion switching technology in this embodiment of this application, in the foregoing four placement states, It can be achieved that two speakers on the left side play audio on a left sound channel, and two speakers on the right side play audio on a right sound channel. Regardless of the placement state, a phase of sound can be synchronized with a video picture. In addition, in a sound channel switching process, smooth fusion switching can be implemented, so that the user can obtain user auditory experience with a strong sense of science and technology.
As shown in
In
In
A sound channel fusion switching principle is the same as that in the foregoing manner. Frequency domain approximation is performed as a device state coefficient σ, and left and right sound channel signals are separately processed to perform sound channel fusion switching, where σ is a ratio of an angle of screen flip. As shown in
In this way, the electronic device switches between the two placement states in a landscape state, so that a phase of sound can be synchronized with a video picture. The left speaker plays audio on a left sound channel and the right speaker plays audio on a right sound channel. In addition, in a sound channel switching process, no interruption or stuttering occurs, and smooth fusion switching is implemented, so that the user can obtain user auditory experience with a strong technological sense.
The sound channel fusion switching method in this embodiment of this application may also be applied to an electronic device with a rollable screen with four speakers, and sound channel fusion switching of a speaker may be implemented according to a scaling state of a rollable screen. For example, in a roll-up state, that is, a contracted state, two speakers on the top play audio on a left sound channel, and two speakers on the bottom play audio on a right sound channel. In a stretched state, the left two speakers are switched to play audio on the left sound channel, and the right two speakers are switched to play audio on the right sound channel, to implement a large-screen stereo sound effect. In a process of stretching or rolling up, the sound channel fusion switching method described in this embodiment of this application may be used to implement a smooth switching effect without stuttering and improve user auditory experience.
In the sound channel switching method in this embodiment of this application, a state change parameter of an electronic device is obtained in a case that the electronic device plays audio and a target state of the electronic device changes, where the state change parameter includes a folding angle, a rotation angle, or a scaling amplitude, and the scaling amplitude is a scaling amplitude of a screen of the electronic device; a first sound channel signal and a second sound channel signal are fused according to the state change parameter in a first fusion manner to obtain a third sound channel signal, and the first sound channel signal and the second sound channel signal are fused in a second fusion manner to obtain a fourth sound channel signal; and a first speaker is controlled to switch from playing the first sound channel signal to playing the third sound channel signal, and a second speaker is controlled to switch from playing the second sound channel signal to playing the fourth sound channel signal, where before a sound channel signal is switched, sound channels played by the first speaker and the second speaker do not match orientations in which the first speaker and the second speaker are located. In this way, when the target state of the electronic device changes, sound channel signals of speakers whose orientations change are fused according to the state change parameter, to ensure that a sound channel signal played by each speaker matches an orientation in which the speaker is located, thereby implementing smooth sound channel switching, and ensuring that the electronic device can obtain a better stereo play effect in a process of changing the target state.
It should be noted that, the sound channel switching method provided in the embodiments of this application may be performed by a sound channel switching apparatus, or a control module that is in the sound channel switching apparatus and that is configured to perform the sound channel switching method. In the embodiments of this application, that the sound channel switching apparatus performs the sound channel switching method is used as an example to describe the sound channel switching apparatus provided in the embodiments of this application.
Optionally, the processing module 502 includes:
Optionally, the determining unit includes:
Optionally, the first processing unit is configured to subtract the fusion component from the first spectrum amplitude value to obtain the third spectrum amplitude value; and
Optionally, when the state change parameter is a folding angle, the maximum change value of the target state is 180 degrees;
Optionally, the obtaining unit includes:
Optionally, the sound channel switching apparatus 500 further includes:
According to the sound channel switching apparatus in this embodiment of this application, a state change parameter of an electronic device is obtained in a case that the electronic device plays audio and a target state of the electronic device changes, where the state change parameter includes a folding angle, a rotation angle, or a scaling amplitude, and the scaling amplitude is a scaling amplitude of a screen of the electronic device; a first sound channel signal and a second sound channel signal are fused according to the state change parameter in a first fusion manner to obtain a third sound channel signal, and the first sound channel signal and the second sound channel signal are fused in a second fusion manner to obtain a fourth sound channel signal; and a first speaker is controlled to switch from playing the first sound channel signal to playing the third sound channel signal, and a second speaker is controlled to switch from playing the second sound channel signal to playing the fourth sound channel signal, where before a sound channel signal is switched, sound channels played by the first speaker and the second speaker do not match orientations in which the first speaker and the second speaker are located. In this way, when the target state of the electronic device changes, sound channel signals of speakers whose orientations change are fused according to the state change parameter, to ensure that a sound channel signal played by each speaker matches an orientation in which the speaker is located, thereby implementing smooth sound channel switching, and ensuring that the electronic device can obtain a better stereo play effect in a process of changing the target state.
The sound channel switching apparatus in this embodiment of this application may be an apparatus, or may be a component, an integrated circuit, or a chip in a terminal. The apparatus may be a mobile electronic device, or may be a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a palmtop computer, an in-vehicle electronic terminal, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA). The non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an automated teller machine, or a self-service machine. This is not specifically limited in this embodiment of this application.
The sound channel switching apparatus in this embodiment of this application may be an apparatus with an operating system. The operating system may be an Android operating system, an iOS operating system, or another possible operating system. This is not specifically limited in this embodiment of this application.
The sound channel switching apparatus provided in this embodiment of this application can implement the processes implemented in the method embodiments in
Optionally, as shown in
It should be noted that the electronic device in this embodiment of this application includes the foregoing mobile electronic device and the foregoing non-mobile electronic device.
An electronic device 700 includes but is not limited to components such as a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710.
A person skilled in the art can understand that the electronic device 700 may further include a power supply (such as a battery) that supplies power to each component. The power supply may be logically connected to the processor 710 by using a power supply management system, to implement functions such as charging and discharging management, and power consumption management by using the power supply management system. The structure of the electronic device shown in
The processor 710 is configured to obtain a state change parameter of the electronic device in a case that the electronic device plays audio and a target state of the electronic device changes, where the state change parameter includes a folding angle, a rotation angle, or a scaling amplitude, and the scaling amplitude is a scaling amplitude of a screen of the electronic device;
Optionally, the processor 710 is further configured to separately obtain a first spectrum amplitude value of the first sound channel signal and a second spectrum amplitude value of the second sound channel signal;
Optionally, the processor 710 is further configured to determine a state coefficient according to the state change parameter and a maximum change value of the target state; and
Optionally, the processor 710 is further configured to subtract the fusion component from the first spectrum amplitude value to obtain the third spectrum amplitude value; and
Optionally, when the state change parameter is a folding angle, the maximum change value of the target state is 180 degrees;
Optionally, the processor 710 is further configured to separately obtain a first amplitude characteristic of the first sound channel signal in frequency domain and a second amplitude characteristic of the second sound channel signal in frequency domain; and
Optionally, the processor 710 is further configured to predict an orientation of each speaker in a plurality of speakers of the electronic device after the target state of the electronic device changes; and
According to the electronic device in this embodiment of this application, a state change parameter of the electronic device is obtained in a case that the electronic device plays audio and a target state of the electronic device changes, where the state change parameter includes a folding angle, a rotation angle, or a scaling amplitude, and the scaling amplitude is a scaling amplitude of a screen of the electronic device; a first sound channel signal and a second sound channel signal are fused according to the state change parameter in a first fusion manner to obtain a third sound channel signal, and the first sound channel signal and the second sound channel signal are fused in a second fusion manner to obtain a fourth sound channel signal; and a first speaker is controlled to switch from playing the first sound channel signal to playing the third sound channel signal, and a second speaker is controlled to switch from playing the second sound channel signal to playing the fourth sound channel signal, where before a sound channel signal is switched, sound channels played by the first speaker and the second speaker do not match orientations in which the first speaker and the second speaker are located. In this way, when the target state of the electronic device changes, sound channel signals of speakers whose orientations change are fused according to the state change parameter, to ensure that a sound channel signal played by each speaker matches an orientation in which the speaker is located, thereby implementing smooth sound channel switching, and ensuring that the electronic device can obtain a better stereo play effect in a process of changing the target state.
It should be understood that, in this embodiment of this application, the audio output unit 703 may be a speaker. The input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042, and the graphics processing unit 7041 processes image data of a still picture or video obtained by an image capture apparatus (such as a camera) in a video capture mode or an image capture mode. The display unit 706 may include a display panel 7061. Optionally, the display panel 7061 may be configured in a form such as a liquid crystal display or an organic light-emitting diode. The user input unit 707 includes a touch panel 7071 and another input device 7072. The touch panel 7071 is also referred to as a touchscreen. The touch panel 7071 may include two parts: a touch detection apparatus and a touch controller. The another input device 7072 may include but is not limited to a physical keyboard, a functional button (such as a volume control button or a power on/off button), a trackball, a mouse, and a joystick. Details are not described herein. The memory 709 may be configured to store a software program and various data, including but not limited to an application and an operating system. An application processor and a modem processor may be integrated into the processor 710, the application processor mainly processes an operating system, a user interface, an application, and the like, and the modem processor mainly processes wireless communication. It can be understood that, alternatively, the modem processor may not be integrated into the processor 710.
An embodiment of this application further provides a readable storage medium. The readable storage medium stores a program or an instruction, and the program or the instruction is executed by a processor to implement the processes of the foregoing sound channel switching method embodiment and a same technical effect can be achieved. To avoid repetition, details are not described herein again.
The processor is a processor in the electronic device in the foregoing embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
An embodiment of this application further provides a chip. The chip includes a processor and a communications interface, the communications interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement the processes of the foregoing sound channel switching method embodiment, and a same technical effect can be achieved. To avoid repetition, details are not described herein again.
It should be understood that the chip mentioned in this embodiment of this application may also be referred to as a system-level chip, a system chip, a chip system, or an on-chip system chip.
An embodiment of this application further provides a computer software product. The computer software product is stored in a non-transient storage medium, and the computer software product is executed by at least one processor to implement the processes of the foregoing sound channel switching method embodiment, and a same technical effect can be achieved. To avoid repetition, details are not described herein again.
It should be noted that, in this specification, the terms “include”, “comprise”, or their any other variant is intended to cover a non-exclusive inclusion, so that a process, a method, an article, or an apparatus that includes a list of elements not only includes those elements but also includes other elements which are not expressly listed, or further includes elements inherent to such process, method, article, or apparatus. An element limited by “including a . . . ” does not, without more constraints, preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element. In addition, it should be noted that the scope of the method and the apparatus in the embodiments of this application is not limited to performing functions in an illustrated or discussed sequence, and may further include performing functions in a basically simultaneous manner or in a reverse sequence according to the functions concerned. For example, the described method may be performed in an order different from that described, and the steps may be added, omitted, or combined. In addition, features described with reference to some examples may be combined in other examples.
Based on the descriptions of the foregoing implementations, a person skilled in the art may clearly understand that the method in the foregoing embodiment may be implemented by software in addition to a necessary universal hardware platform or by hardware only. In most circumstances, the former is a preferred implementation. Based on such an understanding, the technical solutions of this application essentially or the part contributing to the prior art may be implemented in a form of a computer software product. The computer software product is stored in a storage medium (such as a ROM/RAM, a hard disk, or an optical disc), and includes several instructions for instructing a terminal (which may be mobile phone, a computer, a server, a network device, or the like) to perform the methods described in the embodiments of this application.
The embodiments of this application are described above with reference to the accompanying drawings, but this application is not limited to the above specific implementations, and the above specific implementations are only illustrative and not restrictive. Under the enlightenment of this application, those of ordinary skill in the art can make many forms without departing from the purpose of this application and the protection scope of the claims, all of which fall within the protection of this application.
Number | Date | Country | Kind |
---|---|---|---|
202110901164.1 | Aug 2021 | CN | national |
This application is a continuation of PCT International Application No. PCT/CN2022/109706 filed on Aug. 2, 2022, which claims priority to Chinese Patent Application No. 202110901164.1 filed on Aug. 6, 2021, which are incorporated herein by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/109706 | Aug 2022 | WO |
Child | 18433537 | US |