A method, device, equipment and medium for playing Linux audio in Android device
By opening the target sound card and audio device in an Android device and modifying its permissions to pulseaudio service in the Linux system, directly using the pulseaudio service to drive the sound card and device, the problem of delayed and reduced audio quality when playing Linux audio in an Android device is solved, achieving more efficient and high-quality audio playback.
Patent Information
- Application Number
- CN202510053645.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-14
AI Technical Summary
When playing Linux audio through proxy services in Android devices, it may result in longer delays and lower audio quality.
In the Android system of an Android device, open the target sound card and the target audio device, and modify its access permissions to pulseaudio service in the Linux system. Configure the target sound card and target audio device in the configuration file of the pulseaudio service, and start the pulseaudio service to directly drive the sound card and device to realize the playback of Linux audio.
By directly utilizing the hardware control of the Linux system, the delay of audio playback is reduced, the audio quality is improved, and the delay and quality loss caused by processing and transmission through the Android system are avoided.
Smart Images

Figure CN119473211B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology and provides a method, apparatus, device and medium for playing Linux audio in an Android device. Background Art
[0002] Both Android and Linux are very popular operating systems. Dual-system devices can provide richer usage scenarios. For example, Android can be used for daily applications, games, and entertainment, while Linux can be used for development, system management, programming, and advanced computing tasks. Therefore, dual-system devices can meet the needs of users with various needs (such as developers and technology enthusiasts).
[0003] In a dual system where Android is embedded in Linxu, if you want to play audio in the Linux system, you have to rely on the proxy service of the Android system to achieve this. This means that the audio data in the Linux system needs to be processed and transmitted by the Android system, which may introduce additional delays, resulting in a longer delay in audio output. In addition, the transmission of audio data through the proxy service may cause data loss or compression, which in turn leads to a decrease in audio quality. Summary of the invention
[0004] The present application provides a method, apparatus, device and medium for playing Linux audio in an Android device, which is used to solve the problems of long delay and reduced audio quality caused by playing Linux audio through Android's proxy service.
[0005] In a first aspect, a method for playing Linux audio in an Android device is provided, comprising:
[0006] In an Android system of an Android device, a target sound card and a target audio device are turned on; wherein the Android device is provided with an Android system and a Linux system;
[0007] In the Linux system, modifying the access rights of the target sound card and the target audio device to pulseaudio service;
[0008] Configuring the target sound card and the target audio device in the configuration file of the pulseaudio service; wherein the target audio device includes a target playback device;
[0009] The pulseaudio service is started to control the target sound card and the target playback device to play the audio of the Linux system.
[0010] Optionally, in the Android system of the Android device, before opening the target sound card and the target audio device, the method further includes:
[0011] From all the sound cards of the Android device, determine the sound card corresponding to the hole where the headset is inserted as the target sound card;
[0012] The audio device under the target sound card is determined as the target audio device.
[0013] Optionally, in the Android system of the Android device, opening the target sound card and the target audio device includes:
[0014] In the Android system of the Android device, use the tinymix command to open the target sound card and target audio device.
[0015] Optionally, in the Linux system, modifying the access rights of the target sound card and the target audio device to pulseaudio service includes:
[0016] In the / dev / snd folder of the Linux system, the permissions of the target sound card and the target audio device are modified to pulseaudio service.
[0017] Optionally, starting the pulseaudio service, controlling the target sound card and the target playback device, and playing the audio of the Linux system includes:
[0018] The pulseaudio service is started in the Linux system, and the target sound card and the target playback device are controlled by the paplay tool to play the audio of the Linux system.
[0019] Optionally, the target audio device further includes a target recording device; after starting the pulseaudio service in the Linux system, controlling the target sound card and the target playback device through the paplay tool, and playing the audio of the Linux system, the method further includes:
[0020] The target sound card and the target recording device are controlled by the parecord tool to record the audio of the Linux system.
[0021] Optionally, in the Android system of the Android device, before opening the target sound card and the target audio device of the Android device, the method further includes:
[0022] A Linux system is embedded into an Android device using a preset mode; the preset mode is Proot mode, Chroot mode or Docker mode.
[0023] In a second aspect, a device for playing Linux audio in an Android device is provided, comprising:
[0024] An opening module is used to open a target sound card and a target audio device in an Android system of an Android device; wherein the Android device is provided with an Android system and a Linux system;
[0025] A modification module, used for modifying the access rights of the target sound card and the target audio device to pulseaudio service in the Linux system;
[0026] A configuration module, configured to configure the target sound card and the target audio device in a configuration file of the pulseaudio service; wherein the target audio device includes a target playback device;
[0027] The playing module is used to start the pulseaudio service, control the target sound card and the target playing device, and play the audio of the Linux system.
[0028] In a third aspect, the present application provides an Android device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method for playing Linux audio in an Android device described in the first aspect.
[0029] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and a processor executes the computer program to implement the method for playing Linux audio in an Android device described in the first aspect.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] The present application provides a method for playing Linux audio in an Android device, the method comprising: in the Android system of the Android device, opening the target sound card and the target audio device; the Android device is provided with the Android system and the Linux system; in the Linux system, modifying the access rights of the target sound card and the target audio device to the pulseaudio service; configuring the target sound card and the target audio device in the configuration file of the pulseaudio service; the target audio device includes a target playback device; starting the pulseaudio service, controlling the target sound card and the target playback device, and playing the audio of the Linux system. The method realizes the playback of Linux audio by modifying permissions, configuring sound cards and devices, and directly driving sound cards and devices in the Linux system using the pulseaudio service. Since it does not need to be processed and transmitted by the Android system, the Linux system provides more direct hardware control, which can reduce the delay of audio playback and improve audio quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0033] Figure 1 A schematic diagram of the structure of an Android device in the hardware operating environment involved in the embodiment of the present application;
[0034] Figure 2 A flowchart of a method for playing Linux audio in an Android device provided in an embodiment of the present application;
[0035] Figure 3 A schematic diagram of a specific process of a method for playing Linux audio in an Android device provided in an embodiment of the present application;
[0036] Figure 4 A code schematic diagram for viewing all sound cards and devices provided in an embodiment of the present application;
[0037] Figure 5 A schematic diagram of a code for opening a sound card and a device provided in an embodiment of the present application;
[0038] Figure 6 A code schematic diagram of the modification permissions provided in the embodiment of the present application;
[0039] Figure 7 A code schematic diagram for configuring a sound card and a device provided in an embodiment of the present application;
[0040] Figure 8 A schematic diagram of a code for playing Linux audio provided in an embodiment of the present application;
[0041] Fig. 9 A schematic diagram of a code for recording Linux audio provided in an embodiment of the present application;
[0042] Fig.10 A schematic diagram of the structure of an apparatus for playing Linux audio in an Android device provided in an embodiment of the present application.
[0043] Markings in the figure: 101-processor, 102-communication bus, 103-network interface, 104-user interface, 105-memory, 100-device for playing Linux audio in Android device, 1001-open module, 1002-modify module, 1003-configure module, 1004-play module, 1005-determine module, 1006-record module, 1007-embed module. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0045] In a dual system where Android is embedded in Linux, the steps of the prior art are as follows:
[0046] Step 1: Enter the shell environment in the Android system.
[0047] Step 2: Start the pulseaudio service and set the PULSE_SERVER environment variable.
[0048] Step 3: Enter the embedded Linux environment and start the pulseaudio client.
[0049] Step 4: The pulseaudio client successfully connects to the pulseaudio service.
[0050] Step 5: Successfully play sound with pulseaudio.
[0051] In the prior art, audio data in the Linux system needs to be processed and transmitted by the Android system, which may introduce additional delays and cause a longer delay in audio output. In addition, the transmission of audio data through the proxy service may cause data loss or compression, thereby causing a decrease in audio quality.
[0052] In view of this, the present application embodiment provides a method for playing Linux audio in an Android device, which can be applied to an Android device, please refer to Figure 1 , which is a schematic diagram of the Android device structure of the hardware operating environment involved in the embodiment of the present application.
[0053] like Figure 1 As shown, the Android device may include: a processor 101, such as a central processing unit (CPU), a communication bus 102, a user interface 104, a network interface 103, and a memory 105. Among them, the communication bus 102 is used to realize the connection and communication between these components. The user interface 104 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 104 may include a standard wired interface and a wireless interface. The network interface 103 may include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 105 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 105 may optionally also be a storage device independent of the aforementioned processor 101.
[0054] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0055] like Figure 1 As shown, the memory 105 as a storage medium may include an operating system, a network communication module, a user interface module, and a device for playing Linux audio in an Android device.
[0056] exist Figure 1In the Android device shown, the network interface 103 is mainly used for data communication with the network server; the user interface 104 is mainly used for data interaction with the user; the processor 101 and the memory 105 in the Android device of the present invention can be set in the Android device, and the Android device calls the device for playing Linux audio in the Android device stored in the memory 105 through the processor 101, and executes the method for playing Linux audio in the Android device provided in the embodiment of the present application.
[0057] based on Figure 1 For the Android device shown below, Figure 2 The following is a method for playing Linux audio on an Android device.
[0058] S201. In the Android system of the Android device, open the target sound card and the target audio device.
[0059] Among them, Android devices generally refer to various hardware devices running the Android system, such as smart phones, tablet computers, IoT devices, etc. Usually, Android devices are only provided with a single Android system.
[0060] In a possible embodiment, before executing S201, the method may further include the following steps:
[0061] Use the preset mode to embed the Linux system into the Android device; the preset mode is Proot mode, Chroot mode, or Docker mode.
[0062] In the specific implementation process, Proot mode is suitable for users without root privileges and can quickly build a lightweight Linux environment. Chroot mode is suitable for users who need higher performance and better isolation, but they must have root privileges. Docker mode is suitable for users who need high isolation and containerized environment, but requires additional system support. Therefore, according to the permissions of the Android device and the actual needs of the user, any mode among Proot mode, Chroot mode and Docker mode can be selected as the preset mode, and a Linux system can be embedded in the Android device using the preset mode.
[0063] In the embodiment of the present application, a Linux system is embedded in an Android device, so that the Android device changes from a single Android system to a dual system supporting Android and Linux, which can significantly improve the functionality, flexibility and performance of the Android device and meet higher-level usage requirements.
[0064] In a possible embodiment, before executing S201, the method may further include the following steps:
[0065] From all the sound cards of the Android device, determine the sound card corresponding to the hole where the headset is inserted as the target sound card; determine the audio device under the target sound card as the target audio device.
[0066] In the specific implementation process, the information of all sound cards on the Android device can be obtained. If the Android device is plugged into a headset, the sound card corresponding to the hole where the headset is plugged in is preferentially determined as the target sound card. If the Android device is not plugged into a headset, the default sound card (such as a speaker) can be determined as the target sound card. Then, the audio device under the target sound card is determined as the target audio device, and the target audio device includes a target playback device and a target recording device.
[0067] In an embodiment of the present application, when a headset is inserted into an Android device, the system will automatically select the correct target sound card and the audio device under it as the output device. This can prevent the audio from continuing to be output to the built-in speakers or other unnecessary devices of the Android device, ensuring that the audio stream is accurately output to the headset rather than the default speakers or other external devices.
[0068] In a possible embodiment, S201 may include the following steps:
[0069] In the Android system of the Android device, use the tinymix command to open the target sound card and target audio device.
[0070] Specifically, the tinymix command of the Android system serves as a user interaction tool that allows users to interact with the configuration and settings of audio hardware. Through the tinymix command, users can easily interact with the audio hardware in Android devices and open, enable or disable various audio devices and output paths.
[0071] S202. In the Linux system, modify the access rights of the target sound card and the target audio device to the pulseaudio service.
[0072] In a possible embodiment, in the / dev / snd folder of the Linux system, the permissions of the target sound card and the target audio device are modified to the pulseaudio service.
[0073] Specifically, in Linux systems, the / dev / snd folder contains device nodes related to the sound card, which are used to access audio input and output. The device files in the / dev / snd directory usually require specific permissions to ensure that the audio hardware can be used normally. In order to allow the pulseaudio service to have permission to access the target sound card and target audio device after it is started, it is necessary to modify the permissions of the target sound card and target audio device so that they can be read and controlled by the pulseaudio service.
[0074] S203: Configure the target sound card and the target audio device in the configuration file of the pulseaudio service.
[0075] Specifically, pulseaudio is a common audio server on Linux systems, which provides rich functions to manage audio devices and audio streams. By modifying the configuration file of the pulseaudio service and configuring the target sound card and target audio device, the pulseaudio service can monitor the opened target sound card and target audio device after it is started.
[0076] S204, start the pulseaudio service, control the target sound card and the target playback device, and play the audio of the Linux system.
[0077] In a possible embodiment, the pulseaudio service is started, and the target sound card and the target playback device are controlled by the paplay tool to play the audio of the Linux system.
[0078] Specifically, the pulseaudio service is usually started automatically when the Linux system starts. If not, you can manually enter the command line "pulseaudio --start" to start the pulseaudio service. paplay is a command line tool for playing audio files through pulseaudio, allowing users to play audio files through pulseaudio and specify the target playback device to play the audio of the Linux system.
[0079] In a possible embodiment, after executing S204, the method may further include the following steps:
[0080] Use the parecord tool to control the target sound card and target recording device to record the audio of the Linux system.
[0081] Specifically, parecord is a recording tool provided by the pulseaudio service. It can be used to specify the target recording device to record the audio of the Linux system. Other options can also be used to adjust the quality of the recording, such as setting the sampling rate, setting the volume, setting the recording duration, setting the recording format, etc. parecord saves the recording in .wav format by default, but you can also choose other formats, such as .ogg or .flac (requires system support). Specific embodiment 1:
[0083] like Figure 3 As shown in FIG. 1 , a schematic diagram of a specific process of playing Linux audio on an Android device provided in an embodiment of the present application is shown. The process can be performed by Figure 1 The process is performed by the Android device shown in the figure. The Android system and the Linux system have been set up in the Android device. Specifically, the process is described as follows.
[0084] S301. In the Android system, use the tinymix command to open the target sound card and target audio device.
[0085] S302. In the Linux system, in the / dev / snd folder, modify the permissions of the target sound card and the target audio device.
[0086] S303. In the Linux system, configure the target sound card and the target audio device in the configuration file of the pulseaudio service.
[0087] S304. In the Linux system, start the pulseaudio service.
[0088] S305. In Linux system, use paplay to play audio.
[0089] S306. In Linux system, use parecord to record audio.
[0090] It should be noted that the execution order of S305 and S306 is not specific, they can be swapped, and can also be executed simultaneously. Specific embodiment 2:
[0092] Assuming that the Android device is Rockchip's Rk3588 device, which has been configured with the Android system and the Linux system, the following process can be used to explain the technical solution of the present application in detail.
[0093] First, you can enter the command line "cat / proc / asound / cards" to view all sound cards on the Rk3588 device, and you can enter the command line "cat / proc / asound / devices" to view the audio devices under each sound card.
[0094] like Figure 4 As shown, it is a schematic diagram of a code for viewing all sound cards and audio devices provided by an embodiment of the present application. Figure 4 It can be seen that all sound cards on the device Rk3588 include sound card 0, sound card 1 and sound card 2, among which sound card 2 is the sound card corresponding to the hole where the headset is inserted, so sound card 2 is used as the target sound card, and audio device 0 under sound card 2 is used as the target audio device.
[0095] Secondly, in the Android system, you can enter the command line "tinymix 38 1 -D 2" to open sound card 2, such as Figure 5 As shown, it is a code schematic diagram for opening the sound card provided in an embodiment of the present application.
[0096] Next, switch from Android system to Linux system, modify the audio device 0 under sound card 2 in the / dev / snd folder, so that the pulseaudio service has the permission to read and control the audio device 0 under sound card 2 after startup, such as Figure 6 As shown, it is a code schematic diagram of the modification permissions provided in an embodiment of the present application. It can be seen that the audio devices under the sound card 2 include controlC0, pcmC2D0c and pcmC2D0p.
[0097] Then, in the Linux system, continue to modify the pulseaudio configuration file, configure sound card 2 and audio device 0 under sound card 2, such as Figure 7 As shown, it is a code schematic diagram for configuring a sound card and a device provided in an embodiment of the present application.
[0098] Furthermore, start the pulseaudio service in the Linux system, and the pulseaudio service can access sound card 2 and audio device 0 of sound card 2.
[0099] Finally, you can enter the command line "paplay -vv test_paplay.wav" to use pulseaudio's built-in tool paplay to play the audio file with the path "test_paplay.wav", such as Figure 8As shown in FIG. 1 , a code schematic diagram of playing audio provided by an embodiment of the present application is shown, wherein paplay is a play command, -vv indicates printing information, and test_paplay.wav is an audio file to be played. You can also enter the command line "parecord -vv test_parecord.wav" to indicate that the audio file with the path "test_parecord.wav" is recorded using the built-in tool parecord of pulseaudio, such as Fig. 9 As shown, it is a code schematic diagram for recording audio provided in an embodiment of the present application, wherein parecord is a recording command, -vv represents print information, and test_parecord.wav is a new recorded file.
[0100] To summarize, the embodiments of the present application provide a method for playing Linux audio in an Android device. In an Android device with an Android+Linux dual system, by modifying permissions and configuring the sound card and device, the pulseaudio service is used in the Linux system to directly drive the sound card and device, thereby realizing the playback and recording of Linux audio. Since it does not need to be processed and transmitted by the Android system, the Linux system provides more direct hardware control, which can reduce the delay of audio playback and improve the audio quality.
[0101] Based on the same inventive concept, Fig.10 As shown, the embodiment of the present application also provides a device 100 for playing Linux audio in an Android device, the device comprising:
[0102] The opening module 1001 is used to open the target sound card and the target audio device in the Android system of the Android device; wherein the Android device is provided with the Android system and the Linux system;
[0103] The modification module 1002 is used to modify the access rights of the target sound card and the target audio device to the pulseaudio service in the Linux system;
[0104] The configuration module 1003 is used to configure the target sound card and the target audio device in the configuration file of the pulseaudio service; wherein the target audio device includes the target playback device;
[0105] The playback module 1004 is used to start the pulseaudio service, control the target sound card and the target playback device, and play the audio of the Linux system.
[0106] Optionally, the device also includes a determination module 1005, which is used to: in the Android system of the Android device, before opening the target sound card and the target audio device, determine the sound card corresponding to the hole where the headset is inserted as the target sound card from all the sound cards of the Android device; and determine the audio device under the target sound card as the target audio device.
[0107] Optionally, the opening module 1001 is specifically used for: in the Android system of the Android device, using the tinymix command to open the target sound card and the target audio device.
[0108] Optionally, the modification module 1002 is specifically used to: modify the permissions of the target sound card and the target audio device to pulseaudio service in the / dev / snd folder of the Linux system.
[0109] Optionally, the playback module 1004 is specifically used to: start the pulseaudio service in the Linux system, control the target sound card and the target playback device through the paplay tool, and play the audio of the Linux system.
[0110] Optionally, the target audio device also includes a target recording device; the device also includes a recording module 1006, and the recording module 1006 is used to: start the pulseaudio service in the Linux system, control the target sound card and the target playback device through the paplay tool, and after playing the audio of the Linux system, control the target sound card and the target recording device through the parecord tool to record the audio of the Linux system.
[0111] Optionally, the apparatus further includes an embedding module 1007, which is used to: in the Android system of the Android device, before opening the target sound card and target audio device of the Android device, embed the Linux system into the Android device using a preset mode; the preset mode is Proot mode, Chroot mode or Docker mode.
[0112] It should be noted that the modules in the apparatus for playing Linux audio in an Android device in this embodiment correspond one-to-one to the steps in the method for playing Linux audio in an Android device in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned method for playing Linux audio in an Android device, which will not be repeated here.
[0113] Based on the same inventive concept, an embodiment of the present application also provides an Android device, which includes a processor, a memory, and a computer program stored in the memory. When the computer program is executed by the processor, it implements the aforementioned method of playing Linux audio in the Android device.
[0114] Based on the same inventive concept, an embodiment of the present application further provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the aforementioned method of playing Linux audio in an Android device is implemented.
[0115] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0116] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a disk, or an optical disk), and includes a number of instructions for a multimedia terminal device to execute the methods described in each embodiment of the present application.
[0118] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for playing Linux audio in an Android device, characterized in that: include: In an Android system of an Android device, use a tinymix command to open a target sound card and a target audio device; wherein the Android device is provided with an Android system and a Linux system; In the Linux system, modifying the access rights of the target sound card and the target audio device to pulseaudio service; Configuring the target sound card and the target audio device in the configuration file of the pulseaudio service; wherein the target audio device includes a target playback device; Start the pulseaudio service, control the target sound card and the target playback device, and play the audio of the Linux system; In the Android system of the Android device, before opening the target sound card and the target audio device, the method further includes: determining the sound card corresponding to the hole where the headset is inserted as the target sound card from all the sound cards of the Android device; and determining the audio device under the target sound card as the target audio device.
2. The method for playing Linux audio in an Android device as claimed in claim 1, characterized in that: In the Linux system, modifying the access rights of the target sound card and the target audio device to pulseaudio service includes: In the / dev / snd folder of the Linux system, the permissions of the target sound card and the target audio device are modified to pulseaudio service.
3. The method for playing Linux audio in an Android device as claimed in claim 1, characterized in that: The starting of the pulseaudio service, controlling the target sound card and the target playback device, and playing the audio of the Linux system includes: The pulseaudio service is started in the Linux system, and the target sound card and the target playback device are controlled by the paplay tool to play the audio of the Linux system.
4. The method for playing Linux audio in an Android device as claimed in claim 3, characterized in that: The target audio device also includes a target recording device; after starting the pulseaudio service in the Linux system, controlling the target sound card and the target playback device through the paplay tool, and playing the audio of the Linux system, the method further includes: The target sound card and the target recording device are controlled by the parecord tool to record the audio of the Linux system.
5. The method for playing Linux audio in an Android device as claimed in claim 1, characterized in that: In the Android system of the Android device, before opening the target sound card and the target audio device of the Android device, the method further includes: A Linux system is embedded into an Android device using a preset mode; the preset mode is Proot mode, Chroot mode or Docker mode.
6. A device for playing Linux audio in an Android device, characterized in that: include: An opening module is used to open a target sound card and a target audio device using a tinymix command in an Android system of an Android device; wherein the Android device is provided with an Android system and a Linux system; A modification module, used for modifying the access rights of the target sound card and the target audio device to pulseaudio service in the Linux system; A configuration module, configured to configure the target sound card and the target audio device in a configuration file of the pulseaudio service; wherein the target audio device includes a target playback device; A playback module, used to start the pulseaudio service, control the target sound card and the target playback device, and play the audio of the Linux system; In the Android system of the Android device, before opening the target sound card and the target audio device, the method further includes: determining the sound card corresponding to the hole where the headset is inserted as the target sound card from all the sound cards of the Android device; and determining the audio device under the target sound card as the target audio device.
7. An Android device, characterized in that: The Android device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method for playing Linux audio in an Android device according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the processor executes the computer program to implement the method for playing Linux audio in an Android device according to any one of claims 1 to 5.
Citation Information
Patent Citations
Virtual audio device and method based on Linux and Android compatible technology
CN111930340A
Method and device for sharing audio equipment by Linux platform and Android application
CN113535279A