CN113643728A - Audio recording method, electronic device, medium, and program product - Google Patents

Audio recording method, electronic device, medium, and program product Download PDF

Info

Publication number
CN113643728A
CN113643728A CN202110924280.5A CN202110924280A CN113643728A CN 113643728 A CN113643728 A CN 113643728A CN 202110924280 A CN202110924280 A CN 202110924280A CN 113643728 A CN113643728 A CN 113643728A
Authority
CN
China
Prior art keywords
audio
processed
electronic device
user
audio frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110924280.5A
Other languages
Chinese (zh)
Other versions
CN113643728B (en
Inventor
彭连银
余艳辉
赵俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202110924280.5A priority Critical patent/CN113643728B/en
Publication of CN113643728A publication Critical patent/CN113643728A/en
Application granted granted Critical
Publication of CN113643728B publication Critical patent/CN113643728B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/7243User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages
    • H04M1/72433User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages for voice messaging, e.g. dictaphones

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The method can be applied to electronic equipment and comprises the steps that the electronic equipment obtains an audio frame, the audio frame is divided into a plurality of audio segment units with equal time duration, two adjacent audio segment units in the plurality of audio segment units have an overlapping area, then the electronic equipment adjusts the time duration of the overlapping area according to a target playing speed configured by a user, then a processed audio frame is obtained according to the adjusted overlapping area and the plurality of audio segment units, and the processed audio frame is coded to obtain a video file. Therefore, the method supports the user to adjust the playing speed of the recorded audio file in the audio recording process, and can enable the recorded video file to achieve the effect of changing speed and not changing tone through a time domain overlapping method.

Description

Audio recording method, electronic device, medium, and program product
Technical Field
The present application relates to the field of audio technologies, and in particular, to an audio recording method, an electronic device, a computer storage medium, and a computer program product.
Background
With the development of audio technology, more and more electronic devices (e.g., mobile phones, tablet computers) support audio recording. Based on this, the user can record sounds in various scenes using the electronic device. For example, in an educational scenario, a user may record, using an electronic device, a sound of a teacher explaining knowledge in a classroom; for another example, in a debate scenario, the user may record the sound of both debates using the electronic device.
Taking an education scene as an example, the user can change the speed of the recorded audio file based on the speed of the teacher explaining the knowledge in the class to obtain the audio file with a proper speed of speech so as to improve the efficiency of reviewing the knowledge learned in the class. In some examples, the classroom is 40 minutes, at 0-20 minutes, the teacher explains the knowledge at a slower speech rate, and at 21-40 minutes, the teacher explains the knowledge at a faster speech rate. The user can clip the recorded audio file to obtain the audio file with moderate speech speed. Specifically, the audio file is divided into a first part (part corresponding to 0-20 minutes) and a second part (part corresponding to 21-40 minutes), and then the speed change processing is respectively carried out on each part, namely the playing speed of the first part is increased, and the playing speed of the second part is decreased; and finally, splicing the audio file of the first part after speed regulation and the audio file of the second part after speed regulation to obtain the edited audio file.
However, in the above-mentioned method of editing an audio file, operations such as decoding, changing speed, encoding, etc. are required for the recorded audio file, and when different parts of the audio file need to be separately sped up, the video file also needs to be split. Therefore, the mode of editing the audio file after the audio file is recorded is complex to operate and low in processing efficiency.
Disclosure of Invention
The purpose of this application lies in: an audio recording method, an electronic apparatus, a medium, and a program product are provided to simplify operations and improve processing efficiency.
In order to achieve the purpose, the technical scheme is as follows:
in a first aspect, the present application provides an audio recording method, which may be applied to an electronic device. The electronic device can be a mobile phone, a recording pen, a tablet computer and the like. Specifically, the method comprises the following steps:
the method comprises the steps that the electronic equipment acquires an audio frame and divides the audio frame into a plurality of audio segment units with equal time duration, and two adjacent audio segment units in the plurality of audio segment units have an overlapping area; then, the electronic equipment can adjust the duration of the overlapping area according to the target playing speed configured by the user; and then the electronic equipment obtains a processed audio frame according to the adjusted overlapping area and the plurality of audio segment units, and then codes the processed audio frame to obtain an audio file. For example, the electronic device obtains a processed time stamp of the processed audio frame according to the target playing speed, and encodes the processed audio frame based on the processed time stamp of the processed audio frame to obtain an audio file.
In the method, a user can configure the target playing speed in real time in the process of recording the audio by the electronic equipment, so that the recorded audio file can be played at the playing speed meeting the requirements of the user, the user does not need to further clip the recorded audio file and the like, the user operation is simplified, and the processing efficiency is improved.
And the method adjusts the audio frame in a time domain overlapping mode. For example, the audio frame is divided into a plurality of smaller audio segment units with equal time length, an overlapping area exists between two adjacent audio segment units in the plurality of audio segment units, and the time length of the overlapping area is adjusted, so that the effect of speed change is achieved. In this way, the audio frame does not need to be compressed, and the frequency of the sound recorded in the original audio frame is not compressed, and the pitch of the sound in the original audio frame is not changed. Therefore, the method can ensure that the recorded audio file achieves the effect of changing speed and not changing tone.
In some possible implementations, the electronic device may adjust the overlap area based on a size relationship between a target play speed configured by a user and a preset play speed. Specifically, when the target play speed configured by the user is greater than the preset play speed, the electronic device lengthens the duration of the overlapping area, so as to achieve the effect of shortening the duration of the whole audio frame, and realize quick play; when the target playing speed configured by the user is lower than the preset playing speed, the electronic equipment shortens the duration of the overlapping area, so that the effect of lengthening the duration of the whole audio frame is achieved, and slow playing is realized.
In some possible implementations, the electronic device may further calculate a post-processing duration of the overlap region based on the target play speed configured by the user. Specifically, the electronic device adjusts the duration of the overlap region to be the processed duration according to the duration of the overlap region, the number of the plurality of audio segment units, the duration of any one of the plurality of audio segment units, and the target play speed configured by the user. In some examples, the electronic device may calculate the post-processing duration of the overlap region using the following equation (1):
Figure BDA0003208591710000021
txa post-processing duration for the overlap region; v is a target play speed configured by the user, for example, when the target play speed configured by the user is 0.5 speed, v is 0.5, and when the target play speed configured by the user is 1.5 speed, v is 1.5; t is t0Is the duration of the overlap region; n is the number of a plurality of audio segment units; and T is the time duration of any one of the plurality of audio segment units.
Therefore, the electronic equipment can directly calculate the processed time length of the adjusted overlapping area based on the target playing speed configured by the user, and further can adjust the time length of the original overlapping area to the processed time length of the adjusted overlapping area.
In some possible implementation manners, the electronic device may obtain the number of processed sampling points based on the target playing speed and the preset number of sampling points of the microphone; and then acquiring the time interval between the processed audio frame and the previous audio frame of the processed audio frame based on the number of the processed sampling points, the number of channels, the sampling rate and the number of bytes of the sampling points, and adding the time interval and the processed time stamp of the previous audio frame of the processed audio frame to obtain the processed time stamp of the processed audio frame.
In some examples, the electronic device may calculate a post-processing timestamp for the post-processing audio frame using equation (2) as follows:
Figure BDA0003208591710000022
wherein,
Figure BDA0003208591710000023
a processed timestamp for the nth processed audio frame; siThe number of processed sampling points of the ith audio frame (or the processed audio frame); c is the number of channels (channel number), e.g., C ═ 2; r is the sample rate (sample rate), which may be 44.1kHz, for example, meaning 44.1k samples per second; b is the byte per sample (byte per sample), for example, B is 2.
The electronic device may then calculate the processed time stamp of the processed audio frame according to the formula (2), and encode the processed audio frame according to the processed time stamp of the processed audio frame, thereby obtaining the audio file. For example, the electronic device may send the processed time stamp of the processed audio frame and the processed audio frame to an audio encoder, the audio encoder outputs the output encoding result to a wrapper, and the wrapper encapsulates the encoding result to obtain the audio file.
In some possible implementations, the user may configure the target play speed before the electronic device starts audio recording, for example, by configuring the target play speed through a throttle control. Then, the user may click the recording control to trigger a recording request, where the recording request includes the target play speed configured by the user. And the electronic equipment starts recording according to the recording request so as to obtain the audio frame. Therefore, the electronic equipment can record the audio at the starting time of recording the audio at the target playing speed configured by the user, the applicability of the method is improved, the user requirements are met, and the user experience is improved.
In some possible implementations, a user may configure a target playing speed during audio recording performed by the electronic device, for example, configure the target playing speed through a speed regulation control, and trigger a speed regulation request, where the speed regulation request includes the target playing speed configured by the user. The electronic equipment can adjust the duration of the overlapping area by using the target playing speed carried in the speed regulation request according to the speed regulation request.
In a second aspect, the present application provides an electronic device comprising:
an acquisition unit configured to acquire an audio frame;
the splitting unit is used for splitting the audio frame into a plurality of audio segment units with equal time duration; overlapping regions exist between two adjacent audio segment units in the plurality of audio segment units;
the adjusting unit is used for adjusting the duration of the overlapping area according to a target playing speed configured by a user;
a synthesizing unit, configured to obtain a processed audio frame according to the adjusted overlap region and the multiple audio segment units;
the coding unit is used for acquiring the processed time stamp of the processed audio frame according to the target playing speed; and coding the processed audio frame according to the processed time stamp of the processed audio frame to obtain an audio file.
In some possible implementation manners, the adjusting unit is specifically configured to, when a target play speed configured by a user is greater than a preset play speed, increase a duration of the overlap area; and when the target playing speed configured by the user is less than the preset playing speed, shortening the duration of the overlapping area.
In some possible implementations, the adjusting unit is specifically configured to adjust the duration of the overlapping region to be the processed duration according to a target play speed configured by a user, the duration of the overlapping region, the number of the multiple audio segment units, and the duration of any one of the multiple audio segment units.
In some possible implementation manners, the encoding unit is specifically configured to obtain the number of processed sampling points according to the target playing speed and the preset number of sampling points of the microphone; acquiring the time interval between the processed audio frame and the audio frame before the processed audio frame according to the number of the processed sampling points, the number of channels, the sampling rate and the number of bytes of the sampling points; and adding the time interval and the processed time stamp of the previous audio frame of the processed audio frame to obtain the processed time stamp of the processed audio frame.
In some possible implementations, the obtaining unit is specifically configured to obtain a recording request, where the recording request includes a target play speed configured by a user; and acquiring the audio frame according to the recording request.
In some possible implementation manners, the adjusting unit is specifically configured to obtain a speed regulation request, where the speed regulation request includes a target play speed configured by a user; and adjusting the duration of the overlapping area by using the target playing speed configured by the user according to the speed regulation request.
In a third aspect, the present application provides an electronic device comprising a processor and a memory; wherein one or more computer programs are stored in the memory, the one or more computer programs comprising instructions; the instructions, when executed by the processor, cause the electronic device to perform the audio recording method as set forth in any one of the possible designs of the first aspect.
In a fourth aspect, the present application provides a computer storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the audio recording method as set forth in any one of the possible designs of the first aspect.
In a fifth aspect, the present application provides a computer program product for executing the audio recording method according to any one of the possible designs of the first aspect when the computer program product runs on a computer.
It should be appreciated that the description of technical features, solutions, benefits, or similar language in this application does not imply that all of the features and advantages may be realized in any single embodiment. Rather, it is to be understood that the description of a feature or advantage is intended to include the specific features, aspects or advantages in at least one embodiment. Therefore, the descriptions of technical features, technical solutions or advantages in the present specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantages described in the present embodiments may also be combined in any suitable manner. One skilled in the relevant art will recognize that an embodiment may be practiced without one or more of the specific features, aspects, or advantages of a particular embodiment. In other instances, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
Fig. 1 is a diagram illustrating an example of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a block diagram of an audio recording according to an embodiment of the present disclosure;
fig. 3 is a flowchart of an audio recording method according to an embodiment of the present application;
4A-4C are user interface diagrams of an electronic device initiating a recording according to an embodiment of the present application;
5A-5E are schematic diagrams of a throttle control provided by an embodiment of the present application;
6A-6C are schematic diagrams of splitting an audio frame according to an embodiment of the present application;
fig. 7 is a schematic diagram of a frame extraction method according to an embodiment of the present application;
fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application;
fig. 9 is a schematic view of an electronic device according to an embodiment of the present application.
Detailed Description
The terms "first", "second" and "third", etc. in the description and claims of this application and the description of the drawings are used for distinguishing between different objects and not for limiting a particular order.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
For clarity and conciseness of the following descriptions of the various embodiments, a brief introduction to the related art is first given:
audio recording refers to collecting sound by a sound pickup device (e.g., a microphone) to obtain a sound sequence, and then packaging the sound sequence (e.g., audio frames) into an audio file. The audio file can be played by a player to restore the sound recorded by the microphone. In some embodiments, the user may record audio of the scene of a music event, a debate event, a lecture event, or a classroom lecture to obtain an audio file of a corresponding scene.
In order to improve the playing effect of the audio file, a user usually clips the recorded audio file, so that the processed audio file is played at a more comfortable playing speed, thereby helping listeners to understand the content recorded in the audio file. The content recorded by the audio file is taken as the sound for teachers to explain knowledge in class, the audio file is played at a comfortable playing speed, and the efficiency of the user to review the knowledge learned in class can be improved.
However, in order to obtain the audio file with a better playing effect, operations such as decoding, changing speed, encoding, or splitting and merging are required for the recorded audio file. Therefore, there is a need for an audio recording method that simplifies user operations and improves processing efficiency.
In view of this, the present application provides an audio recording method, which can be applied to an electronic device. In the method, a user can preset the playing speed of the recorded audio file at different positions on the playing progress bar according to requirements in the audio recording process. Specifically, the electronic equipment acquires an audio frame, divides the audio frame into a plurality of audio segment units with equal time length, such as a first audio segment unit and a second audio segment unit, and an overlapping area exists between two adjacent audio segment units in the plurality of audio segment units; and then, the electronic equipment adjusts the duration of the overlapping region based on the target playing speed configured by the user, obtains a processed audio frame according to the adjusted overlapping region and the plurality of audio segment units, and codes the processed audio frame to obtain an audio file. For example, the electronic device obtains a processed time stamp of the processed audio frame according to the target playing speed, and encodes the processed audio frame based on the processed time stamp of the processed audio frame to obtain an audio file.
On one hand, the method supports the user to set the playing speed of the recorded audio file in the audio recording process. Therefore, after the electronic equipment records the audio file, the playing speed of the audio file is the audio file meeting the requirements of the user, further processing such as clipping by the user is not needed, the user operation is simplified, and the processing efficiency is improved.
On the other hand, the method adjusts the audio frame in a time domain overlapping mode. Specifically, the method further divides the audio frame into a plurality of audio segment units with equal time length, an overlapping area exists between two adjacent audio segment units in the plurality of audio segment units, and the time length of the overlapping area is adjusted through a target playing speed configured by a user, so that the purpose of adjusting the time length of the audio frame is achieved. The method does not need to compress the audio frame, further does not compress the frequency of the sound recorded in the original audio frame, and further does not change the tone of the sound in the original audio frame. Therefore, the method can achieve the effect of changing speed without changing tone, and further improve the user experience.
In some embodiments, the electronic device may be a voice pen, a mobile phone, a tablet Computer, a desktop Computer, a laptop Computer, a notebook Computer, an Ultra-mobile Personal Computer (UMPC), a handheld Computer, a netbook, a Personal Digital Assistant (PDA), a wearable electronic device, a smart watch, and the like, and the specific form of the electronic device is not particularly limited in this application. In this embodiment, a structure of an electronic device may be as shown in fig. 1, where fig. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
As shown in fig. 1, the electronic device 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, a Subscriber Identification Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the present embodiment does not constitute a specific limitation to the electronic device. In other embodiments, an electronic device may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors. For example, in the present application, the processor may perform the following steps: the method comprises the steps of obtaining an audio frame, dividing the audio frame into a plurality of audio segment units with equal time length, enabling two adjacent audio segment units in the plurality of audio segment units to have an overlapping area, adjusting the time length of the overlapping area according to a target playing speed configured by a user, obtaining a processed audio frame according to the adjusted overlapping area and the plurality of audio segment units, and coding the processed audio frame to obtain an audio file.
The controller can be a neural center and a command center of the electronic device. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (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.
The I2C interface is a bi-directional synchronous serial bus that includes a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, such that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the electronic device.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may 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, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device, and may also be used to transmit data between the electronic device and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
It should be understood that the interface connection relationship between the modules illustrated in this embodiment is only an exemplary illustration, and does not constitute a limitation on the structure of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The electronic device implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an 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 alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may be a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-OLED, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device may include 1 or N display screens 194, with N being a positive integer greater than 1.
A series of Graphical User Interfaces (GUIs) may be displayed on the display screen 194 of the electronic device, and these GUIs are the main screen of the electronic device. Generally, the size of the display screen 194 of the electronic device is fixed, and only a limited number of controls can be displayed in the display screen 194 of the electronic device. A control is a GUI element, which is a software component contained in an application program and controls all data processed by the application program and interactive operations related to the data, and a user can interact with the control through direct manipulation (direct manipulation) to read or edit information related to the application program. Generally, a control may include a visual interface element such as an icon, button, menu, tab, text box, dialog box, status bar, navigation bar, Widget, and the like. .
The electronic device may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the electronic device may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used for performing fourier transform and the like on the frequency point energy.
Video codecs are used to compress or decompress digital video. The electronic device may support one or more video codecs. In this way, the electronic device can play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The electronic device may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, audio recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic device answers a call or voice information, it can answer the voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking the user's mouth near the microphone 170C. The electronic device may be provided with at least one microphone 170C. In other embodiments, the electronic device may be provided with two microphones 170C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and the like. In some examples, the electronic device may capture the audio frames through a microphone.
For ease of understanding, the electronic device audio recording process will be described below in conjunction with the audio recording framework shown in fig. 2.
As shown in fig. 2, the framework of audio recording can be divided into three layers, for example, an application layer, a framework layer (framework), and a Hardware Abstraction Layer (HAL).
Wherein the application layer may include a series of application packages. The application package may include applications such as a recorder, camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc. The framework layer is used for providing an Application Programming Interface (API) and a programming framework. The hardware abstraction layer encapsulates the Linux kernel driver, provides an interface upwards and shields the implementation details of the bottom hardware. In some examples, the user may trigger a corresponding request through an application such as a sound recorder, a camera, etc., and the framework layer may respond after receiving the request, for example, sending an instruction to the hardware abstraction layer to instruct turning on a microphone or turning on a camera, etc.
In an audio recording scene, a recording tool (audio recorder) may output an audio frame collected by a microphone, then an electronic device processes the audio frame, and then sends the processed audio frame (for example, an audio stream composed of the processed audio frame) to an audio encoder, and then a wrapper encapsulates an encoding result output by the audio encoder to obtain an audio file.
In some examples, the electronic device may divide an audio frame into a plurality of audio segment units with equal duration, wherein two adjacent audio segment units in the plurality of audio segment units have an overlapping region, and then adjust the duration of the overlapping region according to a target play speed configured by a user to achieve the goal of adjusting the duration of the audio frame, thereby achieving a variable speed effect. The electronic device then obtains a processed audio frame based on the adjusted overlap region and the plurality of audio segment units. The electronic device may also adjust the timestamp of the processed audio frame, and the audio encoder encodes the processed audio frame based on the processed timestamp.
In a video recording scene, on the basis of the recording scene, a video recording tool (media recorder) can output video frames acquired by a camera, then electronic equipment processes the video frames, and then the processed video frames (for example, video streams formed by the processed video frames) are sent to a video encoder, and then a packaging device packages the encoding result of the video encoder and the encoding result of the audio encoder to obtain a video file. In some examples, the electronic device may further align the video frame and the audio frame, and then send the aligned video frame and audio frame to the video encoder and the audio encoder, respectively, for encoding, so that the sound and the mouth shape in the obtained video file are corresponding.
In some examples, the electronic device may adjust the recording frame rate of the camera according to a target play speed configured by a user. When the target playing speed is greater than the preset playing speed, the electronic device may lower the recording frame rate of the camera, for example, when a user sets a 2-time video, the recording frame rate of the camera is adjusted from 30fps to 15fps, and after the recording frame rate is adjusted to 15fps relative to the original recording frame rate of 30fps, the number of video frames obtained in a unit time is reduced by 15 frames, where the preset playing speed is the current playing speed. When the target playing speed is lower than the preset playing speed, the electronic device may increase the recording frame rate of the camera, for example, when the user sets 0.5 times speed for recording, the recording frame rate of the camera is adjusted from 30fps to 60 fps. Then, the electronic device may adjust a timestamp of the video frame obtained after the recording frame rate is adjusted, and the video encoder may encode the processed video frame according to the processed timestamp.
Therefore, the audio recording method provided by the embodiment of the application can be applied to audio recording not only to obtain the audio file after speed change, but also to video recording to further obtain the video file after speed change. Based on this, the user can also record the highlight appearing in various scenes by using the electronic equipment, for example, the highlight can be a corresponding highlight corresponding to the goal shot of a football player in the sports event. In order to enable the video file obtained by recording the highlight to have a better playing effect, for example, the video file is played at a slow speed to attract the attention of audiences, the user can adjust the speed to 0.5 times to record the highlight in the video recording process of the electronic equipment, the user does not need to perform processing such as clipping, and the video file with the slow playing effect can be directly obtained, so that the user operation is simplified.
In order to make the technical solution of the present application clearer and easier to understand, the following introduces an audio recording method provided in the embodiment of the present application from the perspective of an electronic device. Referring to fig. 3, an embodiment of the present application provides a flowchart of an audio recording method, where the method may include:
s301: the electronic device acquires an audio frame.
In some examples, the electronic device may present a user interface, as shown in fig. 4A, and the electronic device may start an application (which may be simply referred to as a recorder application) corresponding to the recorder icon 410 according to a touch operation of the recorder icon 401 by a user, and present a recording preview interface as shown in fig. 4B. In addition, the electronic device can start the recorder application in other ways and present a recording preview interface in the embodiment of the application. For example, when the mobile phone is in a blank screen, a locked screen, or a user interface of an application, the recorder application may be started in response to a voice instruction or a shortcut operation of the user, and a recording preview interface of the recorder application may be presented.
As shown in FIG. 4B, the record preview interface includes a throttle control 420 and a record control 431 and a record list 440. The throttle control 420 is used for the user to configure the target playing speed. In some examples, the user may configure the target playback speed before recording, such that the electronic device may record audio directly at the user-configured target playback speed after the user clicks the record control 431. For example, the user clicks the recording control 431 to trigger a recording request, where the recording request includes a target playing speed configured by the user (e.g., the playing speed configured by the aforementioned speed-adjusting control 420), and then the electronic device starts recording according to the recording request to obtain an audio frame.
As shown in fig. 4C, when the user clicks the recording control 431, the recording control 431 switches to a pause control 432, and an end control 450 is presented in the recording preview interface. The pause control 432 is used to pause the recording, and the end control 450 is used to end the recording. Accordingly, the electronic device begins acquiring audio frames, such as by capturing audio frames via a microphone. The microphone may be a built-in microphone of the electronic device, or may be an external microphone connected to the electronic device, and the external microphone may be connected to the electronic device in a wired or wireless manner.
In some embodiments, the electronic device may capture an audio stream by the microphone, where the audio stream is composed of a plurality of audio frames, and the audio frames captured by the electronic device may be audio frames in the audio stream.
In some possible implementation manners, after the user clicks the recording control 431 and the electronic device performs recording, the user may click the speed adjustment control 420 to configure a target playing speed, and then adjust the playing speed of the audio file obtained by recording in real time in the recording process of the electronic device.
As shown in fig. 5A, after the user clicks the speed adjustment control 420, the electronic device presents a slider control 421 on the recording preview interface, and the user can configure the target playing speed through the slider control 421. For example, the user drags the slider to slide in the 0.5-fold speed direction, so that the playing speed of the audio file recorded by the electronic equipment can be slowed, and the user drags the slider to slide in the 2-fold speed direction, so that the playing speed of the audio file recorded by the electronic equipment can be quickened. The present application does not limit the manner in which the user triggers the pacing operation, and the configuration of the target play speed through the slider control 421 is merely an example, and the pacing range shown in the figure as 0.5-fold speed to 2-fold speed is also merely an example.
In some scenes, a user can record the sound of the knowledge explained by the teacher in a classroom by using the electronic equipment, the speed of the speech of the knowledge explained by the teacher is slower in 0-20 minutes and the speed of the speech of the knowledge explained by the teacher is faster in 21-40 minutes in the classroom, and in order to obtain an audio file with moderate speech speed, the user can adjust the playing speed of the recorded audio file in real time in the recording process. As shown in fig. 5B, the user may drag the slider to slide in the direction of 2 times speed in 0-20 minutes, so that the audio file recorded by the electronic device has a faster playing speed in 0-20 minutes; as shown in fig. 5C, the user may drag the slider to slide in the 0.5 × speed direction in 21-40 minutes, so that the playing speed of the video file recorded by the electronic device is slower in 21-40 minutes. Therefore, the user can obtain the audio file with moderate speech speed without editing, the user operation is simplified, and the user time is saved.
In other examples, as shown in fig. 5D, after the user clicks the pacing control 420, the speed selection control 422 is presented in the recording preview interface, and the user can configure the target play speed by clicking a candidate speed in the speed selection control 422. For example, the user may click "1.5 ×" and configure the target playback speed to be 1.5 times speed. Here, the configuration of the target playback speed by the speed selection control 422 is merely an example, and the speed ranges of 0.5 speed, 1 speed, 1.5 speed, and 2 speed in the drawing are also merely an example.
In other embodiments, as shown in fig. 5E, after the user clicks the pacing control 420, the speed input control 423 is presented on the recording preview interface, and the user can configure the target playing speed through the speed input control 423. For example, the user may enter 1.5 at speed input control 423 to configure the target playback speed to be 1.5 times speed. Wherein the configuration of the target speed by the speed input control 423 is merely an example illustration, and the numerical value interval (0.5-2) of the allowable input shown in the figure is also merely an example illustration.
S302: the electronic equipment divides the audio frame into a plurality of audio segment units with equal time length, and an overlapping area exists between two adjacent audio segment units in the plurality of audio segment units.
Where an audio segment unit refers to a unit that is smaller relative to an audio frame. For example, when the duration of an audio frame is 40ms, the duration of an audio segment unit may be 1ms, so that the audio frame is composed of at least 40 audio segment units. As can be seen, the audio frame includes a plurality of audio segment units, based on which the electronic device can split the audio frame to obtain a plurality of audio segment units.
In some possible implementations, the electronic device may divide the audio frame into a plurality of audio segment units of equal duration, and an overlap region exists between adjacent two of the plurality of audio segment units. Wherein, the duration of the overlapping area may be a preset duration. The specific value of the preset duration is not specifically limited in the embodiment of the application, and a person skilled in the art can set the specific value of the preset duration according to actual needs.
As shown in fig. 6A, a schematic diagram of the division of an audio frame into multiple units of audio segments is shown. Audio frame 600 may be divided into 3 audio segment units, audio segment unit 611, audio segment unit 612, and audio segment unit 613. Where the duration of audio segment unit 611, the duration of audio segment unit 612, and the duration of audio segment unit 613 are equal. The adjacent two audio segment units may be the audio segment unit 611 and the audio segment unit 612, and may also be the audio segment unit 612 and the audio segment unit 613. There are overlapping regions for two adjacent audio segment units, such as overlapping region 621 between audio segment unit 611 and audio segment unit 612, and overlapping region 622 between audio segment unit 612 and audio segment unit 613. The overlapping areas of two adjacent audio segment units are present for equal time periods, e.g., the overlapping area 621 is equal in time period to the overlapping area 622.
S303: and the electronic equipment adjusts the duration of the overlapping area according to the target playing speed configured by the user.
As described above with respect to fig. 5A-5E, the user can configure the target playback speed via the throttle control 420 in the recording preview interface. In some embodiments, the electronic device triggers a pacing request during audio recording by the user via the pacing control 420. For example, the user may configure the target play speed through the pacing control 420, and trigger a pacing request including the target play speed configured by the user. After receiving the speed regulation request, the electronic device may adjust the duration of the overlap area by using the target play speed configured by the user according to the speed regulation request.
In other embodiments, the user may also configure the target play speed by physical keys on the electronic device. For example, the user configures the target playback speed by long-pressing the "volume + key" or the "volume-key".
In some embodiments, the electronic device may compare the target playback speed configured by the user with a preset playback speed to determine a manner of adjusting the overlap region. The preset playing speed refers to the current audio recording speed. By way of example, example 1: the current time is 5 th second and 0-3 th second, the audio recording speed is 1 time speed, the user configures the audio recording speed to be 0.5 time speed in the 3 rd second, and the preset playing speed is 0.5 time speed; example 2: the current time is 5 th second and 0-3 th second, the audio recording speed is 1 time speed, the user configures the audio recording speed to be 0.5 time speed in the 3 rd second, the user configures the audio recording speed to be 1 time speed in the 4 th second, and the preset playing speed is 1 time speed.
Specifically, when the target play speed configured by the user is greater than the preset play speed, the electronic device lengthens the duration of the overlapping area. As shown in fig. 6B, fig. 6B is a schematic diagram illustrating an electronic device for lengthening the duration of the overlapping area. And when the target playing speed configured by the user is less than the preset playing speed, the electronic equipment shortens the duration of the overlapping area. As shown in fig. 6C, fig. 6C is a schematic diagram illustrating an electronic device adjusting a time duration of an overlapping area.
Taking the example that the target playing speed configured by the user is greater than the preset playing speed, that is, the user wants the audio file to play the sound recorded by the audio file at a faster playing speed. In some examples, the audio frame 600 has a duration of 40ms, the number of audio segment units is 3, the duration of each audio segment unit is 15ms, and the duration of each overlap region is 2.5 ms. The electronic device may adjust the duration of the overlap region to 5ms based on the target play speed configured by the user, so that the duration of the audio frame 600 becomes 35ms, and the duration of the visible audio frame 600 becomes shorter. That is to say, when the player plays the audio frame 600, the player can complete the playing of the audio frame 600 in a shorter time, thereby reducing the time required for completing the playing of the audio frame 600 and improving the playing speed of the sound recorded in the audio frame 600.
It should be noted that, the embodiment of the present application is only described as an example of dividing an audio frame into 3 audio segment units, and in practical applications, the audio frame may be divided into 100, 200, or more audio segment units.
When the target play speed configured by the user is lower than the preset play speed, the process of adjusting the overlap area by the electronic device is similar to the adjustment process described above when the target play speed configured by the user is higher than the preset play speed, and details are not repeated here.
In some embodiments, the electronic device may directly calculate the post-processing duration of the overlap region according to the target play speed configured by the user. Specifically, the electronic device adjusts the duration of the overlap region to be the processed duration according to the target playing speed, the duration of the overlap region, the number of the plurality of audio segment units, and the duration of any one of the plurality of audio segment units. The target playing speed is a parameter configured by a user, the duration of the overlapping region is a preset duration, the number of the plurality of audio segment units and the duration of any one of the plurality of audio segment units, and the target playing speed is a known parameter for the electronic equipment. Based on this, the electronic apparatus can calculate the post-processing time length of the overlap area by the following formula (1):
Figure BDA0003208591710000111
wherein, txA post-processing duration for the overlap region; v is a target play speed configured by the user, for example, when the target play speed configured by the user is 0.5 speed, v is 0.5, and when the target play speed configured by the user is 1.5 speed, v is 1.5; t is t0The time length of the overlapping area is the preset time length; n is the number of a plurality of audio segment units; and T is the time duration of any one of the plurality of audio segment units.
S304: and the electronic equipment obtains the processed audio frame according to the adjusted overlapping area and the plurality of audio segment units.
As shown in fig. 6B or 6C, the adjusted overlapping area includes an overlapping area 621 and an overlapping area 622. In some examples, the electronic device may perform overlap processing on the multiple units of audio segments based on the overlap regions 621 and 622, resulting in a processed audio frame, which may be the audio frame shown in fig. 6B or 6C.
In some possible implementations, after the electronic device performs the overlap processing on the overlap area 621, the electronic device may increase the loudness of the sound recorded in the overlap area 621, and the electronic device may multiply the overlap area 621 by an attenuation coefficient to reduce the influence of the overlap on the loudness of the sound. Similarly, the electronic device may also perform similar processing for overlap region 622. In some examples, the electronic device may also multiply an attenuation coefficient for the processed audio frame as a whole, thereby reducing the influence of the superposition on the loudness of the sound and further improving the user experience.
S305: and the electronic equipment encodes the processed audio frame to obtain an audio file.
After the electronic device obtains the processed audio frame, the processed audio frame can be sent to an audio encoder, and then an encoding result output by the audio encoder is encapsulated to obtain an audio file.
In some embodiments, the electronic device may obtain the processed time stamp of the processed audio frame according to the target playback speed. In some possible implementations, the electronic device may obtain the number of processed sampling points based on the target playing speed and the number of sampling points of the microphone, obtain a time interval between the processed audio frame and a previous audio frame of the processed audio frame according to the number of processed sampling points, the number of channels, the sampling rate, and the number of bytes of the sampling points, and add the time interval to a processed timestamp of the previous audio frame of the processed audio frame to obtain a processed timestamp of the processed audio frame. Specifically, the electronic device may calculate the post-processing timestamp of the post-processing audio frame by equation (2) as follows:
Figure BDA0003208591710000121
wherein,
Figure BDA0003208591710000122
a processed timestamp for the nth processed audio frame; siThe number of processed sampling points of the ith audio frame (or the processed audio frame); c is the number of channels (channel number), e.g., C ═ 2; r is the sample rate (sample rate), which may be 44.1kHz, for example, meaning 44.1k samples per second; b is the byte per sample (byte per sample), for example, B is 2.
It should be noted that pts (presentation Time stamp) is a display Time stamp, and the display Time stamp is used to instruct the player to play the video frame data or the audio frame data corresponding to the display Time stamp at the Time corresponding to the display Time stamp.
To calculate
Figure BDA0003208591710000123
For the purpose of example only,
Figure BDA0003208591710000124
wherein,
Figure BDA0003208591710000125
the time interval between the 2 nd audio frame and the 1 st audio frame,
Figure BDA0003208591710000126
the time interval between the 3 rd audio frame and the 2 nd audio frame.
In some possible implementations, the electronic device obtains the number of processed sample points based on the target playback speed and the number of sample points of the microphone. For example, when the target playing speed is 2 times, the electronic device takes the ratio of the sampling point number of the microphone to 2 as the processed sampling point number, that is, the processed sampling point number is one half of the sampling point number of the microphone. For example, when the target playing speed is 0.5 times, the electronic device uses the ratio of the sampling point number of the microphone to 0.5 as the sampling point number after processing, that is, the sampling point number after processing is twice as large as the sampling point number of the microphone.
The electronic device may then calculate the processed time stamp of the processed audio frame according to the formula (2), and encode the processed audio frame according to the processed time stamp of the processed audio frame, thereby obtaining the audio file. In some examples, the electronic device may send the processed time stamp of the processed audio frame and the processed audio frame to an audio encoder, the audio encoder outputs the output encoding result to a wrapper, and the wrapper encapsulates the encoding result to obtain the audio file.
Based on the above description, the embodiments of the present application provide an audio recording method. The method supports the user to set the playing speed of the recorded audio file in the audio recording process. Therefore, after the electronic equipment records the audio file, the playing speed of the audio file is the audio file meeting the requirements of the user, further processing such as clipping by the user is not needed, the user operation is simplified, and the processing efficiency is improved.
And the method adjusts the audio frame in a time domain overlapping mode. Specifically, the method further divides the audio frame into a plurality of audio segment units with equal time length, an overlapping area exists between two adjacent audio segment units in the plurality of audio segment units, and the time length of the overlapping area is adjusted through a target playing speed configured by a user, so that the purpose of adjusting the time length of the audio frame is achieved. The method does not need to compress the audio frame, further does not compress the frequency of the sound recorded in the original audio frame, and further does not change the tone of the sound in the original audio frame. Therefore, the method can achieve the effect of changing speed without changing tone, and further improve the user experience.
The audio recording method provided by the embodiment of the application can be combined with video recording, so that the playing speed of the video file obtained by real-time adjustment and recording in the video recording process of the electronic equipment is realized. The above embodiment describes the processing method of audio frames, and the following describes the processing method of video frames.
In some possible implementations, the electronic device may change the video frame to achieve a variable speed effect by means of frame extraction or pin insertion based on a target play speed configured by a user. In some examples, the electronic device may adjust a recording frame rate of the camera based on a user-configured target play speed.
When the target play speed configured by the user is greater than the preset play speed, the electronic device can turn down the recording frame rate of the camera. For example, the target playing speed configured by the user is 2 times speed, the recording frame rate of the camera is 30fps, and the recording frame rate of the camera may be the frame rate of the video file obtained by recording, which is set by the user in advance. The electronic device may adjust the recording frame rate to 15fps, that is, reduce the number of video frames reported by the camera in a unit time (e.g., 1 second). The electronic device can modify the timestamp of the 15 frames of video frames collected within 1 second, and encode the 15 frames of video frames according to the processed timestamp of the 15 frames of video frames, so that the 15 frames of video frames are displayed within 0.5 second, and the effect of increasing the picture playing speed is achieved.
In some possible implementation manners, when the target play speed configured by the user is greater than the preset play speed, the electronic device may also discard, that is, extract, a part of the obtained video frames in the plurality of video frames without adjusting the recording frame rate of the camera. For example, the target playing speed configured by the user is 2 times speed, the recording frame rate of the camera is 30fps, and the recording frame rate of the camera may be the frame rate of the video file obtained by recording, which is set by the user in advance. When the recording frame rate is 30fps, the electronic device can acquire 30 video frames in unit time, and the electronic device can discard the video frames at intervals. As shown in fig. 7, the video frame corresponding to the dotted line is a video frame discarded by the electronic device. The electronic device can modify the timestamps of the remaining 15 frames of video frames and encode the 15 frames of video frames according to the processed timestamps of the 15 frames of video frames, so that the 15 frames of video frames are displayed within 0.5 second, and the effect of increasing the picture playing speed is achieved.
When the target play speed configured by the user is less than the preset play speed, the electronic device may increase the recording frame rate of the camera. For example, the target playing speed configured by the user is 0.5 times, the recording frame rate of the camera is 30fps, and the recording frame rate of the camera may be the frame rate of the video file obtained by recording, which is preset by the user. The electronic device may adjust the recording frame rate to 60fps, that is, increase the number of video frames reported by the camera in a unit time (e.g., 1 second). The electronic device can modify the timestamp of the 60 frames of video frames collected within 1 second, and encode the 60 frames of video frames according to the processed timestamp of the 60 frames of video frames, so that the 60 frames of video frames are distributed and displayed within 2 seconds, and the effect of reducing the picture playing speed is achieved.
In some embodiments, the electronic device may obtain the processed timestamp of the video frame according to the target play speed. In some examples, the electronic device obtains a time interval between a processed timestamp of a video frame and a processed timestamp of a previous video frame of the video frame based on the target play speed, an original timestamp of the video frame, and an original timestamp of the previous video frame of the video frame; and the electronic equipment obtains the processed time stamp of the video frame according to the time interval and the processed time stamp of the previous video frame of the video frame. Specifically, the electronic device may calculate the post-processing timestamp of the video frame by equation (3) as follows:
Figure BDA0003208591710000141
wherein,
Figure BDA0003208591710000142
a processed timestamp for the nth video frame; t isiThe original time stamp of the ith video frame; t isi-1The original time stamp of the ith-1 video frame is taken as the ith-1 video frame, and the ith-1 video frame is the previous video frame of the ith video frame; t isPiThe speed is a target playing speed configured by the user, for example, in the case of 0.5 times speed, the target playing speed may be 0.5, and in the case of 2 times speed, the target playing speed may be 2.
To calculate
Figure BDA0003208591710000143
For the purpose of example only,
Figure BDA0003208591710000144
wherein,
Figure BDA0003208591710000145
the time interval between the 2 nd audio frame and the 1 st audio frame,
Figure BDA0003208591710000146
the time interval between the 3 rd audio frame and the 2 nd audio frame.
Then, the electronic device can calculate the processed timestamp of the video frame through the formula (3), encode the video frame according to the processed timestamp of the video frame, further obtain an encoding result of the video frame, and send the encoding result of the video frame and the encoding result of the processed audio frame to an encapsulator for encapsulation, further obtain a video file.
Based on the above description, the audio recording method provided by the embodiment of the present application can also be applied to a video recording scene. Therefore, the user can adjust the playing speed of the recorded video file in real time in the video recording process, so that the adjustment of the playing effect of the video file can be realized without secondary editing of the user, the user operation is simplified, the user time is saved, and the creation requirement of the user is met.
An embodiment of the present application further provides an electronic device, as shown in fig. 8, the electronic device may include: a microphone 811, one or more processors 820, memory 830, one or more computer programs 840, which may be connected via one or more communication buses 850. Wherein the one or more computer programs 840 are stored in the memory 830 and configured to be executed by the one or more processors 820, the one or more computer programs 840 comprising instructions that may be used to perform the steps as performed by the cell phone in the respective embodiment of fig. 3. The microphone 811 may be a built-in microphone of the electronic device or a microphone to which the electronic device is connected. In other examples, the electronic device may also include a camera 812. The microphone 811 and the camera 812 are optional, and the electronic device may receive audio frames or video frames transmitted by other devices.
In the embodiment of the present application, the electronic device may be divided into the functional modules according to the method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
In the case of the respective functional modules divided with respect to the respective functions, fig. 9 shows a possible schematic view of the electronic device referred to above and in the embodiments, which electronic device performs the steps in any of the method embodiments of the present application. As shown in fig. 9, the electronic apparatus includes: an obtaining unit 901 configured to obtain an audio frame; a splitting unit 902, configured to split the audio frame into multiple audio segment units with equal duration; overlapping regions exist between two adjacent audio segment units in the plurality of audio segment units; an adjusting unit 903, configured to adjust a duration of the overlapping area according to a target play speed configured by a user; a synthesizing unit 904, configured to obtain a processed audio frame according to the adjusted overlapping region and the multiple audio segment units; an encoding unit 905, configured to obtain a processed timestamp of the processed audio frame according to the target play speed; and coding the processed audio frame according to the processed time stamp of the processed audio frame to obtain an audio file.
In some possible implementation manners, the adjusting unit 903 is specifically configured to, when a target play speed configured by a user is greater than a preset play speed, increase a duration of the overlap area; and when the target playing speed configured by the user is less than the preset playing speed, shortening the duration of the overlapping area.
In some possible implementations, the adjusting unit 903 is specifically configured to adjust the duration of the overlapping region to be the processed duration according to a target play speed configured by a user, the duration of the overlapping region, the number of the multiple audio segment units, and the duration of any one of the multiple audio segment units.
In some possible implementation manners, the encoding unit 905 is specifically configured to obtain the number of processed sampling points according to the target playing speed and the preset number of sampling points of the microphone; acquiring the time interval between the processed audio frame and the audio frame before the processed audio frame according to the number of the processed sampling points, the number of channels, the sampling rate and the number of bytes of the sampling points; and adding the time interval and the processed time stamp of the previous audio frame of the processed audio frame to obtain the processed time stamp of the processed audio frame.
In some possible implementations, the obtaining unit 901 is specifically configured to obtain a recording request, where the recording request includes a target play speed configured by a user; and acquiring the audio frame according to the recording request.
In some possible implementations, the adjusting unit 903 is specifically configured to obtain a speed regulation request, where the speed regulation request includes a target play speed configured by a user; and adjusting the duration of the overlapping area by using the target playing speed configured by the user according to the speed regulation request.
It should be noted that all relevant contents of each step related to the above method embodiment may be cited to the electronic device, so that the electronic device executes the corresponding method, which is not described herein again.
The electronic device provided by the embodiment of the application can be used for executing the method of any embodiment, so that the same effect as the method of the embodiment can be achieved.
The present embodiment also provides a computer-readable storage medium, which includes instructions, when the instructions are executed on an electronic device, cause the electronic device to execute the relevant method steps in fig. 3, so as to implement the method in the foregoing embodiment.
The present embodiment also provides a computer program product containing instructions, which when run on an electronic device, causes the electronic device to perform the relevant method steps as in fig. 3, to implement the method in the above-described embodiment.
In the several embodiments provided in the present embodiment, it should be understood that the disclosed electronic device and method may be implemented in other manners. For example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, each functional unit in the embodiments of the present embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present embodiment essentially or partially contributes to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute all or part of the steps of the method described in the embodiments. And the aforementioned storage medium includes: flash memory, removable hard drive, read only memory, random access memory, magnetic or optical disk, and the like.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An audio recording method applied to an electronic device, the method comprising:
the electronic equipment acquires an audio frame;
the electronic equipment divides the audio frame into a plurality of audio segment units with equal time length; overlapping regions exist between two adjacent audio segment units in the plurality of audio segment units;
the electronic equipment adjusts the duration of the overlapping area according to a target playing speed configured by a user;
the electronic equipment obtains a processed audio frame according to the adjusted overlapping area and the plurality of audio segment units;
the electronic equipment acquires a processed time stamp of the processed audio frame according to the target playing speed;
and the electronic equipment encodes the processed audio frame according to the processed time stamp of the processed audio frame to obtain an audio file.
2. The method of claim 1, wherein the electronic device adjusts the duration of the overlap region according to a target play speed configured by a user, comprising:
when the target playing speed configured by the user is greater than the preset playing speed, the electronic equipment lengthens the duration of the overlapping area;
and when the target playing speed configured by the user is less than the preset playing speed, the electronic equipment shortens the duration of the overlapping area.
3. The method of claim 1, wherein the electronic device adjusts the duration of the overlap region according to a target play speed configured by a user, comprising:
and the electronic equipment adjusts the time length of the overlapping area into the processed time length according to the target playing speed configured by the user, the time length of the overlapping area, the number of the plurality of audio segment units and the time length of any one of the plurality of audio segment units.
4. The method according to any of claims 1-3, wherein the electronic device obtains the processed time stamp of the processed audio frame according to the target playback speed, comprising:
the electronic equipment acquires the number of processed sampling points according to the target playing speed and the preset number of sampling points of the microphone;
the electronic equipment acquires the time interval between the processed audio frame and the previous audio frame of the processed audio frame according to the number of the processed sampling points, the number of channels, the sampling rate and the number of bytes of sampling points;
and the electronic equipment adds the time interval and the processed time stamp of the previous audio frame of the processed audio frame to obtain the processed time stamp of the processed audio frame.
5. The method of any of claims 1-4, wherein the electronic device obtaining audio frames comprises:
the electronic equipment acquires a recording request, wherein the recording request comprises a target playing speed configured by a user;
and the electronic equipment acquires the audio frame according to the recording request.
6. The method according to any one of claims 1-4, wherein the electronic device adjusts the duration of the overlap region according to a target play speed configured by a user, comprising:
the electronic equipment acquires a speed regulation request, wherein the speed regulation request comprises a target playing speed configured by a user;
and the electronic equipment adjusts the duration of the overlapping area by using the target playing speed configured by the user according to the speed regulation request.
7. An electronic device, comprising:
an acquisition unit configured to acquire an audio frame;
the splitting unit is used for splitting the audio frame into a plurality of audio segment units with equal time duration; overlapping regions exist between two adjacent audio segment units in the plurality of audio segment units;
the adjusting unit is used for adjusting the duration of the overlapping area according to a target playing speed configured by a user;
a synthesizing unit, configured to obtain a processed audio frame according to the adjusted overlap region and the multiple audio segment units;
the coding unit is used for acquiring the processed time stamp of the processed audio frame according to the target playing speed; and coding the processed audio frame according to the processed time stamp of the processed audio frame to obtain an audio file.
8. An electronic device, comprising: a processor and a memory;
wherein one or more computer programs are stored in the memory, the one or more computer programs comprising instructions; the instructions, when executed by the processor, cause the electronic device to perform the audio recording method of any of claims 1-6.
9. A computer storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the audio recording method of any of claims 1-6.
10. A computer program product, characterized in that when the computer program product is run on a computer, the computer performs the audio recording method according to any of claims 1-6.
CN202110924280.5A 2021-08-12 2021-08-12 Audio recording method, electronic equipment, medium and program product Active CN113643728B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110924280.5A CN113643728B (en) 2021-08-12 2021-08-12 Audio recording method, electronic equipment, medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110924280.5A CN113643728B (en) 2021-08-12 2021-08-12 Audio recording method, electronic equipment, medium and program product

Publications (2)

Publication Number Publication Date
CN113643728A true CN113643728A (en) 2021-11-12
CN113643728B CN113643728B (en) 2023-08-22

Family

ID=78421130

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110924280.5A Active CN113643728B (en) 2021-08-12 2021-08-12 Audio recording method, electronic equipment, medium and program product

Country Status (1)

Country Link
CN (1) CN113643728B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114339443A (en) * 2021-11-17 2022-04-12 腾讯科技(深圳)有限公司 Audio and video double-speed playing method and device
CN114827657A (en) * 2022-04-28 2022-07-29 腾讯音乐娱乐科技(深圳)有限公司 Audio splicing method, equipment and storage medium
CN115497487A (en) * 2022-09-09 2022-12-20 维沃移动通信有限公司 Audio signal processing method and device, electronic equipment and readable storage medium
CN116052701A (en) * 2022-07-07 2023-05-02 荣耀终端有限公司 Audio processing method and electronic equipment
CN116074566A (en) * 2023-01-13 2023-05-05 深圳市名动天下网络科技有限公司 Game video highlight recording method, device, equipment and storage medium
CN117560514A (en) * 2024-01-11 2024-02-13 北京庭宇科技有限公司 WebRTC-based method for reducing audio and video delay

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004030908A (en) * 1997-11-28 2004-01-29 Victor Co Of Japan Ltd Audio disk and decoding device of audio signal
JP2005266571A (en) * 2004-03-19 2005-09-29 Sony Corp Method and device for variable-speed reproduction, and program
CN1902697A (en) * 2003-11-11 2007-01-24 科斯莫坦股份有限公司 Time-scale modification method for digital audio signal and digital audio/video signal, and variable speed reproducing method of digital television signal by using the same method
CN101150506A (en) * 2007-08-24 2008-03-26 华为技术有限公司 Content acquisition method, device and content transmission system
US20080162151A1 (en) * 2006-12-28 2008-07-03 Samsung Electronics Co., Ltd Method and apparatus to vary audio playback speed
CN103258552A (en) * 2012-02-20 2013-08-21 扬智科技股份有限公司 Method for adjusting play speed
CN104660948A (en) * 2015-03-09 2015-05-27 深圳市欧珀通信软件有限公司 Video recording method and device
CN106373590A (en) * 2016-08-29 2017-02-01 湖南理工学院 Sound speed-changing control system and method based on real-time speech time-scale modification
CN109360588A (en) * 2018-09-11 2019-02-19 广州荔支网络技术有限公司 A kind of mobile device-based audio-frequency processing method and device
CN110074759A (en) * 2019-04-23 2019-08-02 平安科技(深圳)有限公司 Voice data aided diagnosis method, device, computer equipment and storage medium
CN110459233A (en) * 2019-03-19 2019-11-15 深圳壹秘科技有限公司 Processing method, device and the computer readable storage medium of voice
CN110572722A (en) * 2019-09-26 2019-12-13 腾讯科技(深圳)有限公司 Video clipping method, device, equipment and readable storage medium
CN111176748A (en) * 2015-05-08 2020-05-19 华为技术有限公司 Configuration method of setting information, terminal and server
CN111402900A (en) * 2018-12-29 2020-07-10 华为技术有限公司 Voice interaction method, device and system
WO2020172826A1 (en) * 2019-02-27 2020-09-03 华为技术有限公司 Video processing method and mobile device
WO2020192461A1 (en) * 2019-03-25 2020-10-01 华为技术有限公司 Recording method for time-lapse photography, and electronic device
WO2021052414A1 (en) * 2019-09-19 2021-03-25 华为技术有限公司 Slow-motion video filming method and electronic device

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004030908A (en) * 1997-11-28 2004-01-29 Victor Co Of Japan Ltd Audio disk and decoding device of audio signal
CN1902697A (en) * 2003-11-11 2007-01-24 科斯莫坦股份有限公司 Time-scale modification method for digital audio signal and digital audio/video signal, and variable speed reproducing method of digital television signal by using the same method
JP2005266571A (en) * 2004-03-19 2005-09-29 Sony Corp Method and device for variable-speed reproduction, and program
US20080162151A1 (en) * 2006-12-28 2008-07-03 Samsung Electronics Co., Ltd Method and apparatus to vary audio playback speed
CN101150506A (en) * 2007-08-24 2008-03-26 华为技术有限公司 Content acquisition method, device and content transmission system
CN103258552A (en) * 2012-02-20 2013-08-21 扬智科技股份有限公司 Method for adjusting play speed
CN104660948A (en) * 2015-03-09 2015-05-27 深圳市欧珀通信软件有限公司 Video recording method and device
CN111176748A (en) * 2015-05-08 2020-05-19 华为技术有限公司 Configuration method of setting information, terminal and server
CN106373590A (en) * 2016-08-29 2017-02-01 湖南理工学院 Sound speed-changing control system and method based on real-time speech time-scale modification
CN109360588A (en) * 2018-09-11 2019-02-19 广州荔支网络技术有限公司 A kind of mobile device-based audio-frequency processing method and device
CN111402900A (en) * 2018-12-29 2020-07-10 华为技术有限公司 Voice interaction method, device and system
WO2020172826A1 (en) * 2019-02-27 2020-09-03 华为技术有限公司 Video processing method and mobile device
CN110459233A (en) * 2019-03-19 2019-11-15 深圳壹秘科技有限公司 Processing method, device and the computer readable storage medium of voice
WO2020192461A1 (en) * 2019-03-25 2020-10-01 华为技术有限公司 Recording method for time-lapse photography, and electronic device
CN110074759A (en) * 2019-04-23 2019-08-02 平安科技(深圳)有限公司 Voice data aided diagnosis method, device, computer equipment and storage medium
WO2021052414A1 (en) * 2019-09-19 2021-03-25 华为技术有限公司 Slow-motion video filming method and electronic device
CN110572722A (en) * 2019-09-26 2019-12-13 腾讯科技(深圳)有限公司 Video clipping method, device, equipment and readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
汪石农: "《改进相位声码器的音频时长变换算法研究》", 《计算机工程与应用》 *
汪石农: "《改进相位声码器的音频时长变换算法研究》", 《计算机工程与应用》, 21 December 2012 (2012-12-21) *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114339443A (en) * 2021-11-17 2022-04-12 腾讯科技(深圳)有限公司 Audio and video double-speed playing method and device
CN114339443B (en) * 2021-11-17 2024-03-19 腾讯科技(深圳)有限公司 Audio and video double-speed playing method and device
CN114827657A (en) * 2022-04-28 2022-07-29 腾讯音乐娱乐科技(深圳)有限公司 Audio splicing method, equipment and storage medium
CN116052701A (en) * 2022-07-07 2023-05-02 荣耀终端有限公司 Audio processing method and electronic equipment
CN116052701B (en) * 2022-07-07 2023-10-20 荣耀终端有限公司 Audio processing method and electronic equipment
CN115497487A (en) * 2022-09-09 2022-12-20 维沃移动通信有限公司 Audio signal processing method and device, electronic equipment and readable storage medium
CN116074566A (en) * 2023-01-13 2023-05-05 深圳市名动天下网络科技有限公司 Game video highlight recording method, device, equipment and storage medium
CN116074566B (en) * 2023-01-13 2023-10-20 深圳市名动天下网络科技有限公司 Game video highlight recording method, device, equipment and storage medium
CN117560514A (en) * 2024-01-11 2024-02-13 北京庭宇科技有限公司 WebRTC-based method for reducing audio and video delay

Also Published As

Publication number Publication date
CN113643728B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
CN113643728B (en) Audio recording method, electronic equipment, medium and program product
CN110109636B (en) Screen projection method, electronic device and system
CN115145529B (en) Voice control device method and electronic device
CN113572954A (en) Video recording method, electronic device, medium, and program product
CN113365012A (en) Audio processing method and device
US20220272200A1 (en) Audio processing method and electronic device
CN114710640A (en) Video call method, device and terminal based on virtual image
EP4138381A1 (en) Method and device for video playback
CN113810589A (en) Electronic device, video shooting method and medium thereof
CN115048012A (en) Data processing method and related device
CN117133306B (en) Stereo noise reduction method, apparatus and storage medium
CN112383664A (en) Equipment control method, first terminal equipment and second terminal equipment
CN114185503A (en) Multi-screen interaction system, method, device and medium
CN113593567B (en) Method for converting video and sound into text and related equipment
CN114422935B (en) Audio processing method, terminal and computer readable storage medium
CN113971969B (en) Recording method, device, terminal, medium and product
CN113573119B (en) Method and device for generating time stamp of multimedia data
CN112269554B (en) Display system and display method
CN112507161A (en) Music playing method and device
CN114915834A (en) Screen projection method and electronic equipment
CN114915722B (en) Method and device for processing video
CN115904184A (en) Data processing method and related device
CN115730091A (en) Comment display method and device, terminal device and readable storage medium
CN115185441A (en) Control method, control device, electronic equipment and readable storage medium
CN114827098A (en) Method and device for close shooting, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant