Method, electronic equipment and system for detecting type of playing equipment

By superimposing ultrasonic signals in the audio and detecting through microphones, electronic devices can accurately distinguish between headphones and external devices, solving the problem of improper handling in the prior art and improving the user experience.

CN119946536APending Publication Date: 2025-05-06HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311408774.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-26
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

The prior art is difficult to accurately distinguish the types of playback devices, resulting in improper handling in different scenarios and affecting the user experience.

Method used

By superimposing ultrasonic signals in the audio played by the electronic device to the user and collecting the audio signal through the microphone, it is determined whether an ultrasonic signal from the electronic device is detected, thereby distinguishing whether the playback device is a headset or an external device.

Benefits of technology

Accurate identification of the type of playback device is realized, allowing electronic devices to process according to different types of playback devices, thereby improving the user's user experience in various scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119946536A_ABST
    Figure CN119946536A_ABST
Patent Text Reader

Abstract

The invention discloses a method for detecting the type of playing equipment, electronic equipment and a system, and relates to the field of terminals. The electronic device plays the audio through the playing device, and the playing device can be an earphone or a loudspeaker device, such as a sound box, a vehicle machine and the like. After the electronic equipment sends an audio signal to the playing equipment, collecting a surrounding audio signal through a microphone; if the audio signal from the electronic device is collected within the preset time, determining that the playing device is a loudspeaker device; and if the audio signal from the electronic equipment is not collected within the preset duration, determining that the playing equipment is an earphone. Therefore, the electronic equipment can accurately distinguish whether the playing equipment is the earphone or the loudspeaker equipment, so that the electronic equipment can carry out corresponding processing according to different types of the playing equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminals, and in particular to a method, electronic device and system for detecting the type of a playback device. Background Art

[0002] Electronic devices can play audio through playback devices. For example, mobile phones can be connected to devices such as headphones, speakers, or car computers to play audio. In some scenarios, when electronic devices transmit audio signals to playback devices, they need to limit the maximum amplitude of audio signals. For example, when a user wears headphones to listen to audio, if the intensity of the audio (playback loudness) is too high, it may cause damage to the user's auditory system. Based on this, the mobile phone limits the maximum amplitude of the audio signal transmitted to the headphones, thereby limiting the intensity of the audio played by the headphones, which can protect the user's hearing. For example, the mobile phone limits the maximum amplitude of the audio signal transmitted to the headphones to below -10dBFS, thereby achieving the effect of limiting the loudness of the headphone playback.

[0003] In order to meet the needs of certain scenarios, such as the scenario mentioned above where users wear headphones to listen to audio, the maximum amplitude of the audio signal can be limited. However, if the maximum amplitude of the audio signal is uniformly limited, it will cause problems in other scenarios. For example, when the playback device is an external device such as a speaker or a car computer, the limitation on the maximum amplitude of the audio signal will affect the loudness of the audio played by the external device, making the user's experience when listening to audio using the external device worse.

[0004] How to accurately distinguish the types of playback devices so as to identify the corresponding scenarios and handle them differently is a problem that needs to be solved. Summary of the invention

[0005] The embodiments of the present application provide a method, electronic device, and system for detecting the type of a playback device, which can accurately distinguish between headphones and external speakers, and provide a reference for the electronic device to perform corresponding processing for different playback devices.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, a method for detecting the type of a playback device is provided, which is applied to an electronic device including a microphone, the electronic device is connected to a playback device, and the playback device is used to play the audio of the electronic device. The electronic device sends a first audio signal to the playback device at a first moment, and the first audio signal is used for the playback device to play audio; the electronic device collects the audio signal through the microphone within a preset time after the first moment; if the audio signal output by the playback device from the electronic device is collected within the preset time after the first moment, the electronic device determines that the type of the playback device is an external speaker; wherein the types of playback devices include headphones and external speakers.

[0008] In combination with the first aspect, in a possible implementation, if the audio signal output by the playback device from the electronic device is not collected within a preset time period after the first moment, it is determined that the type of the playback device is headphones.

[0009] In this method, after the electronic device sends an audio signal to the playback device, the surrounding audio signals are collected through the microphone. If it is determined that the audio signal from the electronic device is collected, it is determined that the playback device is an external speaker device (such as a speaker, car computer, etc.), that is, it is determined that the audio is played in external speaker mode. If it is determined that the audio signal from the electronic device is not collected, it is determined that the playback device is a headset, that is, it is determined that the audio is played in headphone mode. In this way, the electronic device can accurately distinguish whether the playback device is a headset or an external speaker device, so that the electronic device can perform corresponding processing according to the different types of playback devices.

[0010] In combination with the first aspect, in a possible implementation, the first audio signal includes a first ultrasonic signal. If the electronic device determines that the first ultrasonic signal is collected within a preset time after the first moment, it is determined that the audio signal output by the playback device originating from the electronic device is collected within the preset time after the first moment.

