Recording method and related device

By loading driver files that support high sampling rate and binding recording functions between Java, JNI and C layers, the problem of insufficient recording sampling rate in Android system is solved, and the accuracy of high-quality recording and recording to text is improved.

CN115910122BActive Publication Date: 2025-07-04FIBOCOM WIRELESS
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211348413.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2025-07-04
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

The recording sampling rate of electronic devices in existing Android systems is up to 44,100 Hz, which cannot meet the requirements of higher sampling rates in scenes such as recording to text, resulting in insufficient accuracy of recording to text.

Method used

By loading driver files that support sampling rates greater than 44100 Hz, configuring recording functions, and binding between Java, JNI and C layers, bypassing the native Android system recording interface to achieve high-quality recording.

Benefits of technology

The recording sampling rate is improved, the accuracy of recording to text is improved, and the recording effect is achieved with higher quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115910122B_ABST
    Figure CN115910122B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a recording method and related device. The method includes: loading a driver file, where the driver file is adapted to a recording unit in an electronic device and the sampling rate supported by the driver file is greater than 44,100 Hz; configuring a recording function corresponding to the driver file; and performing recording based on the driver file and the recording function to obtain a recording file. By means of the present application, the recording sampling rate can be increased to achieve high-quality recording.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of computer technologies, and particularly to a recording method and related devices. Background Art

[0002] With the continuous development of computer technologies, electronic devices such as mobile phones have become increasingly common in people's daily lives, and the functions of electronic devices have also become increasingly rich. Exemplarily, an electronic device can record sounds through components such as a microphone and a sound card for recording beautiful moments in life, etc.

[0003] Currently, due to the limitations of the native architecture, the highest sampling rate supported by electronic devices using the Android system is 44,100 Hertz (Hz). However, in scenarios such as using a voice recorder to convert recorded speech to text, a higher sampling rate is often required to improve the conversion accuracy. Therefore, a method for increasing the recording sampling rate is needed. Summary of the Invention

[0004] Embodiments of the present application provide a recording method and related devices, which can increase the recording sampling rate through the present application to achieve high-quality recording.

[0005] In a first aspect, the present application provides a recording method, including:

[0006] Loading a driver file, where the driver file is adapted to a recording unit in the electronic device, and the sampling rate supported by the driver file is greater than 44,100 Hz;

[0007] Configuring a recording function corresponding to the driver file;

[0008] Performing recording based on the driver file and the recording function to obtain a recording file.

[0009] The recording method provided by the embodiments of the present application bypasses the native recording interface of the Android system, and realizes recording through loading a driver file at the underlying layer that is adapted to the recording unit and supports a sampling rate greater than 44,100 Hz and configuring a recording control function, and can obtain higher-quality recording compared with the native Android system.

[0010] In a possible implementation manner, configuring the recording function corresponding to the driver file includes:

[0011] Creating a recording control class in the Java layer, where the recording control class includes a native function for recording control;

[0012] Creating a recording control function in the C layer, where the recording control function is used to implement recording based on the driver file;

[0013] In the Java native call, bind the above audio recording control class to the above audio recording encoding function in the JNI layer.

[0014] In a possible implementation, the above audio recording based on the above driver file and the above audio recording function to obtain an audio recording file includes:

[0015] Receive an audio recording instruction;

[0016] Call the above audio recording control class, and execute the above audio recording control function through the above native function in the above audio recording control class. The execution of the above audio recording control function is based on the above driver file.

[0017] In a possible implementation, the above audio recording based on the above driver file and the above audio recording function to obtain an audio recording file includes:

[0018] When the amount of the initial audio recording data collected based on the above driver file and the above audio recording function is greater than or equal to a first threshold, delete the audio data outside the human ear audible range from the above initial audio recording data to obtain processed audio recording data;

[0019] Process the above processed audio recording data as audio recording data to obtain the above audio recording file.

[0020] In a possible implementation, the above audio recording based on the above driver file and the above audio recording function to obtain an audio recording file includes:

[0021] When the volume of the initial audio recording data collected based on the above driver file and the above audio recording function is greater than or equal to a second threshold, process the above initial audio recording data as audio recording data to obtain the above audio recording file.

[0022] In a possible implementation, the above method further includes:

[0023] When the volume of the initial audio recording data collected based on the above driver file and the above audio recording function is less than the above second threshold, filter out the above initial audio recording data.

[0024] In a second aspect, the present application provides an audio recording device, including:

