Electronic device and method for detecting error of a signal
An electronic device is provided. The electronic device includes a microphone. The electronic device includes a speaker. The electronic device includes a communication circuit. The electronic device includes at least one processor. The at least one processor is configured to obtain a second signal based on decoding a first signal received through the communication circuit from an external electronic device. The at least one processor is configured to output a third signal through the speaker obtained based on executing decompression the second signal. The at least one processor is configured to compensate the second signal based on a difference between the second signal and the third signal representing a distortion of the third signal, in response to obtaining an input signal including the output third signal through the microphone. The at least one processor is configured to execute cancellation of an echo of the input signal based on the compensated second signal.
1 . An electronic device, comprising:
a microphone;
a speaker;
a communication circuit;
memory storing instructions; and
at least one processor comprising processing circuitry,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on decoding a first signal received through the communication circuit from an external electronic device, obtain a second signal,
obtain a third signal to be output through the speaker based on executing decompression for the second signal,
obtain a fourth signal to be used for echo cancellation, based on processing the second signal,
compare the second signal with the fourth signal,
based on the fourth signal being identified via the comparison as including a distortion, compensate the second signal to provide a compensated second signal,
output, through the speaker, the third signal,
while the third signal is output, obtain an input signal through the microphone, and
execute echo cancellation with respect to the input signal based on the compensated second signal.
2 . The electronic device of claim 1 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to transmit to the external electronic device a fifth signal obtained based on encoding the echo cancelled input signal.
3 . The electronic device of claim 1 , further comprising,
a plurality of speakers including the speaker and another speaker,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
obtain a sixth signal to be output through the another speaker based on executing decompression for the second signal,
obtain a seventh signal to be used for echo cancellation, based on processing the second signal,
compare the sixth signal with the seventh signal,
based on the seventh signal being identified as including a distortion via the comparison with the sixth signal and the seventh signal, compensate the second signal to provide the compensated second signal,
output, through the another speaker, the sixth signal, and
while the sixth signal is output, obtain another input signal through the microphone, and
execute echo cancellation with respect to the another input signal based on the compensated second signal.
4 . The electronic device of claim 1 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on the fourth signal being identified via the comparison as including the distortion, in accordance with information on the second signal and information on the fourth signal, compensate for sound quality or volume of the second signal.
5 . The electronic device of claim 4 ,
wherein the information on the second signal includes at least one of a frequency of the second signal, a gain of the second signal, or information on a degree of delay of the second signal, and
wherein the information on the fourth signal includes at least one of a frequency of the fourth signal, a gain of the fourth signal, or information on a degree of delay of the fourth signal.
6 . The electronic device of claim 1 ,
wherein the distortion included in the fourth signal is associated with the processing of the second signal or a path obtaining the fourth signal.
7 . The electronic device of claim 1 ,
wherein the instructions when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on the fourth signal being identified via the comparison as including the distortion, refrain from executing echo cancellation with respect to the input signal based on the fourth signal.
8 . The electronic device of claim 1 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on the fourth signal being identified via the comparison as not including the distortion, execute echo cancellation with respect to the input signal based on the fourth signal.
9 . The electronic device of claim 1 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on the fourth signal being identified via the comparison as not including the distortion, refrain from executing echo cancellation with respect to the input signal based on the second signal.
10 . The electronic device of claim 1 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
identify, via the comparison, the fourth signal including the distortion,
based on the fourth signal being identified as corresponding to an analog signal:
compensate for the second signal, and
execute the echo cancellation with respect to the input signal based on the compensated second signal, and
based on the fourth signal being identified as corresponding to a digital signal:
refrain from compensating for the second signal, and
execute echo cancellation with respect to the input signal based on the second signal.
11 . A method performed by an electronic device including a microphone, a speaker, and a communication circuit, the method comprising:
based on decoding a first signal received through the communication circuit from an external electronic device, obtaining a second signal,
obtaining a third signal to be output through the speaker based on executing decompression for the second signal,
obtaining a fourth signal to be used for echo cancellation, based on processing the second signal,
comparing the second signal with the fourth signal,
based on the fourth signal being identified via the comparison as including a distortion, compensating for the second signal,
outputting, through the speaker, the third signal,
while the third signal is output, obtaining an input signal through the microphone, and
executing echo cancellation with respect to the input signal based on the compensated second signal.
12 . The method of claim 11 , comprising:
transmitting to the external electronic device a fifth signal obtained based on encoding the echo cancelled input signal.
13 . The method of claim 11 ,
wherein the electronic device includes a plurality of speakers including the speaker and another speaker, and
wherein the method comprises:
obtaining a sixth signal to be output through the another speaker based on executing decompression for the second signal,
obtaining a seventh signal to be used for echo cancellation, based on processing the second signal,
comparing the sixth signal with the seventh signal,
based on the seventh signal being identified as including a distortion via the comparison with the sixth signal and the seventh signal, compensating for the second signal,
outputting, through the another speaker, the sixth signal, and
while the sixth signal is output, obtaining another input signal through the microphone, and
executing echo cancellation with respect to the another input signal based on the compensated second signal.
14 . The method of claim 11 , comprising:
based on the fourth signal being identified via the comparison as including the distortion, in accordance with information on the second signal and information on the fourth signal, compensating for sound quality or volume of the second signal.
15 . An electronic device, comprising:
a microphone;
a speaker;
memory storing instructions;
a communication circuit; and
at least one processor comprising processing circuitry,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
based on decoding a first signal received through the communication circuit from an external electronic device, obtain a second signal,
obtain a third signal in which a pilot signal is added to the second signal,
output a fourth signal through the speaker obtained based on executing decompression for the third signal,
detect a distortion of the pilot signal included in an input signal, in response to obtaining the input signal including the output fourth signal through the microphone,
based on detecting the distortion of the pilot signal, compensate the second signal to provide a compensated second signal in accordance with a difference between the second signal and the fourth signal representing the distortion of the pilot signal, and
execute echo cancellation with respect to the input signal based on the compensated second signal.
16 . The electronic device of claim 15 ,
wherein the pilot signal includes a signal on inaudible frequency or a unit impulse signal.
17 . The electronic device of claim 15 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to transmit, to the external electronic device, a fifth signal obtained based on encoding the echo cancelled input signal.
18 . The electronic device of claim 15 ,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the at least one processor to:
identify the difference representing the distortion of the pilot signal based on information on the second signal and information on the fourth signal,
compensate sound quality or volume of the second signal based on information on the difference,
wherein the information on the second signal includes at least one of a frequency of the second signal, a gain of the second signal, or information on a degree of delay of the second signal, and
wherein the information on the fourth signal includes at least one of a frequency of the fourth signal, a gain of the fourth signal, or information on a degree of delay of the fourth signal.
19 . The electronic device of claim 15 ,
wherein the distortion of the pilot signal is associated with the decompression or amplification for the second signal or a path obtaining the fourth signal.