[0011] Ultrasonic signals cannot be perceived by the human ear. By superimposing ultrasonic signals on the audio played by the electronic device to the user, the audio signal collected by the microphone can be determined to come from the electronic device based on the ultrasonic signal emitted by the electronic device. In this way, the type of playback device can be accurately determined without being perceived by the user.

[0012] In a possible implementation, the first ultrasonic signal is generated according to the product serial number (SN) of the electronic device. Since the waveform of the ultrasonic signal is formed according to the SN number of the electronic device, and the SN number of the electronic device can uniquely identify an electronic device, each electronic device can generate a unique ultrasonic signal, and the waveforms of ultrasonic signals generated by different electronic devices will not be the same. This facilitates the electronic device to determine that the detected ultrasonic signal is the ultrasonic signal corresponding to the electronic device.

[0013] In a possible implementation, the electronic device obtains the binary code of the product serial number of the electronic device; the electronic device adjusts the frequency of the ultrasonic signal according to the positions of "0" and "1" in the binary code of the product serial number to generate a first ultrasonic signal; wherein "0" corresponds to the first frequency value of the ultrasonic signal and "1" corresponds to the second frequency value of the ultrasonic signal. In this way, two ultrasonic signals of different frequencies appear sequentially in the generated first ultrasonic signal.

[0014] In a possible implementation, the second frequency value is greater than the first frequency value. For example, the first frequency value is 21 kHz and the second frequency value is 23 kHz. Both the first frequency value and the second frequency value are greater than 20 kHz, and the ultrasonic signal cannot be perceived by the human ear.

[0015] In combination with the first aspect, in a possible implementation, if the electronic device determines that the first audio signal is collected within a preset time after the first moment, it is determined that the audio signal output by the playback device originating from the electronic device is collected within the preset time after the first moment.

[0016] In a possible implementation, the electronic device determining that the first audio signal is collected within a preset time after the first moment includes: the electronic device determining that the audio signal collected by the microphone within the preset time after the first moment is consistent with the first audio signal.

[0017] In a possible implementation, if the electronic device determines that the similarity between the audio signal collected by the microphone within a preset time after the first moment and the first audio signal is greater than or equal to a preset threshold, it is determined that the audio signal collected by the microphone within the preset time after the first moment is consistent with the first audio signal.

[0018] In combination with the first aspect, in a possible implementation, if the type of the playback device is headphones, the electronic device uses a first audio playback parameter to transmit an audio signal to the playback device; wherein the first audio playback parameter is used to limit the maximum amplitude of the audio signal output by the electronic device.

[0019] If it is determined that the playback device is a headset, the electronic device will limit the maximum amplitude of the audio signal when transmitting the audio signal to the playback device (headphone). For example, the maximum amplitude of the audio signal transmitted to the headset is limited to below -10dBFS, thereby limiting the intensity of the audio played by the headset and protecting the user's hearing.

[0020] In combination with the first aspect, in a possible implementation, if the type of the playback device is an external speaker, the electronic device uses a second audio playback parameter to transmit an audio signal to the playback device; wherein the maximum amplitude of the audio signal corresponding to the first audio playback parameter is a first value, and the maximum amplitude of the audio signal corresponding to the second audio playback parameter is a second value, and the second value is greater than the first value.

[0021] If it is determined that the playback device is an external speaker, the electronic device does not limit the maximum amplitude of the audio signal when transmitting the audio signal to the playback device (external speaker). This can ensure the loudness of the audio played by the external speaker and the user's experience when listening to audio using the external speaker.

[0022] In a second aspect, an electronic device is provided, which has the function of implementing the method described in the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0023] In a third aspect, an electronic device is provided, comprising: a processor, a memory, a microphone and a communication unit; the microphone is used to collect audio signals, the communication unit is used for the electronic device to communicate with a playback device, the memory is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory so that the electronic device performs a method as described in any one of the above-mentioned first aspects.

[0024] In a fourth aspect, an electronic device is provided, comprising: a processor; the processor is used to couple with a memory, and after reading instructions in the memory, execute a method as described in any one of the above-mentioned first aspects according to the instructions.

[0025] In a fifth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer can execute any of the methods described in the first aspect.

[0026] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect.

[0027] In a seventh aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0028] Among them, the technical effects brought about by any design method in the second to seventh aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A schematic diagram of a system architecture applicable to the method for detecting the type of a playback device provided in an embodiment of the present application;

[0030] Figure 2 A schematic diagram of a scenario applicable to the method for detecting the type of a playback device provided in an embodiment of the present application;

[0031] Figure 3A schematic diagram of a scenario applicable to the method for detecting the type of a playback device provided in an embodiment of the present application;

[0032] Figure 4 A schematic diagram of a scenario applicable to the method for detecting the type of a playback device provided in an embodiment of the present application;