[0025] A loading unit, configured to load a driver file, where the driver file adapts to an audio recording unit in an electronic device, and the sampling rate supported by the driver file is greater than 44,100 Hz;

[0026] A configuration unit, configured to configure an audio recording function corresponding to the above driver file;

[0027] A processing unit, configured to perform recording based on the above-mentioned driver file and the above-mentioned recording function to obtain a recording file.

[0028] In a possible implementation manner, the above-mentioned apparatus further includes a creation unit, configured to create a recording control class in the Java layer, where the recording control class includes a native function for recording control;

[0029] The above-mentioned creation unit is further configured to create a recording control function in the C layer, where the recording control function is used to implement recording based on the above-mentioned driver file;

[0030] The above-mentioned apparatus further includes a binding unit, configured to bind the above-mentioned recording control class to the above-mentioned recording encoding function by making a local call in Java to the JNI layer.

[0031] In a possible implementation manner, the above-mentioned apparatus further includes a receiving unit, configured to receive a recording instruction;

[0032] The above-mentioned apparatus further includes a calling unit, configured to call the above-mentioned recording control class, and execute the above-mentioned recording control function through the above-mentioned native function in the above-mentioned recording control class, where the execution of the above-mentioned recording control function is based on the above-mentioned driver file.

[0033] In a possible implementation manner, the above-mentioned apparatus further includes a deletion unit, configured to, when the amount of initial recording data collected based on the above-mentioned driver file and the above-mentioned recording function is greater than or equal to a first threshold, delete audio data outside the human ear audible range from the above-mentioned initial recording data to obtain processed recording data;

[0034] The above-mentioned processing unit is further configured to process the above-mentioned processed recording data as recording data to obtain the above-mentioned recording file.

[0035] In a possible implementation manner, the above-mentioned processing unit is further configured to, when the volume of the initial recording data collected based on the above-mentioned driver file and the above-mentioned recording function is greater than or equal to a second threshold, process the above-mentioned initial recording data as recording data to obtain the above-mentioned recording file.

[0036] In a possible implementation manner, the above-mentioned apparatus further includes a filtering unit, configured to filter out the above-mentioned initial recording data when the volume of the initial recording data collected based on the above-mentioned driver file and the above-mentioned recording function is less than the above-mentioned second threshold.

[0037] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory, where a computer program is stored in the memory, and the processor calls the computer program stored in the memory to execute the method according to the first aspect or any possible implementation manner of the first aspect.

[0038] Fourthly, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on one or more processors, the method in the first aspect or any possible implementation manner of the first aspect is executed.

[0039] Fifthly, an embodiment of the present application provides a computer program product, which includes program instructions. When the program instructions are executed by a processor, the processor executes the method in the first aspect or any possible implementation manner of the first aspect. Description of the Drawings

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the following briefly introduces the drawings required to be used in the embodiments of the present application or the background art.

[0041] Figure 1 It is a schematic diagram of the relationship between the Java layer, the JNI layer, and the C layer provided by an embodiment of the present application;

[0042] Figure 2 It is a schematic flowchart of a recording method provided by an embodiment of the present application;

[0043] Figure 3 It is a schematic flowchart of another recording method provided by an embodiment of the present application;

[0044] Figure 4 It is a schematic structural diagram of an electronic device 40 provided by an embodiment of the present application;

[0045] Figure 5 It is a schematic structural diagram of an electronic device 50 provided by an embodiment of the present application. Detailed Embodiments

[0046] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the above", "the", and "this" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term " / and / " used in the present application refers to and includes any or all possible combinations of one or more of the listed items. The terms "first", "second", etc. in the specification and claims of the present application and the above drawings are used to distinguish different objects and not to describe a specific order.

[0047] It can be understood that the underlying drivers of Android and the operating system kernel are developed using C language and assembly, but the Android operating system itself is developed using Java. In the embodiments of the present application, the part developed using the programming language Java can be understood as the Java layer, and the part developed using the programming language C or C++ can be understood as the C layer, or it can also be called the C / C++ layer.

[0048] In the embodiments of the present application, the interaction between the Java layer and the C layer is implemented through Java Native Interface (JNI). Through the JNI layer, functions in Java programs can call functions in the C layer, and functions in C programs can call functions in the Java layer, realizing the mutual call between the Java layer and the C layer. Exemplarily, the relationship among the above Java layer, JNI layer, and C layer can be represented by Figure 1 shown as Figure 1 which is a schematic diagram of the relationship among the Java layer, JNI layer, and C layer provided by the embodiments of the present application.

