Electronic device for generating haptic signals, and method thereof
An electronic device according to various embodiments disclosed in this document may include a haptic module including at least a motor and outputting a tactile signal; a sound output module including at least one of a speaker and a receiver; and a processor operatively connected to the haptic module and the sound output module, wherein the processor is configured to obtain audio data and a signal related to audio data reproduction; identify whether to generate haptic data based on the audio data; in response to the identification, generate haptic data based on the audio data; reproduce the audio data based on a signal related to the audio data reproduction through the sound output module; control the haptic module; and output the tactile signal based on the generated haptic data.
1 . An electronic device comprising:
a haptic module including at least a motor and outputting a tactile signal;
a sound output module including at least one of a speaker and a receiver;
memory storing instructions; and
at least one processor operatively connected to the memory, the haptic module and the sound output module,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to:
obtain audio data and a signal related to reproduction of the audio data,
identify whether to generate haptic data based on the audio data,
generate haptic data based on the audio data in response to the above identification,
post-process the generated haptic data,
reproduce the audio data based on the signal related to the reproduction of the audio data through the sound output module, and
output the tactile signal based on the post-processed haptic data by controlling the haptic module.
2 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to identify whether to generate the audio data-based haptic data based on a user input, a function of an application being executed simultaneously with the reproduction of the audio data, and at least a portion of the audio data.
3 . The electronic device of claim 1 , wherein the haptic data is pulse code modulation (PCM) based data.
4 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to identify whether the obtained audio data includes the haptic data based on at least a portion of audio data and, in the case that the audio data includes the haptic data, output the tactile signal based on the haptic data included in the audio data.
5 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to generate one piece of audio data by integrating the audio data and the generated haptic data.
6 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to analyze at least one of the generated haptic data and the obtained audio data, extract feature information, and post-process the haptic data based on the extracted feature information.
7 . The electronic device of claim 6 , wherein feature information comprises at least one of waveform, amplitude, frequency, and duration of the haptic data or the audio data, or a combination thereof.
8 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to extract feature information of the audio data and generate the haptic data based on the extracted feature information.
9 . The electronic device of claim 8 , wherein feature information comprises at least one of waveform, amplitude, frequency, and duration of the audio data.
10 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to, in the case of obtaining a plurality of pieces of audio data and reproducing the plurality of pieces of audio data simultaneously, identify at least a portion of the audio data to generate the audio data-based haptic data among the plurality of pieces of audio data, and generate the haptic data based on at least a portion of the identified data.
11 . A method for an electronic device to provide an output of a tactile signal, the method comprising:
obtaining audio data and a signal related to audio data reproduction;
identifying whether to generate haptic data based on the audio data;
generating haptic data based on the audio data in response to the identification;
post-processing the generated haptic data;
reproducing the audio data based on a signal related to the reproduction of the audio data; and
outputting the tactile signal based on the post-processed haptic data.
12 . The method of claim 11 , wherein the identifying whether to generate comprises: identifying whether to generate the audio data-based haptic data based on a user input, a function of an application being executed simultaneously with the reproduction of the audio data, and at least a portion of the audio data.
13 . The method of claim 11 , wherein the haptic data is pulse code modulation (PCM) based data.
14 . The method of claim 11 , wherein the identifying whether to generate comprises: identifying whether the obtained audio data includes the haptic data based on at least a portion of the audio data and outputting the tactile signal based on the haptic data included in the audio data, in case that the audio data includes the haptic data.
15 . The method of claim 11 , wherein the generating the haptic data comprises: generating one piece of audio data by integrating the audio data and the generated haptic data.
16 . The method of claim 11 , wherein the post-processing comprises:
extracting feature information by analyzing at least one of the generated haptic data and the obtained audio data and post-processing the haptic data based on the extracted feature information.
17 . The method of claim 11 , wherein the generating the haptic data comprises: extracting feature information of the audio data and generating the haptic data based on the extracted feature information.
18 . The method of claim 11 , comprising, in case that the obtained audio data includes a plurality of pieces of audio data, an operation of reproducing the plurality of pieces of audio data simultaneously, identifying at least a portion of the audio data to generate the audio data-based haptic data among the plurality of pieces of audio data, and generating the haptic data based on at least a portion of the identified data.