[0033] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0034] Figure 6 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0035] Figure 7 A schematic diagram of a flow chart of a method for detecting the type of a playback device provided in an embodiment of the present application;

[0036] Figure 8 A schematic diagram of an implementation of a method for detecting the type of a playback device provided in an embodiment of the present application;

[0037] Fig. 9 A schematic diagram of an example of an ultrasonic signal used in the method for detecting the type of a playback device provided in an embodiment of the present application;

[0038] Fig.10 A schematic diagram of another implementation of the method for detecting the type of a playback device provided in an embodiment of the present application;

[0039] Fig.11 A schematic diagram of the structural composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include such expressions as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are a kind of "or" relationship.

[0041] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0042] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0043] The method for detecting the type of a playback device provided in the embodiment of the present application can be applied to Figure 1 The system shown. Figure 1 As shown, the system includes an electronic device 100 and a playback device 200 .

[0044] The electronic device 100 is used to provide an audio source. For example, the electronic device 100 stores audio files, video files, etc., and uses the audio files, video files, etc. as the audio source; for another example, the electronic device 100 obtains an audio playback address from a network (server, website, etc.) and plays online audio and video, and the online audio and video signals are the audio source; for another example, the electronic device 100 makes a call with another device through a call application, and the call audio received by the electronic device 100 from the other device or the call audio sent by the electronic device 100 to the other device is the audio source.

[0045] The playback device 200 is used to play the audio of the electronic device 100 .

[0046] The playback device 200 is connected to the electronic device 100 via a wired or wireless method. In some embodiments, the playback device 200 is connected to the electronic device 100 via a wired method such as a headphone jack or a universal serial bus (USB) interface on the electronic device 100. In other embodiments, the playback device 200 communicates with the electronic device 100 via a wireless method such as Bluetooth, Bluetooth low energy (BLE), or Wi-Fi Direct.

[0047] Exemplarily, the electronic device 100 may include a mobile phone, a tablet computer, a laptop computer, a personal computer (PC), an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), etc., and the embodiments of the present application do not impose any limitation on this.

[0048] The above-mentioned playback device 200 may include headphones, speakers, vehicle-mounted equipment, wearable devices (e.g., smart watches, smart bracelets, etc.), mobile phones, tablet computers, laptops, PCs, UMPCs, handheld computers, netbooks, PDAs, large screens, etc.

[0049] refer to Figure 2 In one example, taking the electronic device 100 as a mobile phone as an example, several examples of the electronic device 100 and the playback device 200 forming a system are shown. Figure 2 As shown in (a), the playback device 200 is a headset. Figure 2 As shown in (b), the playback device 200 is a speaker. Figure 2 As shown in (c), the playback device 200 is a vehicle-mounted device (also referred to as a vehicle computer). It can be understood that the playback device 200 can also be other forms of devices, which are not shown one by one in the embodiments of the present application.

[0050] When the electronic device 100 plays audio through the playback device 200, if the playback device 200 is a headset, the audio is converted into sound waves through a speaker (earphone) close to the ear. This mode of playing audio is called earphone mode, receiver mode, or headphone mode. For example, Figure 2 In the scenario shown in (a), the mobile phone is connected to the earphone, the earphone is worn by the user, and the audio of the mobile phone is played through the earphone. If the playback device 200 is a speaker, a car headphone, etc., the audio is played in an external speaker. For example, Figure 2 In the scenario shown in (b), the mobile phone is connected to a speaker, and the audio of the mobile phone is played through the speaker. Figure 2In the scenario shown in (c), the mobile phone is connected to the vehicle computer, and the audio of the mobile phone is played through the vehicle computer.

[0051] In some scenarios, such as Figure 3 In the illustrated scenario, the user wears the earphone 200 to listen to the audio of the mobile phone 100. Since the earphone 200 is very close to the user's ear, if the volume of the audio played by the earphone 200 is too loud, it may cause damage to the user's hearing.

[0052] In other scenarios, such as Figure 4 In the illustrated scenario, the user listens to the audio of the mobile phone 100 through the speaker 200. If the volume of the audio played by the speaker 200 is too low, it will affect the playing effect of the speaker and reduce the user's listening experience.

[0053] If we can accurately distinguish whether the playback device is headphones or an external device (speakers, car computers, etc.), we can distinguish different scenarios and process them accordingly, thereby improving the user experience in various scenarios.

[0054] The present application provides a method for detecting the type of playback device, which is applied to an electronic device including a microphone. A microphone can also be called a "microphone", "microphone", "sound receiving device", etc. An electronic device can collect surrounding audio signals through a microphone. If the playback device is a headset, the audio of the electronic device is played in headset mode, for example, Figure 3 In the scenario shown, the microphone of the electronic device will not detect the audio signal output by the playback device. If the playback device is an external speaker (speaker, car head, etc.), the audio of the electronic device is played in external speaker mode, for example Figure 4 In the scenario shown, the microphone of the electronic device can detect the audio signal output by the playback device.