[0049] Currently, due to the limitations of the native architecture of the Android system, the highest sampling rate supported by products of the Android system is 44,100 Hertz (Hz). Therefore, a recording method and related device provided by the embodiments of the present application can sample at a sampling rate greater than 44,100 Hz through the present application, realizing high-quality recording. The recording method provided by the present application can be executed by a recording device. Exemplarily, the recording device can be any electronic device capable of executing the recording method provided by the embodiments of the present application, such as a mobile phone, tablet, laptop, voice recorder, and interview machine, etc.

[0050] Exemplarily, please refer to Figure 2 shown as Figure 2 which is a schematic flowchart of a recording method provided by the embodiments of the present application. As Figure 2 shown, the above method includes:

[0051] 201: Load a driver file that adapts to the recording unit in the electronic device and supports a sampling rate greater than 44,100 Hertz.

[0052] In this step, the above recording unit can be understood as a hardware unit for collecting audio, such as a microphone, which can also be called a microphone head, microphone, or microphone, etc. The electronic device in this step can be a mobile phone, tablet, laptop, voice recorder, and interview machine, etc.

[0053] In this step, the above-mentioned driver file is adapted to the above-mentioned recording unit. Exemplarily, the above-mentioned driver file can be adapted to the above-mentioned recording unit by adjusting the configuration information. The sampling rate supported by the above-mentioned driver file is greater than 44,100 Hz. Exemplarily, the sampling rate supported by the above-mentioned driver file can be 192,000 Hz.

[0054] 202: Configure the recording function corresponding to the driver file.

[0055] After the above-mentioned driver file is loaded, the recording device can adapt to sampling with a sampling rate greater than 44,100 Hz. In this step, the recording device creates the recording function of the above-mentioned driver file in the Java layer, the JNI layer, and the C layer.

[0056] In some embodiments, Figure 2 In the method shown, step 202 includes:

[0057] 2021: Create a recording control class in the Java layer. The above-mentioned recording control class includes the native function of recording control.

[0058] In this step, the above-mentioned recording control class can be understood as a Java class for controlling recording. Exemplarily, the above-mentioned recording control class can be named MyMediaRecorder.

[0059] In this step, the above-mentioned recording control class includes the native function of recording control. The native method can be understood as an interface for Java to call non-Java code. The implementation of the above-mentioned native method is implemented by a non-Java language, such as C language. In the embodiments of the present application, the above-mentioned native function of recording control can be understood as a function for controlling recording, and this function is declared as native. Exemplarily, the control of recording can be control methods such as starting recording, pausing recording, and ending recording.

[0060] 2022: Create a recording control function in the C layer. The above-mentioned recording encoding function is used to implement recording based on the above-mentioned driver file.

[0061] In this step, a recording control function is created in the C layer (which can also be understood as in the underlying layer). In the embodiments of the present application, when the above-mentioned driver file is adapted to the above-mentioned recording unit, the C language program in the C layer can, based on the above-mentioned driver file, cause the above-mentioned recording unit to perform audio sampling with a sampling rate greater than 44,100 Hz, which can be specifically implemented through the above-mentioned recording control function in the C layer.

[0062] Exemplarily, the recording control in this step may include recording control methods such as starting recording, pausing recording, and ending recording. It should be understood that the above recording control functions correspond to the recording control in the above recording control class. For example, if the above recording control class includes starting recording and ending recording, then the above recording control functions also correspondingly include starting recording and ending recording; for another example, if the above recording control class includes recording denoising processing, then the above recording control functions also correspondingly include recording denoising processing.

[0063] It can be understood that the above recording control functions may also include underlying recording encoding functions to encode the collected audio data to obtain a recording file.

[0064] 2023: In Java native call, bind the above recording control class and the above recording control functions in the JNI layer.

[0065] It can be understood that after creating the above recording control class in the Java layer and creating the above recording control functions in the C layer, it is also necessary to bind the functions in the Java layer and the functions in the C layer in the JNI layer. In this step, bind the above recording control class and the above recording control functions in the JNI layer so that the native functions in the Java layer can be implemented by the C language program in the C layer.

[0066] 203: Based on the driver file and the recording function, perform recording to obtain a recording file.

[0067] The recording method provided by the embodiments of the present application bypasses the native recording interface of the Android system and realizes recording through the loading of a driver file at the underlying layer that is adapted to the recording unit and supports a sampling rate greater than 44100 Hz and the configuration of recording control functions, and can obtain a higher-quality recording compared to the native Android system.