[0055] In the method for detecting the type of playback device provided in the embodiment of the present application, the electronic device collects audio signals through a microphone. If it is determined that the audio signal is collected from the electronic device, it is determined that the playback device is an external speaker device (such as a speaker, a car computer, etc.), that is, it is determined that the audio is played in an external speaker mode. If it is determined that the audio signal is not collected from the electronic device, it is determined that the playback device is a headset, that is, it is determined that the audio is played in a headset mode.

[0056] In this way, the electronic device can accurately distinguish whether the playback device is a headset or an external speaker, so that the electronic device can perform corresponding processing according to the different types of playback devices. In one implementation, the electronic device can adjust the amplitude of the audio signal transmitted to the playback device accordingly according to the different types of playback devices.

[0057] For example, Figure 5 A schematic structural diagram of an electronic device 100 is shown.

[0058] like Figure 5 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a fingerprint sensor, a temperature sensor, a touch sensor, a bone conduction sensor, etc.

[0059] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0060] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0061] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0062] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0063] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0064] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0065] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0066] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0067] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0068] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0069] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0070] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0071] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0072] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0073] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0074] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0075] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0076] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0077] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0078] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0080] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0081] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0082] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0083] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0084] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0085] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0086] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0087] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize collecting sound signals, noise reduction, etc.

[0088] In the embodiment of the present application, the electronic device 100 can collect surrounding audio signals through the microphone 170C, and distinguish the type of the playback device by determining whether the audio signal is collected from the electronic device 100.

[0089] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0090] In the embodiment of the present application, the electronic device 100 is an electronic device that can run an operating system and install application programs. Optionally, the operating system running on the electronic device can be system, system, System, etc.

[0091] In one example, reference Figure 6 The software system of the electronic device 100 may adopt a layered architecture, which divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through interfaces. In some embodiments, the system may include an application layer, an application framework layer, a hardware abstraction layer (HAL) and a kernel layer.

[0092] Among them, the application layer can include a series of application packages.

[0093] like Figure 6 As shown, the application package (Application, App) may include a music app, a video app, a call app, a device management app, etc. Among them, the music app is used to play audio; the video app is used to play video; the call app is used to provide a call function; and the device management app is used to determine the type of the playback device.

[0094] The application framework layer provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes some predefined functions. For example, it may include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, an audio framework, etc., and the embodiments of the present application do not impose any restrictions on this. Among them, the audio framework may include an audio track, an audio manager, an audio service, an audio system, an audio synthesis (AudioFlinger) unit, an audio mixing (Audio mixer) unit, etc.

[0095] HAL is a package of Linux kernel drivers, providing an interface to the upper layer and shielding the implementation details of the underlying hardware. HAL can include Wi-Fi HAL, Bluetooth HAL, audio HAL, camera HAL, etc.

[0096] The kernel layer is the layer between hardware and software, providing low-level drivers for various hardware. For example, the kernel layer can include display drivers, camera drivers, microphone drivers, audio drivers, etc.

[0097] The following is a detailed description of the method for detecting the type of playback device provided in an embodiment of the present application in conjunction with the accompanying drawings.

[0098] refer to Figure 7 , which shows a flow chart of a method for detecting the type of playback device provided in an embodiment of the present application.

[0099] like Figure 7 As shown, the method may include:

[0100] The electronic device sends an audio signal to the playback device at a first moment, and the playback device starts playing the audio at a second moment.

[0101] An electronic device can play audio (e.g., music, video sound, call voice, etc.) through a playback device. In one implementation, the electronic device sends an audio signal of the audio to the playback device, so that the playback device can play the audio signal, that is, play the audio.

[0102] Exemplarily, the electronic device starts sending an audio signal to the playback device at a first moment, and after the playback device receives the audio signal, it starts playing the audio at a second moment. It is understandable that the process of the playback device receiving the audio signal, processing the audio signal, and playing the audio requires a certain amount of time. In other words, generally speaking, the second moment is slightly later than the first moment. Of course, when the processing speed of the playback device is fast enough, the second moment can be approximately considered to be the same as the first moment.

[0103] When the playback device plays audio, if the playback device is a headset, the microphone of the electronic device will not detect the audio output by the playback device; if the playback device is an external device (speaker, car computer, etc.), the microphone of the electronic device can detect the audio output by the playback device.

[0104] In one implementation, within a preset time period after the first moment, the electronic device collects an audio signal through a microphone.

[0105] If the electronic device does not collect the audio signal within a preset time period after the first moment, it is determined that the playback device is a headset.

[0106] If the electronic device collects an audio signal within a preset time after the first moment, it is determined whether the collected audio signal originates from the electronic device. If it is determined that the collected audio signal does not originate from the electronic device, it is determined that the playback device is a headset; if it is determined that the collected audio signal originates from the electronic device, it is determined that the playback device is an external speaker. In this way, it is possible to distinguish whether the playback device is a mobile phone or an external speaker.

[0107] In some embodiments, an ultrasonic signal is superimposed on the audio normally played by the electronic device. After the electronic device collects the audio signal through the microphone, it is determined whether the audio signal contains the ultrasonic signal emitted by the electronic device. If it is determined that the ultrasonic signal emitted by the electronic device is detected, it is determined that the audio signal collected by the electronic device through the microphone comes from the electronic device.

[0108] Generally, the sound wave frequency that our human ears can hear is 20Hz-20kHz. Therefore, sound waves with a frequency higher than 20kHz are called "ultrasound". Ultrasonic signals cannot be perceived by the human ear. By superimposing ultrasonic signals on the audio played by the electronic device to the user, the microphone can be used to determine that the audio signal collected by the microphone comes from the electronic device based on the ultrasonic signal emitted by the electronic device. In this way, the type of playback device can be accurately determined without being perceived by the user.

[0109] For example, Figure 8 An implementation of the method for detecting the type of playback device provided in an embodiment of the present application is shown.

[0110] like Figure 8 As shown, the electronic device is connected to the playback device via Bluetooth. The playback device may also be referred to as a Bluetooth external device. The electronic device includes a sound pickup device for collecting audio signals in the surrounding environment; for example, the sound pickup device is a microphone. The application layer of the electronic device operating system includes application one, application two, and application three, application one is used to provide an audio source (for example, application one is an audio app), application two is used to provide an ultrasonic signal (for example, application two is a device management app), and application three is used to determine the type of playback device (for example, application three is a device management app).

[0111] In some embodiments, application 1 sends an audio signal for playing to a user to an audio framework of the application framework layer. After the audio framework encodes and synthesizes the audio signal, it transmits the encoded sequence of the audio signal for playing to the user to the Bluetooth HAL.

[0112] Application 2 generates an ultrasonic signal and transmits the coding sequence of the ultrasonic signal to the Bluetooth HAL. In one implementation, the ultrasonic signal can be generated according to the binary code (composed of "0" and "1") of the product serial number (SN) of the electronic device.

[0113] In one example, the binary code of the SN of the electronic device is obtained, and then the frequency of the ultrasonic signal is adjusted according to the positions of "0" and "1" in the binary code of the SN. For example, "0" in the SN corresponds to a 21kHz ultrasonic signal, and "1" corresponds to a 23kHz ultrasonic signal. In this way, two ultrasonic signals of different frequencies appear sequentially in the generated ultrasonic signal.

[0114] Exemplarily, each code in the binary code of the SN number corresponds to an ultrasonic signal of a preset duration (e.g., 0.1 ms). If the binary code of the SN number includes N bits, the duration of the generated ultrasonic signal is the preset duration * N. For example, a 13-bit decimal SN number has a corresponding binary code including 52 (N=52) bits, and the duration of the generated ultrasonic signal is 5.2 ms.

[0115] Exemplary, reference Fig. 9 "0" corresponds to a 21kHz ultrasonic signal, "1" corresponds to a 23kHz ultrasonic signal, and each binary code corresponds to an ultrasonic signal with a duration of 0.1ms. According to the order in which "0" and "1" appear in the binary code of the electronic device SN, the frequency of the ultrasonic signal at the corresponding position is adjusted in sequence to form the waveform of the ultrasonic signal.

[0116] Since the waveform of the ultrasonic signal is formed according to the SN number of the electronic device, and the SN number of the electronic device can uniquely identify an electronic device, each electronic device can generate a unique ultrasonic signal, and the waveforms of ultrasonic signals generated by different electronic devices will not be the same.

[0117] Furthermore, the Bluetooth HAL performs Bluetooth encoding on the coding sequence of the audio signal played to the user and the coding sequence of the ultrasonic signal, respectively, and combines them to generate a Bluetooth audio signal. The electronic device sends the Bluetooth audio signal to the Bluetooth external device through the Bluetooth module.

[0118] The Bluetooth external device performs Bluetooth decoding on the received Bluetooth audio signal to obtain an audio signal; the audio signal includes an audio signal and an ultrasonic signal for playing to the user. The Bluetooth external device plays the audio signal.

[0119] After the electronic device sends a Bluetooth audio signal to the Bluetooth external device, it starts to collect surrounding audio signals through the microphone.

[0120] In one implementation, the electronic device collects surrounding audio signals within a preset time after sending a Bluetooth audio signal to a Bluetooth external device. The electronic device can determine the value of the preset time according to the duration of the ultrasonic signal. Exemplarily, if the ultrasonic signal lasts for 5.2ms, the value of the preset time is determined to be 100ms. The value of the preset time is greater than the duration of the ultrasonic signal, so that the microphone can collect the ultrasonic signal output by the playback device.

[0121] If the playback device is a headset, the microphone of the electronic device will not detect the audio signal output by the playback device; if the playback device is an external device (speaker, car computer, etc.), the microphone of the electronic device can detect the audio signal output by the playback device.

[0122] In one example, the microphone collects an audio signal within a preset time length, and the collected audio signal is decoded by the audio codec module and transmitted to the audio signal processor (audio digital singal processor, ADSP), and the ADSP filters the audio signal to obtain the ultrasonic signal therein. If the ADSP obtains the ultrasonic signal, the corresponding binary code sequence is obtained according to the collected ultrasonic signal. If it is determined that the binary code sequence is consistent with the SN number of this electronic device, it is determined that the collected ultrasonic signal is the ultrasonic signal corresponding to the electronic device. If it is determined that the binary code sequence is inconsistent with the SN number of this electronic device, it is determined that the collected ultrasonic signal is not the ultrasonic signal corresponding to the electronic device. Optionally, if the binary code sequence obtained according to the collected ultrasonic signal is a continuous part of the SN number of this electronic device, the two are considered to be consistent. In this way, even if a complete ultrasonic signal is not collected within the preset time length, a judgment can be made.

[0123] If the ADSP acquires the ultrasonic signal corresponding to the electronic device, it sends an indication message to the device management App, where the indication message is used to notify the device management App that the ultrasonic signal corresponding to the electronic device has been detected.

[0124] If the device management app determines that the ultrasonic signal corresponding to the electronic device is not obtained within the preset time (the indication message is not received within the preset time), the playback device is determined to be a headset. If the device management app determines that the ultrasonic signal corresponding to the electronic device is obtained within the preset time (the indication message is received within the preset time), the playback device is determined to be an external speaker.

[0125] In this embodiment, the electronic device superimposes an ultrasonic signal uniquely corresponding to the electronic device on the audio used to play to the user. The audio used to play to the user is sent to the playback device together with the ultrasonic signal uniquely corresponding to the electronic device for playback. If the electronic device collects the ultrasonic signal uniquely corresponding to the electronic device through the microphone, it is determined that the playback device is an external speaker; if the electronic device does not collect the ultrasonic signal uniquely corresponding to the electronic device through the microphone, it is determined that the playback device is a headset; in this way, it is possible to accurately distinguish whether the playback device is a headset or an external speaker. Since the ultrasonic signal cannot be perceived by the human ear, using the ultrasonic signal to determine the type of playback device will not interfere with the user's listening to the audio and will not affect the user experience.

[0126] For example, Fig.10 Another implementation of the method for detecting the type of playback device provided in an embodiment of the present application is shown.

[0127] like Fig.10As shown, the electronic device is connected to the playback device via Bluetooth. The playback device may also be referred to as a Bluetooth external device. The electronic device includes a sound pickup device for collecting audio signals in the surrounding environment; for example, the sound pickup device is a microphone. The application layer of the electronic device operating system includes application one and application two, application one is used to provide an audio source (for example, application one is an audio app), and application two is used to determine the type of playback device (for example, application two is a device management app).

[0128] In some embodiments, application 1 sends an audio signal for playing to a user to an audio framework of an application framework layer. After the audio framework encodes and synthesizes the audio signal, it transmits the coding sequence of the audio signal for playing to the user to the Bluetooth HAL. The Bluetooth HAL performs Bluetooth encoding on the coding sequence of the audio signal for playing to the user to generate a Bluetooth audio signal. The electronic device sends the Bluetooth audio signal to a Bluetooth external device through a Bluetooth module. The Bluetooth external device performs Bluetooth decoding on the received Bluetooth audio signal to obtain an audio signal; the Bluetooth external device plays the audio signal.

[0129] After the electronic device sends the Bluetooth audio signal to the Bluetooth external device, it starts to collect surrounding audio signals through the microphone. In one implementation, the electronic device collects surrounding audio signals within a preset time after sending the Bluetooth audio signal to the Bluetooth external device.

[0130] If the playback device is a headset, the microphone of the electronic device will not detect the audio signal output by the playback device; if the playback device is an external device (speaker, car computer, etc.), the microphone of the electronic device can detect the audio signal output by the playback device.

[0131] In one example, the microphone collects an audio signal within a preset time period, and the collected audio signal is decoded by the audio codec module and then transmitted to the ADSP.

[0132] ADSP obtains the audio signal emitted by the electronic device from the audio framework, compares the audio signal collected by the microphone with the audio signal emitted by the electronic device, and determines whether the audio signal collected by the microphone is consistent with the audio signal emitted by the electronic device. In one implementation, the similarity between the audio signal collected by the microphone and the audio signal emitted by the electronic device is calculated, and if it is determined that the similarity is greater than or equal to a preset threshold, it is determined that the audio signal collected by the microphone is consistent with the audio signal emitted by the electronic device.