[0068] Optionally, in some embodiments, based on the above steps 2021 - 2023, Figure 2 Step 203 in the shown method further includes:

[0069] 2031: Receive a recording instruction.

[0070] 2032: Call the above recording control class, and execute the above recording control functions through the above native functions in the above recording control class. The execution of the above recording control functions is based on the above driver file.

[0071] In this step, the above-mentioned recording instruction can be understood as an instruction to start a recording operation. Exemplarily, it can be understood as an instruction to start recording for the first time during a certain recording process, or it can also be a start recording operation to resume recording after a pause in the middle. Exemplarily, the above-mentioned recording instruction can be an instruction input by the user (such as clicking through a display screen), or it can also be a recording instruction sent by another communication device to the recording device.

[0072] After receiving the above-mentioned recording instruction, in response to the above-mentioned recording instruction; call the recording control class in the Java layer, and execute the above-mentioned recording control function through the above-mentioned native function in the above-mentioned recording control class. Since the above-mentioned driver file has been adapted to the above-mentioned recording unit, recording can be implemented under the control of the above-mentioned recording control function.

[0073] In some embodiments, Figure 2 In the method shown, the above-mentioned step 203 includes:

[0074] 2033: When the amount of data of the initial recording data collected based on the above-mentioned driver file and the above-mentioned recording function is greater than or equal to the first threshold, delete the audio data outside the audible range of the human ear from the above-mentioned initial recording data to obtain processed recording data;

[0075] 2034: Process the above-mentioned processed recording data as recording data to obtain the above-mentioned recording file.

[0076] In this embodiment, the above-mentioned first threshold can be set according to the actual situation. For example, it can be set according to the sampling rate. When the sampling rate is relatively large, a larger first threshold is set; when the sampling rate is relatively small, a smaller first threshold is set. It can be understood that after the initial recording data is collected, the above-mentioned initial recording data is stored in a buffer. The amount of data of the initial recording data collected by the above-mentioned recording function can be measured by the number of buffers. Exemplarily, it can be considered that the amount of data of the initial recording data is equal to the first threshold when the recording data storage is full of 100 buffers. Thus, the above-mentioned first threshold is the data storage amount corresponding to the above-mentioned 100 buffers.

[0077] It can be understood that the frequency range of the sound that the human ear can hear is 20Hz - 20KHz. Compared with the existing Android system, in this embodiment, the audio data outside the audible range of the human ear is deleted from the above-mentioned initial recording data, and then the recording file is generated, so that clear human voices can be retained as much as possible in a noisy environment, and clear recording data can be obtained.

[0078] In addition, compared with performing the above processing after obtaining the entire initial recording data, performing the above processing when the amount of the initially collected recording data is greater than or equal to the first threshold in this embodiment can improve the efficiency of obtaining the recording file.

[0079] In still other embodiments, Figure 2 in the method shown, step 203 above includes:

[0080] 2035: When the volume of the initially collected recording data based on the above drive file and the above recording function is greater than or equal to the second threshold, process the above initial recording data as the recording data to obtain the above recording file.

[0081] It can be understood that in response to a recording instruction, the recording device collects initial recording data based on the above drive file and the above recording function. When the volume of the above initial recording data is greater than or equal to the second threshold, the recording device processes the initial recording data as the final recording data, such as encoding processing, to obtain the final recording file.

[0082] However, when the volume of the above initial recording data is less than the second threshold, the recording device filters out the above initial recording data.

[0083] In this embodiment, the above second threshold may be a preset value set in advance. Exemplarily, the above second threshold may be set according to the actual situation. For example, it may be 30 decibels, 40 decibels, etc. Optionally, the above second threshold may also be obtained by receiving user input through an input device, such as input through an input device such as a keyboard or a touch screen.

[0084] It can be understood that in the embodiments of the present application, the embodiment corresponding to step 2035 above may be coupled with the embodiments corresponding to steps 2023 - 2034 above. That is, after collecting the initial recording data, the recording device may first judge the volume of the initial recording data. When the volume of the above initial recording data is greater than or equal to the above second threshold and the amount of the initial recording data is greater than or equal to the first threshold, audio data outside the human ear's audible range is deleted from the above initial recording data, and then the recording file is obtained.

[0085] For the convenience of further understanding the recording method provided by the present application, please refer to Figure 3 , Figure 3 is a schematic flowchart of another recording method provided by the embodiments of the present application. As Figure 3 shown, the above method includes:

[0086] 301: Start.

[0087] In this step, reference can be made to the description in the previous step 2031, that is, this step can be understood as receiving a recording instruction to start recording.