[0133] It is understandable that the duration of the audio collected by the microphone within the preset duration is less than or equal to the preset duration, while the audio signal emitted by the electronic device may last for a long time; the audio signal collected by the microphone in the embodiment of the present application is consistent with the audio signal emitted by the electronic device, including the case where the audio signal collected by the microphone belongs to a part (a section) of the audio signal emitted by the electronic device. For example, the audio signal emitted by the electronic device for playing to the user is a 3-minute music, the preset duration is 1s, and the microphone detects a 500ms audio signal within 1s after the electronic device emits the audio signal to the playback device. If it is determined that the similarity between the 500ms audio signal and one of the sections of the 3-minute music is greater than or equal to the preset threshold, it is determined that the similarity between the audio signal collected by the microphone and the audio signal emitted by the electronic device is greater than or equal to the preset threshold, that is, it is determined that the audio signal collected by the microphone is consistent with the audio signal emitted by the electronic device.

[0134] If the ADSP determines that the audio signal collected by the microphone is consistent with the audio signal emitted by the electronic device, it sends an indication message to the device management App, where the indication message is used to notify the device management App that the audio signal emitted by the electronic device has been detected.

[0135] If the device management app determines that no audio signal from the electronic device is detected within the preset time (no indication information is received within the preset time), the playback device is determined to be a headset. If the device management app determines that an audio signal from the electronic device is detected within the preset time (indication information is received within the preset time), the playback device is determined to be an external speaker.

[0136] In this embodiment, the electronic device plays audio through the playback device. If the electronic device collects the audio signal emitted by the electronic device through the microphone, it is determined that the playback device is an external speaker; if the electronic device does not collect the audio signal emitted by the electronic device through the microphone, it is determined that the playback device is an earphone; in this way, it can be accurately distinguished whether the playback device is an earphone or an external speaker.

[0137] After the electronic device distinguishes whether the playback device is an earphone or an external speaker, it can perform corresponding processing on the earphone or the external speaker.

[0138] In some embodiments, if it is determined that the playback device is a headset, the electronic device limits the maximum amplitude of the audio signal when transmitting the audio signal to the playback device (headphone). For example, the maximum amplitude of the audio signal transmitted to the headset is limited to below -10dBFS, thereby limiting the intensity of the audio played by the headset to protect the user's hearing.

[0139] If it is determined that the playback device is an external speaker, the electronic device does not limit the maximum amplitude of the audio signal when transmitting the audio signal to the playback device (external speaker). This can ensure the loudness of the audio played by the external speaker and the user's experience when listening to audio using the external speaker.

[0140] In one implementation, the electronic device sets a first audio playback parameter and a second audio playback parameter, the first audio playback parameter is used for the electronic device to transmit an audio signal when the playback device is a headset, and the second audio playback parameter is used for the electronic device to transmit an audio signal when the playback device is an external speaker. For example, the first audio playback parameter is used to limit the maximum amplitude of the audio signal output by the electronic device, and the second audio playback parameter is used to not limit the maximum amplitude of the audio signal output by the electronic device. For example, the maximum amplitude of the audio signal corresponding to the first audio playback parameter is a first value, and the maximum amplitude of the audio signal corresponding to the second audio playback parameter is a second value, and the second value is greater than the first value.

[0141] In one example, the electronic device transmits an audio signal to the playback device using the first audio playback parameter. When it is detected that the playback device is an external speaker, a prompt box pops up on the display screen of the electronic device, the prompt box includes prompt information, and the prompt information is used to prompt the user to choose whether to switch to the audio playback effect corresponding to the external speaker.

[0142] If the user confirms the parameter switching operation, the electronic device switches to using the second audio playback parameter to transmit the audio signal to the playback device.

[0143] By switching the audio parameters only after the user's consent, it is possible to avoid misjudging the playback device type and mistakenly increasing the audio loudness when the playback device is a headset, thereby protecting the user's hearing from damage.

[0144] It is understandable that the electronic device provided in the embodiment of the present application includes a hardware structure and / or software module corresponding to each function in order to realize the above functions. Those skilled in the art should easily realize that, in conjunction with the units and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiment of the present application.

[0145] The embodiment of the present application can divide the functional modules of the above-mentioned electronic device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0146] In one example, see Fig.11 , which shows a possible structural diagram of the electronic device involved in the above embodiment. The electronic device 800 includes: a processing unit 810, a storage unit 820, an audio acquisition unit 830 and a communication unit 840.

[0147] The processing unit 810 is used to control and manage the actions of the electronic device 800. The storage unit 820 is used to store the program code and data of the electronic device 800. The processing unit 810 calls the program code stored in the storage unit 820 to execute each step in the above method embodiment. The audio collection unit 830 is used to collect audio around the electronic device 800. The communication unit 840 is used for the electronic device 800 to communicate with other devices (such as a playback device).