[0088] 302: Initialization.

[0089] In this step, initialization can be understood as creating a recording control class, such as the recording control class MyMediaRecorder in the previous step 2021. If the created recording control class is not empty, it can be considered that the initialization is successful; if the created recording control class is empty, it can be considered that the initialization fails.

[0090] If the initialization in step 302 is successful, execute step 303: Set parameters.

[0091] In this step, the parameters to be set can be the sampling rate, bit rate, and number of channels, etc. Exemplarily, the sampling rate can be set according to the sampling rate supported by the above-mentioned driver file, such as 48000Hz, 96000Hz, and 19200Hz, etc.; the bit rate can be set to 16 bits or 24 bits, etc.; the number of channels can be set to mono or stereo. Exemplarily, the saving path of the recording file can also be set.

[0092] If the initialization in step 302 fails, execute step 307: End.

[0093] It should be understood that the end in step 307 should be understood as an automatic end before starting to collect recording data, while the end in step 306 is that the user actively ends the audio collection, or an automatic end after reaching the preset time.

[0094] If the parameter setting in step 303 is successful, execute step 304: Start recording.

[0095] In this step, starting to record can be understood as starting to collect audio data. Specifically, reference can be made to the descriptions in the previous steps 202, 2021 - 2023, or step 2032.

[0096] If the parameter setting in step 303 is successful, execute step 307: End.

[0097] 305: Collect recording.

[0098] In this step, the recording device continuously collects audio data, the underlying layer opens the recording unit, continuously applies for memory space, then fills the applied memory space with the data collected by the recording unit, and then writes it into the recording file. During the process of collecting recording, it can include the above steps 2033 - 2034, and step 2035.

[0099] 306: End recording.

[0100] 307: End.

[0101] The method provided by the embodiments of the present application is elaborated in detail above. Next, the device provided by the embodiments of the present application will be introduced.

[0102] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of an electronic device 40 provided by the embodiments of the present application. This electronic device 40 is used to execute the above-mentioned recording method. It should be understood that any device capable of implementing the recording method provided by the present application belongs to the protection scope of the present application. Exemplarily, this electronic device 40 may be the above-mentioned recording device, such as a mobile phone, a tablet computer, etc., which is not limited in the embodiments of the present application.

[0103] As Figure 4 shown, this electronic device 40 includes a loading unit 401, a configuration unit 402, and a processing unit 403. Optionally, it may further include a creating unit 404, a binding unit 405, a receiving unit 406, a calling unit 407, a deleting unit 408, and a filtering unit 409. Among them, the descriptions of each unit are as follows:

[0104] The loading unit 401 is used to load a driver file. The above driver file is adapted to the recording unit in the electronic device, and the sampling rate supported by the above driver file is greater than 44,100 Hz;

[0105] The configuration unit 402 is used to configure a recording function corresponding to the above driver file;

[0106] The processing unit 403 is used to perform recording based on the above driver file and the above recording function to obtain a recording file.

[0107] In a possible implementation manner, the above device further includes a creating unit 404, which is used to create a recording control class in the Java layer. The above recording control class includes native functions for recording control;

[0108] The above creating unit 404 is further used to create a recording control function in the C layer. The above recording control function is used to implement recording based on the above driver file;

[0109] The above device further includes a binding unit 405, which is used to bind the above recording control class and the above recording encoding function in the Java native call JNI layer.

[0110] In a possible implementation manner, the above device further includes a receiving unit 406, which is used to receive a recording instruction;

[0111] The above device further includes a calling unit 407, configured to call the above recording control class, and execute the above recording control function through the above native function in the above recording control class, and the execution of the above recording control function is based on the above driver file.

[0112] In a possible implementation manner, the above device further includes a deleting unit 408, configured to, when the data volume of the initial recording data collected based on the above driver file and the above recording function is greater than or equal to a first threshold, delete audio data outside the human ear audible range from the above initial recording data to obtain processed recording data;

[0113] The above processing unit 403 is further configured to process the above processed recording data as recording data to obtain the above recording file.

[0114] In a possible implementation manner, the above processing unit 403 is further configured to, when the volume of the initial recording data collected based on the above driver file and the above recording function is greater than or equal to a second threshold, process the above initial recording data as recording data to obtain the above recording file.

[0115] In a possible implementation manner, the above device further includes a filtering unit 409, configured to filter out the above initial recording data when the volume of the initial recording data collected based on the above driver file and the above recording function is less than the above second threshold.

[0116] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of an electronic device 50 provided by an embodiment of the present application. The electronic device 50 may be a flat mobile phone, a 32-bit microprocessor, or a 64-bit microprocessor, etc. As Figure 5 shown, the above electronic device 50 includes a memory 501 and a processor 502. Further optionally, a communication interface 503 and a bus 504 may also be included, where the memory 501, the processor 502, and the communication interface 503 are communicatively connected to each other through the bus 504.

[0117] Among them, the memory 501 is used to provide a storage space, and data such as an operating system and computer programs may be stored in the storage space. The memory 501 includes but is not limited to a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a compact disc read-only memory (CD-ROM).

[0118] The processor 502 is a module that performs arithmetic and logical operations, and can be one or a combination of multiple processing modules such as a central processing unit (CPU), a graphics processing unit (GPU), or a microprocessor unit (MPU).

[0119] The computer program is stored in the memory 501, and the processor 502 calls the computer program stored in the memory 501 to execute the above-mentioned recording method. Exemplarily, the steps executed by the above-mentioned creation unit 404, binding unit 405, calling unit 407, deleting unit 408, and filtering unit 409 can be implemented by the processor 502, and the content received by the receiving unit 406 can be obtained from the communication interface 503.

[0120] This application also provides a computer-readable storage medium, in which computer code is stored. When the computer code runs on a computer, the computer is caused to execute the method of the above embodiment.

[0121] This application also provides a computer program product, which includes computer code or a computer program. When the computer code or the computer program runs on a computer, the method in the above embodiment is caused to be executed.

[0122] As described above, the above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the above-mentioned claims.

Claims

1. A recording method, characterized in that, The method includes: Loading a driver file, where the driver file is adapted to a recording unit in an electronic device, and the sampling rate supported by the driver file is greater than 44,100 Hz; Configuring a recording function corresponding to the driver file; Performing recording based on the driver file and the recording function to obtain a recording file; The configuring a recording function corresponding to the driver file includes: Creating a recording control class in the Java layer, where the recording control class includes a native function for recording control; Creating a recording control function in the C layer, where the recording control function is used to implement recording based on the driver file; Invoking the JNI layer in the Java native to bind the recording control class and the recording control function; The performing recording based on the driver file and the recording function to obtain a recording file includes: Receiving a recording instruction; Invoking the recording control class, and executing the recording control function through the native function in the recording control class, where the execution of the recording control function is based on the driver file.

2. The method according to claim 1, wherein The performing recording based on the driver file and the recording function to obtain a recording file includes: In a case where the amount of initial recording data collected based on the driver file and the recording function is greater than or equal to a first threshold, deleting audio data outside the human ear audible range from the initial recording data to obtain processed recording data; Processing the processed recording data as recording data to obtain the recording file.

3. The method according to claim 1, characterized in that The performing recording based on the driver file and the recording function to obtain a recording file includes: In a case where the volume of the initial recording data collected based on the driver file and the recording function is greater than or equal to a second threshold, processing the initial recording data as recording data to obtain the recording file.

4. The method according to claim 3, wherein The method further includes: In a case where the volume of the initial recording data collected based on the driver file and the recording function is less than the second threshold, filtering out the initial recording data.

5. A recording device, characterized in that, The device includes: A loading unit for loading a driver file, where the driver file is adapted to a recording unit in an electronic device, and the sampling rate supported by the driver file is greater than 44,100 Hz; A configuring unit for configuring a recording function corresponding to the driver file; A processing unit for performing recording based on the driver file and the recording function to obtain a recording file; A creating unit for creating a recording control class in the Java layer, where the recording control class includes a native function for recording control; The creating unit is further configured to create a recording control function in the C layer, where the recording control function is used to implement recording based on the driver file; A binding unit for binding the recording control class and the recording control function by invoking the JNI layer in the Java native; The device further includes a receiving unit for receiving a recording instruction; The device further includes a calling unit, configured to call the recording control class, and execute the recording control function through the native function in the recording control class, where the execution of the recording control function is based on the driver file.

6. An electronic device, characterized in that, It includes a processor and a memory, where the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions so that the method according to any one of claims 1-4 is executed.

7. A chip, characterized in that, The chip is applied to an electronic device, the chip includes a processor, and the processor is used to call computer instructions so that the method according to any one of claims 1-4 is executed.

8. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and when the computer program runs on a processor, the method according to any one of claims 1-4 is executed.

Citation Information

Patent Citations

  • Audio output method, mobile terminal and audio playing device

    CN108319443A