[0148] Of course, the unit modules in the electronic device 800 include but are not limited to the processing unit 810, the storage unit 820, the audio acquisition unit 830 and the communication unit 840. For example, the electronic device 800 may also include a power supply unit, a display unit, etc. The power supply unit is used to supply power to the electronic device 800. The display unit is used to display the user interface of the electronic device 800.

[0149] The processing unit 810 may be a processor or a controller, for example, a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The storage unit 820 may be a memory. The audio acquisition unit 830 may be a microphone. The communication unit 840 may be a wireless communication module. The display unit may be a display screen, etc.

[0150] For example, the processing unit 810 is a processor (such as Figure 5The processor 110 shown in FIG. 1 ), the storage unit 820 may be a memory (eg, Figure 5 The internal memory 121 shown in FIG. 1 ), the audio acquisition unit 830 may be a microphone (eg Figure 5 The microphone 170C shown in FIG. 1 ), the communication unit 840 includes a mobile communication module (such as Figure 5 The mobile communication module 150 shown in FIG. Figure 5 The wireless communication module 160 shown in FIG. 1 ). The electronic device 800 provided in the embodiment of the present application may be Figure 5 The electronic device 100 shown in FIG. 1 is a schematic diagram of an embodiment of the present invention. The processor, memory, microphone, etc., can be connected together, for example, via a bus. The processor calls the program code stored in the memory to execute each step in the above method embodiment.

[0151] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected by lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiment of the present application.

[0152] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.

[0153] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the mobile phone in the above method embodiment.

[0154] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0155] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0156] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0157] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0158] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0159] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for detecting the type of a playback device, characterized in that: Applied to an electronic device, the electronic device includes a microphone, the electronic device is connected to a playback device, the playback device is used to play the audio of the electronic device, the method includes: The electronic device sends a first audio signal to the playback device at a first moment, where the first audio signal is used for the playback device to play audio; The electronic device collects an audio signal through the microphone within a preset time after the first moment; If an audio signal output by the playback device originating from the electronic device is collected within a preset time after the first moment, the electronic device determines that the type of the playback device is an external speaker device; wherein the types of the playback device include headphones and external speakers.

2. The method according to claim 1, characterized in that The method further comprises: If the audio signal output by the playback device from the electronic device is not collected within a preset time period after the first moment, it is determined that the type of the playback device is a headphone.

3. The method according to claim 1 or 2, characterized in that: The first audio signal includes a first ultrasonic signal, and the audio signal from the electronic device output by the playback device collected within a preset time after the first moment includes: The electronic device determines that the first ultrasonic signal is collected within a preset time period after the first moment.

4. The method according to claim 3, characterized in that The first ultrasonic signal is generated according to a product serial number of the electronic device.

5. The method according to claim 4, characterized in that The method further comprises: The electronic device obtains a binary code of a product serial number of the electronic device; The electronic device generates the first ultrasonic signal by adjusting the frequency of the ultrasonic signal according to the positions of "0" and "1" in the binary code of the product serial number; wherein the "0" corresponds to the first frequency value of the ultrasonic signal, and the "1" corresponds to the second frequency value of the ultrasonic signal.

6. The method according to claim 5, characterized in that The second frequency value is greater than the first frequency value.

7. The method according to claim 1 or 2, characterized in that: The audio signal from the electronic device and output by the playback device is collected within a preset time after the first moment and includes: The electronic device determines that the first audio signal is collected within a preset time period after the first moment.

8. The method according to claim 7, characterized in that The electronic device determines that the first audio signal is collected within a preset time after the first moment, including: The electronic device determines that an audio signal collected by the microphone within a preset time period after the first moment is consistent with the first audio signal.

9. The method according to claim 8, characterized in that The electronic device determines that the audio signal collected by the microphone within a preset time after the first moment is consistent with the first audio signal, including: The electronic device determines that a similarity between an audio signal collected by the microphone within a preset time period after the first moment and the first audio signal is greater than or equal to a preset threshold.

10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: If the type of the playback device is headphones, the electronic device uses a first audio playback parameter to transmit an audio signal to the playback device; the first audio playback parameter is used to limit the maximum amplitude of the audio signal output by the electronic device.

11. The method according to claim 10, characterized in that The maximum amplitude of the audio signal corresponding to the first audio playback parameter is a first value, and the method further includes: If the playback device is an external speaker, the electronic device transmits an audio signal to the playback device using a second audio playback parameter; the maximum amplitude of the audio signal corresponding to the second audio playback parameter is a second value, and the second value is greater than the first value.

12. An electronic device, characterized in that: include: processor, memory, microphone and communication unit; The microphone is used to collect audio signals, the communication unit is used for the electronic device to communicate with a playback device, and the memory stores one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the electronic device, the electronic device executes the method as described in any one of claims 1-11.

13. A computer-readable storage medium, characterized in that: The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes the method as claimed in any one of claims 1 to 11.