WO2014190830A1 - Sound recording synchronization method, apparatus, and device - Google Patents

Sound recording synchronization method, apparatus, and device Download PDF

Info

Publication number
WO2014190830A1
WO2014190830A1 PCT/CN2014/076199 CN2014076199W WO2014190830A1 WO 2014190830 A1 WO2014190830 A1 WO 2014190830A1 CN 2014076199 W CN2014076199 W CN 2014076199W WO 2014190830 A1 WO2014190830 A1 WO 2014190830A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
file
read
audio file
audio
Prior art date
Application number
PCT/CN2014/076199
Other languages
French (fr)
Chinese (zh)
Inventor
刘新宇
韩伟
康上明学
Original Assignee
小米科技有限责任公司
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 小米科技有限责任公司 filed Critical 小米科技有限责任公司
Publication of WO2014190830A1 publication Critical patent/WO2014190830A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/233Processing of audio elementary streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/8106Monomedia components thereof involving special audio data, e.g. different tracks for different languages

Definitions

  • the present disclosure relates to the field of terminal devices, and in particular, to a recording synchronization method, apparatus, and device. Background technique
  • the security protection of user data is the development trend of mobile phone software nowadays, and more and more software will consider protecting user data. This protection usually uploads a complete file to the server and can be downloaded from the server to the original file when the local data file is lost or logged into the account platform.
  • the recording software is a very important audio recording software for journalists or some special persons, for example, to perform audio forensics on an important and sensitive event
  • the recording software During the recording process, some unexpected events were forced to delete the acquired audio files. Therefore, the ordinary synchronous backup method cannot upload the files to the server, and the data recovery work cannot be completed, that is, the data has not been uploaded yet. Files cannot be recovered after they are lost, making the security of recording and the stability of audio files relatively poor.
  • the embodiment of the present disclosure provides a recording synchronization method, apparatus, and device.
  • the technical solution is as follows:
  • a recording synchronization method comprising:
  • the data read each time is uploaded to the server, so that the server synchronizes according to the received data.
  • Read data from the audio file being written including:
  • each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
  • the method further includes:
  • Reading data from the audio file being written includes:
  • a recording synchronization apparatus comprising:
  • An audio data stream obtaining module configured to acquire an audio data stream during recording
  • a writing module configured to encode the obtained audio data stream according to a preset encoding format, and write the encoded data into the audio file;
  • a data reading module configured to read data from an audio file being written
  • the uploading module is configured to upload each read data to the server, so that the server synchronizes according to the received data.
  • the data reading module is configured to update the read position of the file according to the position of the last read data in the audio file; and the updated read position in the audio file being written The starting point of the second reading, continue to read the data.
  • the uploading module is configured to send an upload request to the server when the recording starts, so that the server allocates a file identifier to the audio file; and uploads the data read each time to the server according to the file identifier allocated by the server.
  • the saved file identifies the end of the file of the corresponding audio file.
  • the uploading module is further configured to end data uploading when the end of the file of the audio file is read and it is determined that the recording is stopped.
  • the data reading module is configured to divide the audio file being written into a plurality of file segments, and separately read the plurality of file segments.
  • a terminal device including a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be one or more
  • the processor executes one or more programs that include instructions for performing the following operations:
  • the data read each time is uploaded to the server, so that the server synchronizes according to the received data.
  • FIG. 1 is a flowchart of a recording synchronization method according to an exemplary embodiment
  • FIG. 2 is a flowchart of a recording synchronization method according to an exemplary embodiment
  • FIG. 3 is a schematic structural diagram of a recording synchronization apparatus according to an exemplary embodiment
  • FIG. 4 is a schematic structural diagram of a terminal device according to an exemplary embodiment. detailed description
  • FIG. 1 is a flowchart of a recording synchronization method according to an embodiment of the present disclosure. Referring to FIG. 1, the method includes: 101. Acquire an audio data stream during recording;
  • the preset encoding format is an encoding format that is encoded according to a frame.
  • the recording files can be synchronized in real time, that is, in the process of recording, using the accompanying record Back up the files with the upload method, so that even if you have to delete the files that have already been stored in case of unforeseen circumstances, you can restore the deleted files on the user platform to maximize the security of the files.
  • Real-time recording synchronization is achieved by uploading data in an audio file while recording an audio file. That is to be able to achieve the effect of the accompanying upload and upload, and also enable the recording of the recorded content to be maximized according to the synchronization already performed on the server when the recording is not ended unexpectedly or accidentally deleted, and the audio file is protected. Security, improve the stability of audio files, and achieve data recovery.
  • the data is read from the audio file being written, including:
  • each time the data read is uploaded to the server including:
  • each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
  • the method further includes:
  • reading data from the audio file being written comprises:
  • FIG. 2 is a flowchart of a method for recording synchronization provided by an embodiment of the present disclosure. Referring to FIG. 2, the embodiment specifically includes:
  • the terminal device starts the recording function, and performs steps 201 and 204 respectively;
  • the terminal device When the recording function is started, the terminal device performs recording initialization, and starts collecting sound through the microphone to obtain an audio data stream. At this time, an upload request is sent to the server for the data synchronization service, and the upload request is used to request real-time uploading of the currently recorded An audio file, and requesting the server to assign a file identifier to the audio file being recorded.
  • the terminal device acquires an audio data stream.
  • the obtained audio data stream is encoded according to a preset encoding format, and the terminal device writes the encoded data into an audio file.
  • the terminal device each time the audio data stream is acquired, the terminal device performs MP3 format encoding on the acquired audio data stream, and writes the encoded generated data into the audio file.
  • the audio data stream is encoded in the MP3 format, and the collected PCM data is encoded into an MP3 format audio file for storage, and the process is repeated to continuously convert the external audio information. Into a continuous MP3 audio file.
  • the terminal device supplements the file end of the obtained audio file, and outputs the supplemented The audio file ends.
  • the encoding process of the MP3 format is a process of continuously acquiring an audio data stream and continuously encoding, and continuously repeating the process to convert the external audio information into an MP3 audio file including continuous frames.
  • the MP3 storage format has high audio compression rate and low distortion, the MP3 encoding format can greatly facilitate the user's storage and use of audio.
  • the encoding is performed one frame at a time, so during the audio recording process, even if the recording pauses, the previously saved frame is not lost, and the device will not be powered down due to pause or interruption of the recording. If you lose the previously saved frame, it has higher stability than recording in formats such as amr or 3gpp.
  • the terminal device sends an upload request to the server.
  • the uploading process is started.
  • the user is prompted to open the network connection for recording synchronization, and when the user is detected to open the network connection, the uploading process is started.
  • the upload request is used to request that the currently recorded audio file be uploaded in real time, and the server is requested to assign a file identifier to the audio file being recorded.
  • the server assigns a file identifier to the audio file of this recording according to the upload request of the terminal device.
  • the server when receiving the uploading request of the terminal device, may randomly assign a file identifier to the audio file of the recording, and the file identifier is used by the terminal device to carry the data when uploading, so that the server identifies the file according to the file. Correspondly save the received data.
  • the terminal device After the terminal device obtains the file identifier allocated by the server, set the zero byte position of the file to the file read position.
  • the file read position is used to identify the location of the data that the current audio file has read and uploaded in the audio file.
  • the file read position can be initially set, that is, the zero byte position of the audio file is set to the file read position.
  • the terminal device reads the data from the audio file being written by using the file read position as the starting point of the current reading;
  • the size of the data that is read each time may be a preset value, which may be set by the technician at the time of development, and may be adjusted by the user according to the requirement, which is not limited by the embodiment of the disclosure.
  • the terminal device uploads, according to the file identifier allocated by the server, the data read each time to the end of the file of the audio file corresponding to the file identifier saved by the server;
  • the uploaded data carries the file identifier allocated by the server.
  • the server receives the data carrying the file identifier, the file determines the audio file corresponding to the file identifier according to the file identifier, and the received audio file is received.
  • the data is saved to the end of the file of the audio file corresponding to the file identifier, which ensures the continuity of the audio data saved on the server side.
  • the terminal device updates the read position of the file according to the location of the last read data in the audio file.
  • the last data read is 1024 bytes of the audio file
  • 1024 bytes are updated to the file read position, and at the time of this reading, the 1024 byte position is used for the current reading.
  • the data after 1024 bytes in the audio file is read.
  • the terminal device determines whether the currently updated read position is the end of the file of the audio file, and if yes, step 210 is performed; if not, step 206 is performed according to the updated file read position.
  • the read position of the current file is read before each reading.
  • Read the end of the file of the audio file to know if there is still data to upload.
  • the data upload can be ended.
  • the terminal device determines whether the currently updated read position is the end of the file of the audio file, and if so, it considers that the recording ends and ends the data upload, and if not, the recording is not yet finished.
  • the read position in the audio file being written is the starting point of the current reading, and the data is continuously read from the audio file being written.
  • the embodiment of the present disclosure is described by taking the data in the audio file and uploading the data as an example.
  • the audio file being written may also be divided into multiple a file segment, the plurality of file segments are separately read, since the encoding of the audio file is performed one frame at a time, the audio file may also be segmented during the data reading and uploading process.
  • Each file segment is a complete audio file.
  • the server sequentially saves multiple file segments, and can also complete the synchronization of the recording to achieve the recording. The purpose of real-time backup of audio files.
  • step 210 Determine whether the recording is stopped. If yes, end the data upload; if no, go to step 206. It should be noted that if the upload speed is faster than the recording speed, it may be uploaded to the end of the file, but the recording is still adding new recording content to the end of the file, so it is necessary to judge whether to judge the recording after the end of the file. Whether to stop, if the recording has stopped, end this upload task.
  • FIG. 3 is a schematic structural diagram of a recording synchronization apparatus according to an embodiment of the present disclosure.
  • the device includes: an audio data stream obtaining module 301, a writing module 302, a data reading module 303, and an uploading module 304.
  • the audio data stream obtaining module 301 is configured to obtain an audio data stream during the recording process; the audio data stream obtaining module 301 is linked with the writing module 302, and the writing module 302 is configured to perform the preset encoding on the acquired audio data stream.
  • Grid Encoding writing the encoded data into an audio file; the writing module 302 is linked with a data reading module 303, the data reading module 303 is configured to read data from the audio file being written; the data is read
  • the fetch module 303 is linked to the uploading module 304, and the uploading module 304 is configured to upload each read data to the server, so that the server synchronizes according to the received data.
  • the data reading module 303 is configured to update the read position of the file according to the position of the last read data in the audio file; and the updated in the audio file being written.
  • the read position is the starting point of this reading and continues to read data.
  • the uploading module 304 is configured to send an upload request to the server when the recording starts, so that the server allocates a file identifier for the audio file; and each read according to the file identifier allocated by the server The data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
  • the uploading module 304 is further configured to end the data upload when the end of the file of the audio file is read and it is determined that the recording is stopped.
  • the data reading module 303 is configured to divide the audio file being written into a plurality of file segments, and separately read the plurality of file segments.
  • the device provided by the embodiment of the present disclosure realizes real-time recording synchronization by uploading data in the audio file while recording the audio file, that is, the effect of uploading with the record can be achieved, and the recording can not be performed.
  • the recording content can be restored to the maximum extent according to the synchronization already performed on the server, the security of the audio file is protected, the stability of the audio file is improved, and the data recovery is achieved.
  • the recording synchronization device provided in the foregoing embodiment is only illustrated by the division of each functional module in the recording synchronization. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the recording synchronization device and the recording synchronization method are provided in the same embodiment. For details, refer to the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
  • FIG. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present disclosure.
  • the terminal device may be used to implement the recording synchronization method provided in the foregoing embodiment. Specifically:
  • the terminal device 400 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity,
  • the Wireless Fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like. It will be understood by those skilled in the art that the terminal device structure shown in Fig. 4 does not constitute a limitation of the terminal device, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements. among them:
  • the RF circuit 110 can be used for transmitting and receiving information or during a call, receiving and transmitting signals, in particular, After the downlink information is received, it is processed by one or more processors 180; in addition, data related to the uplink is transmitted to the base station.
  • the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc.
  • SIM Subscriber Identity Module
  • RF circuitry 110 can also communicate with the network and other devices via wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access). , Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • e-mail Short Messaging Service
  • the memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120.
  • the memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to The data created by the use of the terminal device 400 (such as audio data, phone book, etc.) and the like.
  • memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
  • Input unit 130 can be used to receive input numeric or character information, as well as to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • input unit 130 can include touch sensitive surface 131 as well as other input devices 132.
  • Touch-sensitive surface 131 also referred to as a touch display or trackpad, can collect touch operations on or near the user (eg, the user uses a finger, stylus, etc., on any touch-sensitive surface 131 or on the touch-sensitive surface 131 The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program.
  • the touch-sensitive surface 131 may include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information
  • the processor 180 is provided and can receive commands from the processor 180 and execute them.
  • the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 can also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 140 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal device 400, which can be composed of graphics, text, icons, video, and any combination thereof.
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
  • the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141.
  • touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
  • Terminal device 400 may also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the terminal device 400 moves to the ear. And / or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • gesture of the mobile phone such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the terminal device 400, other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., can be configured here. No longer.
  • the audio circuit 160, the speaker 161, and the microphone 162 provide an audio interface between the user and the terminal device 400.
  • the audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the terminal device, for example, by the RF circuit 110, or outputted to the memory 120 for further processing.
  • the audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the terminal device 400.
  • WiFi is a short-range wireless transmission technology
  • the terminal device 400 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 170, which provides users with wireless broadband Internet access.
  • FIG. 4 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the terminal device 400, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 180 is the control center of the terminal device 400, which connects various portions of the entire handset using various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120.
  • the various functions and processing data of the terminal device 400 are executed to perform overall monitoring of the mobile phone.
  • the processor 180 may include one or more processing cores.
  • the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 180.
  • the terminal device 400 further includes a power source 190 (such as a battery) for supplying power to the various components.
  • a power source 190 such as a battery
  • the power source can be logically connected to the processor 180 through the power management system to manage functions such as charging, discharging, and power management through the power management system.
  • Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the terminal device 400 may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the display unit of the terminal device is a touch screen display
  • the terminal device further includes a memory, and one or more programs, wherein one or more programs are stored in the memory, and are configured to be one or Executing one or more programs by one or more processors includes instructions for performing the following operations: during recording, acquiring an audio data stream;
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the memory of the terminal further includes an instruction for performing the following operations:
  • each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the audio file being written is divided into a plurality of file segments, and the plurality of file segments are separately read.
  • the terminal device provided by the embodiment of the present disclosure realizes real-time recording synchronization by uploading data in the audio file while recording the audio file, that is, the effect of uploading with the record can be achieved, and the recording can be made.
  • it When it is accidentally interrupted or accidentally deleted, it can restore the recording content to the maximum extent according to the synchronization already performed on the server, protect the security of the audio file, improve the stability of the audio file, and achieve the purpose of data recovery.

Abstract

Disclosed are a sound recording synchronization method, apparatus, and device, which belong to the field of terminal devices. The method comprises: acquiring an audio data stream in a sound recording process; performing encoding on the acquired audio data stream based on a preset encoding format, and writing data generated through encoding in an audio file; reading data from the audio file being written; and uploading data read each time to a server, so that the server performs synchronization according to the received data. The apparatus comprises: an audio data stream acquisition module, a writing module, a data reading module, and an upload module. The present disclosure implements real-time sound recording synchronization and can achieve an effect of synchronous recording, saving, and upload; meanwhile, when sound recording is unexpectedly interrupted before being finished or is accidentally deleted, sound recording content may further be recovered to the maximum extent according to synchronization that has been performed on a server, thereby protecting the safety of an audio file, improving the stability of an audio file, and achieving an objective of data recovery.

Description

录音同步方法、 装置和设备 本申请基于申请号为 201310207077.1、 申请日为 2013年 5月 29日的中国专利申请提 出, 并要求该中国专利申请的优先权, 该中国专利申请的全部内容在此引入本申请作为参 考。 技术领域  The present invention is based on the Chinese patent application No. 201310207077.1, filed on May 29, 2013, and the priority of the Chinese patent application, the entire contents of which are hereby incorporated herein. This application is hereby incorporated by reference. Technical field
本公开涉及终端设备领域, 特别涉及一种录音同步方法、 装置和设备。 背景技术  The present disclosure relates to the field of terminal devices, and in particular, to a recording synchronization method, apparatus, and device. Background technique
随着移动电话的普及, 手机成为生活中必不可少且随身携带的电子设备。 为了能够更 加简单的记录下一些重要的声音内容, 手机录音软件以其方便快捷的操作, 简单的存储记 录方式, 内置录音设备的不断提升, 吸引着一大批使用者。  With the popularity of mobile phones, mobile phones have become an indispensable and portable electronic device in life. In order to make it easier to record some important sound content, the mobile phone recording software attracts a large number of users with its convenient and quick operation, simple storage recording method and continuous improvement of built-in recording equipment.
除了录音软件的易用性, 稳定性外, 对录音文件的安全性也有较高的要求。 对用户数 据的安全性保护是现在手机软件的发展趋势, 越来越多的软件会考虑保护用户数据。 该保 护措施通常是将一个完整的文件上传到服务器, 当本地数据文件丢失或者登录账户平台后 能从服务器上下载到原文件。  In addition to the ease of use and stability of the recording software, there is also a high requirement for the security of the recorded files. The security protection of user data is the development trend of mobile phone software nowadays, and more and more software will consider protecting user data. This protection usually uploads a complete file to the server and can be downloaded from the server to the original file when the local data file is lost or logged into the account platform.
在实现本公开的过程中, 发明人发现至少存在以下问题: 录音软件对于记者或者一些 特殊人士会是一个非常重要的音频记录软件,例如要对某一个重要而且敏感的事件做音频 取证, 而在其记录过程中遇到了某些突发事件被迫删掉已获取的音频文件, 那么普通的同 步备份方法不可能将文件上传到服务器, 就无法完成数据恢复的工作, 也即是还未上传的 文件在丢失后无法进行恢复, 使得录音的安全性以及音频文件的稳定性均比较差。 发明内容  In the process of implementing the present disclosure, the inventors found that at least the following problems exist: The recording software is a very important audio recording software for journalists or some special persons, for example, to perform audio forensics on an important and sensitive event, and During the recording process, some unexpected events were forced to delete the acquired audio files. Therefore, the ordinary synchronous backup method cannot upload the files to the server, and the data recovery work cannot be completed, that is, the data has not been uploaded yet. Files cannot be recovered after they are lost, making the security of recording and the stability of audio files relatively poor. Summary of the invention
为了最大程度上保护音频文件的安全,提高音频文件的稳定性,达到数据恢复的目的, 本公开实施例提供了一种录音同步方法、 装置和设备。 所述技术方案如下:  In order to maximize the security of the audio file, improve the stability of the audio file, and achieve data recovery, the embodiment of the present disclosure provides a recording synchronization method, apparatus, and device. The technical solution is as follows:
根据本公开实施例的第一方面, 提供一种录音同步方法, 所述方法包括:  According to a first aspect of the embodiments of the present disclosure, a recording synchronization method is provided, the method comprising:
在录音过程中, 获取音频数据流;  Acquiring audio data streams during recording;
对获取到的音频数据流按照预设的编码格式进行编码,将编码生成的数据写入音频文 件;  And encoding the obtained audio data stream according to a preset encoding format, and writing the encoded data into the audio file;
从正在写入的音频文件中读取数据;  Reading data from the audio file being written;
将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 从正在写入的音频文件中读取数据, 包括:  The data read each time is uploaded to the server, so that the server synchronizes according to the received data. Read data from the audio file being written, including:
根据上一次读取到的数据在所述音频文件中的位置, 更新文件的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的起始点, 继续读取数 据。 Updating the read position of the file according to the position of the last read data in the audio file; The read position after the update in the audio file being written is the starting point of the current reading, and the data is continuously read.
将每次读取到的数据上传至服务器, 包括:  Upload each read data to the server, including:
录音开始时, 向所述服务器发送上传请求, 使得所述服务器为所述音频文件分配文件 标识;  When the recording starts, sending an upload request to the server, so that the server allocates a file identifier for the audio file;
根据所述服务器分配的文件标识,将每次读取的数据上传至服务器所保存的所述文件 标识对应的音频文件的文件末尾。  According to the file identifier allocated by the server, each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
将每次读取到的数据上传至服务器之后, 所述方法还包括:  After uploading the data read each time to the server, the method further includes:
当读取到所述音频文件的文件末尾且确定本次录音停止时, 结束数据上传。  When the end of the file of the audio file is read and it is determined that the recording is stopped, the data upload is ended.
从正在写入的音频文件中读取数据包括:  Reading data from the audio file being written includes:
将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。 根据本公开实施例的第二方面, 提供一种录音同步装置, 所述装置包括:  The audio file being written is divided into a plurality of file segments, and the plurality of file segments are separately read. According to a second aspect of the embodiments of the present disclosure, a recording synchronization apparatus is provided, the apparatus comprising:
音频数据流获取模块, 用于在录音过程中, 获取音频数据流;  An audio data stream obtaining module, configured to acquire an audio data stream during recording;
写入模块, 用于对获取到的音频数据流按照预设的编码格式进行编码, , 将编码生成 的数据写入音频文件;  a writing module, configured to encode the obtained audio data stream according to a preset encoding format, and write the encoded data into the audio file;
数据读取模块, 用于从正在写入的音频文件中读取数据;  a data reading module, configured to read data from an audio file being written;
上传模块, 用于将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据 进行同步。  The uploading module is configured to upload each read data to the server, so that the server synchronizes according to the received data.
所述数据读取模块用于根据上一次读取到的数据在所述音频文件中的位置,更新文件 的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的起始点, 继续 读取数据。  The data reading module is configured to update the read position of the file according to the position of the last read data in the audio file; and the updated read position in the audio file being written The starting point of the second reading, continue to read the data.
所述上传模块用于录音开始时, 向所述服务器发送上传请求, 使得所述服务器为所述 音频文件分配文件标识; 根据所述服务器分配的文件标识, 将每次读取的数据上传至服务 器所保存的所述文件标识对应的音频文件的文件末尾。  The uploading module is configured to send an upload request to the server when the recording starts, so that the server allocates a file identifier to the audio file; and uploads the data read each time to the server according to the file identifier allocated by the server. The saved file identifies the end of the file of the corresponding audio file.
所述上传模块还用于当读取到所述音频文件的文件末尾且确定本次录音停止时,结束 数据上传。  The uploading module is further configured to end data uploading when the end of the file of the audio file is read and it is determined that the recording is stopped.
所述数据读取模块用于将所述正在写入的音频文件分成多个文件片段,对所述多个文 件片段进行分别读取。  The data reading module is configured to divide the audio file being written into a plurality of file segments, and separately read the plurality of file segments.
根据本公开实施例的第三方面, 提供一种终端设备, 终端设备包括有存储器, 以及一 个或者一个以上的程序, 其中一个或者一个以上程序存储于存储器中, 且经配置以由一个 或者一个以上处理器执行述一个或者一个以上程序包含用于进行以下操作的指令:  According to a third aspect of an embodiment of the present disclosure, a terminal device is provided, the terminal device including a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be one or more The processor executes one or more programs that include instructions for performing the following operations:
在录音过程中, 获取音频数据流;  Acquiring audio data streams during recording;
对获取到的音频数据流进行编码, 将编码生成的数据写入音频文件;  Encoding the obtained audio data stream, and writing the encoded data into an audio file;
从正在写入的音频文件中读取数据;  Reading data from the audio file being written;
将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 应当理解的是, 以上的一般描述和后文的细节描述仅是示例性和解释性的, 并不能限 制本发明。 The data read each time is uploaded to the server, so that the server synchronizes according to the received data. The above general description and the following detailed description are intended to be illustrative and not restrictive.
本公开的实施例提供的技术方案可以包括以下有益效果:  The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
通过在录制音频文件的同时,对音频文件中的数据进行上传,实现了实时的录音同步, 即能够达到随录随存随上传的效果, 还能够使得在录音未结束被意外打断或意外删除时, 能够根据在服务器上已经进行的同步而最大限度的恢复录音内容, 保护了音频文件的安 全, 提高音频文件的稳定性, 达到数据恢复的目的。 附图说明  By uploading the audio file and uploading the data in the audio file, real-time recording synchronization can be realized, that is, the effect of uploading with the recording can be achieved, and the recording can be accidentally interrupted or accidentally deleted after the recording is not finished. At the same time, the recording content can be restored to the maximum extent according to the synchronization already performed on the server, the security of the audio file is protected, the stability of the audio file is improved, and the data recovery is achieved. DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分, 示出了符合本发明的实施例, 并与说明书一起用于解释本发明的原理。  The accompanying drawings, which are incorporated in the specification of FIG
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的 附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本公开的一些实施例, 对于本 领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的 附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings which are used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present disclosure. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是根据一示例性实施例示出的一种录音同步方法的流程图;  FIG. 1 is a flowchart of a recording synchronization method according to an exemplary embodiment;
图 2是根据一示例性实施例示出的一种录音同步方法的流程图;  FIG. 2 is a flowchart of a recording synchronization method according to an exemplary embodiment;
图 3是根据一示例性实施例示出的一种录音同步装置的结构示意图;  FIG. 3 is a schematic structural diagram of a recording synchronization apparatus according to an exemplary embodiment;
图 4是根据一示例性实施例示出的终端设备的结构示意图。 具体实施方式  FIG. 4 is a schematic structural diagram of a terminal device according to an exemplary embodiment. detailed description
为使本公开的目的、技术方案和优点更加清楚, 下面将结合附图对本公开实施方式作 进一步地详细描述。  The embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
图 1是本公开实施例提供的一种录音同步方法的流程图。 参见图 1, 所述方法包括: 101、 在录音过程中, 获取音频数据流;  FIG. 1 is a flowchart of a recording synchronization method according to an embodiment of the present disclosure. Referring to FIG. 1, the method includes: 101. Acquire an audio data stream during recording;
102、 对获取到的音频数据流按照预设的编码格式进行编码, , 将编码生成的数据写 入音频文件;  102. Encode the obtained audio data stream according to a preset encoding format, and write the encoded data into the audio file.
其中, 预设的编码格式为按照帧进行编码的编码格式。  The preset encoding format is an encoding format that is encoded according to a frame.
103、 从正在写入的音频文件中读取数据;  103. Read data from an audio file being written;
104、将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 为了能够让用户放心自己数据的安全性, 最大程度上恢复用户的本地数据, 也为了能 够应对各种意外情况的发生, 可以对录音文件进行实时同步, 即在录音的过程中采用随录 随存随上传的方法来备份文件,这样即使遇到不可预料的情况而不得不删掉已经存储的文 件时, 也能够在用户平台上恢复删掉后的文件, 最大程度上保护文件安全。  104. Upload the data read each time to the server, so that the server synchronizes according to the received data. In order to allow users to be assured of the security of their own data, to restore the user's local data to the greatest extent, in order to be able to cope with the occurrence of various unexpected situations, the recording files can be synchronized in real time, that is, in the process of recording, using the accompanying record Back up the files with the upload method, so that even if you have to delete the files that have already been stored in case of unforeseen circumstances, you can restore the deleted files on the user platform to maximize the security of the files.
通过在录制音频文件的同时,对音频文件中的数据进行上传,实现了实时的录音同步, 即能够达到随录随存随上传的效果, 还能够使得在录音未结束被意外打断或意外删除时, 能够根据在服务器上已经进行的同步而最大限度的恢复录音内容, 保护了音频文件的安 全, 提高音频文件的稳定性, 达到数据恢复的目的。 较佳的, 从正在写入的音频文件中读取数据, 包括: Real-time recording synchronization is achieved by uploading data in an audio file while recording an audio file. That is to be able to achieve the effect of the accompanying upload and upload, and also enable the recording of the recorded content to be maximized according to the synchronization already performed on the server when the recording is not ended unexpectedly or accidentally deleted, and the audio file is protected. Security, improve the stability of audio files, and achieve data recovery. Preferably, the data is read from the audio file being written, including:
根据上一次读取到的数据在所述音频文件中的位置, 更新文件的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的起始点, 继续读取数 据。  Updating the read position of the file according to the position of the last read data in the audio file; the updated read position in the audio file being written is the starting point of the current reading, and continues Read the data.
较佳的, 将每次读取到的数据上传至服务器, 包括:  Preferably, each time the data read is uploaded to the server, including:
录音开始时, 向所述服务器发送上传请求, 使得所述服务器为所述音频文件分配文件 标识;  When the recording starts, sending an upload request to the server, so that the server allocates a file identifier for the audio file;
根据所述服务器分配的文件标识,将每次读取的数据上传至服务器所保存的所述文件 标识对应的音频文件的文件末尾。  According to the file identifier allocated by the server, each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
较佳的, 将每次读取到的数据上传至服务器之后, 所述方法还包括:  Preferably, after uploading the data that is read each time to the server, the method further includes:
当读取到所述音频文件的文件末尾且确定本次录音停止时, 结束数据上传。  When the end of the file of the audio file is read and it is determined that the recording is stopped, the data upload is ended.
较佳的, 从正在写入的音频文件中读取数据包括:  Preferably, reading data from the audio file being written comprises:
将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。 图 2是本公开实施例提供的一种录音同步的方法的流程图。 参见图 2, 该实施例具体 包括:  The audio file being written is divided into a plurality of file segments, and the plurality of file segments are separately read. FIG. 2 is a flowchart of a method for recording synchronization provided by an embodiment of the present disclosure. Referring to FIG. 2, the embodiment specifically includes:
200、 终端设备启动录音功能, 分别执行步骤 201和 204;  200, the terminal device starts the recording function, and performs steps 201 and 204 respectively;
在启动录音功能时, 终端设备进行录音初始化, 并开始通过麦克风采集声音, 以获取 音频数据流, 此时, 向为数据同步服务的服务器发送上传请求, 该上传请求用于请求实时 上传当前录制的音频文件, 并请求服务器为该正在录制的音频文件分配文件标识。  When the recording function is started, the terminal device performs recording initialization, and starts collecting sound through the microphone to obtain an audio data stream. At this time, an upload request is sent to the server for the data synchronization service, and the upload request is used to request real-time uploading of the currently recorded An audio file, and requesting the server to assign a file identifier to the audio file being recorded.
201、 在录音过程中, 终端设备获取音频数据流;  201. During the recording process, the terminal device acquires an audio data stream.
在启动录音功能并进行录音初始化后, 需要査看用户是否希望继续录音, 如果是, 则 继续获取音频数据流的获取, 如果否, 则退出录音功能。  After starting the recording function and initializing the recording, you need to check whether the user wants to continue recording. If yes, continue to obtain the audio stream acquisition. If not, exit the recording function.
202、 对获取到的音频数据流按照预设的编码格式进行编码, 终端设备将编码生成的 数据写入音频文件;  202. The obtained audio data stream is encoded according to a preset encoding format, and the terminal device writes the encoded data into an audio file.
具体地, 每当获取到音频数据流时, 终端设备对获取到的音频数据流进行 MP3格式 编码, 将编码生成的数据写入音频文件。  Specifically, each time the audio data stream is acquired, the terminal device performs MP3 format encoding on the acquired audio data stream, and writes the encoded generated data into the audio file.
本公开实施例的在获取到音频数据流时, 对音频数据流进行 MP3格式编码, 将采集 到的 PCM数据编码为 MP3格式的音频文件进行保存,不断地重复此过程可以将外界的音 频信息转换成连续不断的 MP3音频文件。  When acquiring the audio data stream, the audio data stream is encoded in the MP3 format, and the collected PCM data is encoded into an MP3 format audio file for storage, and the process is repeated to continuously convert the external audio information. Into a continuous MP3 audio file.
203、 当录音过程结束时, 终端设备补充获取到的音频文件的文件尾, 输出补充后的 音频文件, 结束。 203. When the recording process ends, the terminal device supplements the file end of the obtained audio file, and outputs the supplemented The audio file ends.
需要说明的是, 该 MP3格式的编码过程即是不断获取音频数据流, 不断进行编码的 过程, 不断地重复此过程可以将外界的音频信息转换成包括连续不断帧的 MP3音频文件。 由于 MP3存储格式的音频压缩率高, 且失真小, 因此使用 MP3的编码格式可以很大程度 上方便了用户对音频的存储和使用。 且由于 MP3编码格式的特殊性, 其编码是一帧一帧 进行的, 因此在音频录制过程中, 即使录音发生暂停时, 之前保存的帧不丢失, 不会因为 录音的暂停或中断设备掉电等丢失之前保存的帧, 与 amr或 3gpp等格式的录制相比, 具 有较高的稳定性。  It should be noted that the encoding process of the MP3 format is a process of continuously acquiring an audio data stream and continuously encoding, and continuously repeating the process to convert the external audio information into an MP3 audio file including continuous frames. Because the MP3 storage format has high audio compression rate and low distortion, the MP3 encoding format can greatly facilitate the user's storage and use of audio. And because of the particularity of the MP3 encoding format, the encoding is performed one frame at a time, so during the audio recording process, even if the recording pauses, the previously saved frame is not lost, and the device will not be powered down due to pause or interruption of the recording. If you lose the previously saved frame, it has higher stability than recording in formats such as amr or 3gpp.
204、 终端设备向服务器发送上传请求;  204. The terminal device sends an upload request to the server.
较佳的, 当检测到终端设备接入网络时, 开启该上传流程。 又或者, 当检测到终端设 备未接入网络时, 提示用户开启网络连接以便进行录音的同步, 当检测到用户开启网络连 接时, 开启该上传流程。  Preferably, when the terminal device is detected to access the network, the uploading process is started. Or, when it is detected that the terminal device is not connected to the network, the user is prompted to open the network connection for recording synchronization, and when the user is detected to open the network connection, the uploading process is started.
该上传请求用于请求实时上传当前录制的音频文件,并请求服务器为该正在录制的音 频文件分配文件标识。服务器根据终端设备的上传请求, 为本次录音的音频文件分配文件 标识。  The upload request is used to request that the currently recorded audio file be uploaded in real time, and the server is requested to assign a file identifier to the audio file being recorded. The server assigns a file identifier to the audio file of this recording according to the upload request of the terminal device.
在本公开实施例中, 服务器当接收到终端设备的上传请求时, 可以随机为本次录音的 音频文件分配文件标识, 该文件标识用于终端设备在上传数据时携带, 以便服务器根据该 文件标识对接收到的数据进行对应的保存。  In the embodiment of the present disclosure, when receiving the uploading request of the terminal device, the server may randomly assign a file identifier to the audio file of the recording, and the file identifier is used by the terminal device to carry the data when uploading, so that the server identifies the file according to the file. Correspondly save the received data.
205、 终端设备获取到服务器分配的文件标识后, 将文件的零字节位置设置为文件已 读位置;  205. After the terminal device obtains the file identifier allocated by the server, set the zero byte position of the file to the file read position.
其中,文件已读位置用于标识当前音频文件已经读取并上传的数据在该音频文件中的 位置。  The file read position is used to identify the location of the data that the current audio file has read and uploaded in the audio file.
较佳的, 对于终端设备录制开始并第一次读取数据时, 可以对文件已读位置进行初始 的设置, 即将该音频文件的零字节位置设置为文件已读位置。  Preferably, when the terminal device starts recording and reads data for the first time, the file read position can be initially set, that is, the zero byte position of the audio file is set to the file read position.
206、 终端设备以文件已读位置为本次读取的起始点, 从正在写入的音频文件中读取 数据;  206. The terminal device reads the data from the audio file being written by using the file read position as the starting point of the current reading;
其中, 每次读取的数据大小可以为预设数值, 该预设数值可以由技术人员在开发时设 置, 还可以由用户根据需求调整, 本公开实施例对此不做限定。  The size of the data that is read each time may be a preset value, which may be set by the technician at the time of development, and may be adjusted by the user according to the requirement, which is not limited by the embodiment of the disclosure.
207、 终端设备根据所述服务器分配的文件标识, 将每次读取的数据上传至服务器所 保存的所述文件标识对应的音频文件的文件末尾;  207. The terminal device uploads, according to the file identifier allocated by the server, the data read each time to the end of the file of the audio file corresponding to the file identifier saved by the server;
在终端设备进行数据上传时, 在上传的数据中携带服务器分配的文件标识, 当服务器 接收到该携带文件标识的数据时, 根据文件标识确定文件标识对应的音频文件, 并将本次 接收到的数据保存至该文件标识对应的音频文件的文件末尾,保证了服务器侧保存音频数 据的连续性。  When the terminal device performs data uploading, the uploaded data carries the file identifier allocated by the server. When the server receives the data carrying the file identifier, the file determines the audio file corresponding to the file identifier according to the file identifier, and the received audio file is received. The data is saved to the end of the file of the audio file corresponding to the file identifier, which ensures the continuity of the audio data saved on the server side.
需要说明的是, 如果数据上传失败, 则需继续尝试上传直到上传成功。 208、 终端设备根据上一次读取到的数据在所述音频文件中的位置, 更新文件的已读 位置; It should be noted that if the data upload fails, you need to continue to try uploading until the upload is successful. 208. The terminal device updates the read position of the file according to the location of the last read data in the audio file.
例如, 上一次读取到的数据为音频文件的 1024字节, 则将 1024字节更新为文件已读 位置,而在本次读取时,以该 1024字节位置为本次读取的起始点,读取该音频文件中 1024 字节以后的数据。  For example, if the last data read is 1024 bytes of the audio file, then 1024 bytes are updated to the file read position, and at the time of this reading, the 1024 byte position is used for the current reading. At the beginning, the data after 1024 bytes in the audio file is read.
209、 每次读取数据之前, 终端设备判断当前更新后的已读位置是否为音频文件的文 件末尾, 如果是, 执行步骤 210; 如果否, 根据更新后的文件已读位置, 执行步骤 206。  209. Before the data is read, the terminal device determines whether the currently updated read position is the end of the file of the audio file, and if yes, step 210 is performed; if not, step 206 is performed according to the updated file read position.
较佳的, 由于在录音过程中, 需要进行至少一次数据的读取和上传, 因此, 为了保证 数据的读取和上传不中断,在每次读取之前根据当前的文件已读位置判断是否已经读取到 音频文件的文件末尾, 以获知是否还有数据需要上传, 当文件已读位置已经是音频文件的 文件末尾, 则可以结束数据上传, 而当文件已读位置不是音频文件的文件末尾, 需要继续 从音频文件中读取数据并上传。  Preferably, since at least one data reading and uploading is required during the recording process, in order to ensure that the reading and uploading of the data is not interrupted, it is determined whether the read position of the current file has been read before each reading. Read the end of the file of the audio file to know if there is still data to upload. When the file has been read at the end of the file of the audio file, the data upload can be ended. When the file has been read at the end of the file of the audio file, Need to continue to read data from the audio file and upload.
具体地, 每次读取数据之前, 终端设备判断当前更新后的已读位置是否为音频文件的 文件末尾, 如果是, 则认为录音结束, 结束数据上传, 而如果否, 则认为录音尚未结束, 根据更新后的文件已读位置, 以所述正在写入的音频文件中的已读位置为本次读取的起始 点, 从正在写入的音频文件中继续读取数据。  Specifically, before the data is read, the terminal device determines whether the currently updated read position is the end of the file of the audio file, and if so, it considers that the recording ends and ends the data upload, and if not, the recording is not yet finished. According to the updated read position of the file, the read position in the audio file being written is the starting point of the current reading, and the data is continuously read from the audio file being written.
另外, 本公开实施例是以读取音频文件中的数据并上传数据为例进行说明的, 在本公 开实施例提供的另一实现方式中, 还可以将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取, 由于该音频文件的编码是一帧一帧进行的, 因此在数 据读取和上传过程中, 也可以对该音频文件进行分段, 每一个文件片段是一个完整的音频 文件, 当终端设备将多个文件片段分别读取并上传至服务器时, 服务器对多个文件片段进 行顺序保存, 也能够完成对录音的同步, 实现对录制的音频文件进行实时备份的目的。  In addition, the embodiment of the present disclosure is described by taking the data in the audio file and uploading the data as an example. In another implementation manner provided by the embodiment of the present disclosure, the audio file being written may also be divided into multiple a file segment, the plurality of file segments are separately read, since the encoding of the audio file is performed one frame at a time, the audio file may also be segmented during the data reading and uploading process. Each file segment is a complete audio file. When the terminal device reads and uploads multiple file segments to the server separately, the server sequentially saves multiple file segments, and can also complete the synchronization of the recording to achieve the recording. The purpose of real-time backup of audio files.
210、 判断本次录音是否停止, 如果是, 结束数据上传; 如果否, 执行步骤 206。 需要说明的是, 如果上传速度比录制的速度快, 那么有可能上传到了文件尾的位置, 但是录音还在向文件尾部继续添加新的录音内容,所以需要判断是否到文件尾之后还要判 断录音是否停止, 如果录音已经停止, 结束这次的上传任务。  210. Determine whether the recording is stopped. If yes, end the data upload; if no, go to step 206. It should be noted that if the upload speed is faster than the recording speed, it may be uploaded to the end of the file, but the recording is still adding new recording content to the end of the file, so it is necessary to judge whether to judge the recording after the end of the file. Whether to stop, if the recording has stopped, end this upload task.
本公开实施例提供的方法, 通过在录制音频文件的同时, 对音频文件中的数据进行上 传, 实现了实时的录音同步, 即能够达到随录随存随上传的效果, 还能够使得在录音未结 束被意外打断或意外删除时,能够根据在服务器上已经进行的同步而最大限度的恢复录音 内容, 保护了音频文件的安全, 提高音频文件的稳定性, 达到数据恢复的目的。 图 3是本公开实施例提供的一种录音同步装置的结构示意图。 参见图 3, 所述装置包 括: 音频数据流获取模块 301、 写入模块 302、 数据读取模块 303和上传模块 304,  The method provided by the embodiment of the present disclosure realizes real-time recording synchronization by uploading data in the audio file while recording the audio file, that is, the effect of uploading with the record can be achieved, and the recording is not performed. When the end is accidentally interrupted or accidentally deleted, the recording content can be restored to the maximum extent according to the synchronization already performed on the server, the security of the audio file is protected, the stability of the audio file is improved, and the data recovery is achieved. FIG. 3 is a schematic structural diagram of a recording synchronization apparatus according to an embodiment of the present disclosure. Referring to FIG. 3, the device includes: an audio data stream obtaining module 301, a writing module 302, a data reading module 303, and an uploading module 304.
音频数据流获取模块 301用于在录音过程中, 获取音频数据流; 音频数据流获取模块 301与写入模块 302链接, 该写入模块 302用于对获取到的音频数据流按照预设的编码格 式进行编码,将编码生成的数据写入音频文件;该写入模块 302与数据读取模块 303链接, 该数据读取模块 303用于从正在写入的音频文件中读取数据;该数据读取模块 303与上传 模块 304链接, 该上传模块 304用于将每次读取到的数据上传至服务器, 使得所述服务器 根据接收到数据进行同步。 The audio data stream obtaining module 301 is configured to obtain an audio data stream during the recording process; the audio data stream obtaining module 301 is linked with the writing module 302, and the writing module 302 is configured to perform the preset encoding on the acquired audio data stream. Grid Encoding, writing the encoded data into an audio file; the writing module 302 is linked with a data reading module 303, the data reading module 303 is configured to read data from the audio file being written; the data is read The fetch module 303 is linked to the uploading module 304, and the uploading module 304 is configured to upload each read data to the server, so that the server synchronizes according to the received data.
较佳的,所述数据读取模块 303用于根据上一次读取到的数据在所述音频文件中的位 置, 更新文件的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的 起始点, 继续读取数据。  Preferably, the data reading module 303 is configured to update the read position of the file according to the position of the last read data in the audio file; and the updated in the audio file being written. The read position is the starting point of this reading and continues to read data.
较佳的, 所述上传模块 304用于录音开始时, 向所述服务器发送上传请求, 使得所述 服务器为所述音频文件分配文件标识; 根据所述服务器分配的文件标识, 将每次读取的数 据上传至服务器所保存的所述文件标识对应的音频文件的文件末尾。  Preferably, the uploading module 304 is configured to send an upload request to the server when the recording starts, so that the server allocates a file identifier for the audio file; and each read according to the file identifier allocated by the server The data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
较佳的,所述上传模块 304还用于当读取到所述音频文件的文件末尾且确定本次录音 停止时, 结束数据上传。  Preferably, the uploading module 304 is further configured to end the data upload when the end of the file of the audio file is read and it is determined that the recording is stopped.
较佳的, 所述数据读取模块 303用于将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。  Preferably, the data reading module 303 is configured to divide the audio file being written into a plurality of file segments, and separately read the plurality of file segments.
本公开实施例提供的装置, 通过在录制音频文件的同时, 对音频文件中的数据进行上 传, 实现了实时的录音同步, 即能够达到随录随存随上传的效果, 还能够使得在录音未结 束被意外打断或意外删除时,能够根据在服务器上已经进行的同步而最大限度的恢复录音 内容, 保护了音频文件的安全, 提高音频文件的稳定性, 达到数据恢复的目的。  The device provided by the embodiment of the present disclosure realizes real-time recording synchronization by uploading data in the audio file while recording the audio file, that is, the effect of uploading with the record can be achieved, and the recording can not be performed. When the end is accidentally interrupted or accidentally deleted, the recording content can be restored to the maximum extent according to the synchronization already performed on the server, the security of the audio file is protected, the stability of the audio file is improved, and the data recovery is achieved.
需要说明的是: 上述实施例提供的录音同步装置在录音同步时, 仅以上述各功能模块 的划分进行举例说明, 实际应用中, 可以根据需要而将上述功能分配由不同的功能模块完 成, 即将设备的内部结构划分成不同的功能模块, 以完成以上描述的全部或者部分功能。 另外, 上述实施例提供的录音同步装置与录音同步方法实施例属于同一构思, 其具体实现 过程详见方法实施例, 这里不再赘述。  It should be noted that: the recording synchronization device provided in the foregoing embodiment is only illustrated by the division of each functional module in the recording synchronization. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above. In addition, the recording synchronization device and the recording synchronization method are provided in the same embodiment. For details, refer to the method embodiment, and details are not described herein again.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完 成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存储于一种计算机可读存储 介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。  A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
图 4为本公开实施例所涉及的终端设备的结构示意图,该终端设备可以用于实施上述 实施例中提供的录音同步方法。 具体来讲:  FIG. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present disclosure. The terminal device may be used to implement the recording synchronization method provided in the foregoing embodiment. Specifically:
终端设备 400可以包括 RF (Radio Frequency, 射频) 电路 110、 包括有一个或一个以 上计算机可读存储介质的存储器 120、 输入单元 130、 显示单元 140、 传感器 150、 音频电 路 160、 WiFi(wireless fidelity, 无线保真)模块 170、 包括有一个或者一个以上处理核心的 处理器 180、 以及电源 190等部件。 本领域技术人员可以理解, 图 4中示出的终端设备结 构并不构成对终端设备的限定, 可以包括比图示更多或更少的部件, 或者组合某些部件, 或者不同的部件布置。 其中:  The terminal device 400 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity, The Wireless Fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like. It will be understood by those skilled in the art that the terminal device structure shown in Fig. 4 does not constitute a limitation of the terminal device, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements. among them:
RF电路 110可用于收发信息或通话过程中, 信号的接收和发送, 特别地, 将基站的 下行信息接收后, 交由一个或者一个以上处理器 180处理; 另外, 将涉及上行的数据发送 给基站。 通常, RF电路 110包括但不限于天线、 至少一个放大器、 调谐器、 一个或多个 振荡器、 用户身份模块 (SIM) 卡、 收发信机、 耦合器、 LNA (Low Noise Amplifier, 低 噪声放大器) 、 双工器等。 此外, RF电路 110还可以通过无线通信与网络和其他设备通 信。 所述无线通信可以使用任一通信标准或协议, 包括但不限于 GSM(Global System of Mobile communication, 全球移动通讯系统)、 GPRS(General Packet Radio Service, 通用分 组无线服务)、 CDMA(Code Division Multiple Access,码分多址)、 WCDMA(Wideband Code Division Multiple Access, 宽带码分多址)、 LTE(Long Term Evolution,长期演进)、 电子邮件、 SMS(Short Messaging Service, 短消息服务)等。 The RF circuit 110 can be used for transmitting and receiving information or during a call, receiving and transmitting signals, in particular, After the downlink information is received, it is processed by one or more processors 180; in addition, data related to the uplink is transmitted to the base station. Generally, the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc. In addition, RF circuitry 110 can also communicate with the network and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access). , Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
存储器 120可用于存储软件程序以及模块,处理器 180通过运行存储在存储器 120的 软件程序以及模块, 从而执行各种功能应用以及数据处理。存储器 120可主要包括存储程 序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比 如声音播放功能、 图像播放功能等)等; 存储数据区可存储根据终端设备 400的使用所创 建的数据 (比如音频数据、 电话本等)等。 此外, 存储器 120可以包括高速随机存取存储 器, 还可以包括非易失性存储器, 例如至少一个磁盘存储器件、 闪存器件、 或其他易失性 固态存储器件。 相应地, 存储器 120还可以包括存储器控制器, 以提供处理器 180和输入 单元 130对存储器 120的访问。  The memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to The data created by the use of the terminal device 400 (such as audio data, phone book, etc.) and the like. Moreover, memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
输入单元 130可用于接收输入的数字或字符信息, 以及产生与用户设置以及功能控制 有关的键盘、 鼠标、 操作杆、 光学或者轨迹球信号输入。 具体地, 输入单元 130可包括触 敏表面 131 以及其他输入设备 132。 触敏表面 131, 也称为触摸显示屏或者触控板, 可收 集用户在其上或附近的触摸操作(比如用户使用手指、 触笔等任何适合的物体或附件在触 敏表面 131上或在触敏表面 131附近的操作), 并根据预先设定的程式驱动相应的连接装 置。 可选的, 触敏表面 131可包括触摸检测装置和触摸控制器两个部分。 其中, 触摸检测 装置检测用户的触摸方位, 并检测触摸操作带来的信号, 将信号传送给触摸控制器; 触摸 控制器从触摸检测装置上接收触摸信息, 并将它转换成触点坐标, 再送给处理器 180, 并 能接收处理器 180发来的命令并加以执行。 此外, 可以采用电阻式、 电容式、 红外线以及 表面声波等多种类型实现触敏表面 131。 除了触敏表面 131, 输入单元 130还可以包括其 他输入设备 132。 具体地, 其他输入设备 132可以包括但不限于物理键盘、 功能键 (比如 音量控制按键、 开关按键等) 、 轨迹球、 鼠标、 操作杆等中的一种或多种。  Input unit 130 can be used to receive input numeric or character information, as well as to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls. In particular, input unit 130 can include touch sensitive surface 131 as well as other input devices 132. Touch-sensitive surface 131, also referred to as a touch display or trackpad, can collect touch operations on or near the user (eg, the user uses a finger, stylus, etc., on any touch-sensitive surface 131 or on the touch-sensitive surface 131 The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program. Alternatively, the touch-sensitive surface 131 may include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information The processor 180 is provided and can receive commands from the processor 180 and execute them. In addition, the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 can also include other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元 140可用于显示由用户输入的信息或提供给用户的信息以及终端设备 400的 各种图形用户接口, 这些图形用户接口可以由图形、 文本、 图标、 视频和其任意组合来构 成。 显示单元 140可包括显示面板 141, 可选的, 可以采用 LCD(Liquid Crystal Display, 液晶显示器)、 OLED(Organic Light-Emitting Diode,有机发光二极管)等形式来配置显示面板 141。进一步的, 触敏表面 131可覆盖显示面板 141, 当触敏表面 131检测到在其上或附近 的触摸操作后, 传送给处理器 180以确定触摸事件的类型, 随后处理器 180根据触摸事件 的类型在显示面板 141上提供相应的视觉输出。 虽然在图 4中, 触敏表面 131与显示面板 141是作为两个独立的部件来实现输入和输入功能, 但是在某些实施例中, 可以将触敏表 面 131与显示面板 141集成而实现输入和输出功能。 The display unit 140 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal device 400, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 140 may include a display panel 141. Alternatively, the display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141. Although in FIG. 4, touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
终端设备 400还可包括至少一种传感器 150, 比如光传感器、 运动传感器以及其他传 感器。 具体地, 光传感器可包括环境光传感器及接近传感器, 其中, 环境光传感器可根据 环境光线的明暗来调节显示面板 141的亮度,接近传感器可在终端设备 400移动到耳边时, 关闭显示面板 141 和 /或背光。 作为运动传感器的一种, 重力加速度传感器可检测各个方 向上(一般为三轴)加速度的大小, 静止时可检测出重力的大小及方向, 可用于识别手机 姿态的应用 (比如横竖屏切换、 相关游戏、 磁力计姿态校准) 、 振动识别相关功能 (比如 计步器、 敲击) 等; 至于终端设备 400还可配置的陀螺仪、 气压计、 湿度计、 温度计、 红 外线传感器等其他传感器, 在此不再赘述。  Terminal device 400 may also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the terminal device 400 moves to the ear. And / or backlight. As a kind of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the terminal device 400, other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., can be configured here. No longer.
音频电路 160、扬声器 161, 传声器 162可提供用户与终端设备 400之间的音频接口。 音频电路 160可将接收到的音频数据转换后的电信号, 传输到扬声器 161, 由扬声器 161 转换为声音信号输出; 另一方面, 传声器 162将收集的声音信号转换为电信号, 由音频电 路 160接收后转换为音频数据, 再将音频数据输出处理器 180处理后, 经 RF电路 110以 发送给比如另一终端设备, 或者将音频数据输出至存储器 120以便进一步处理。 音频电路 160还可能包括耳塞插孔, 以提供外设耳机与终端设备 400的通信。  The audio circuit 160, the speaker 161, and the microphone 162 provide an audio interface between the user and the terminal device 400. The audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the terminal device, for example, by the RF circuit 110, or outputted to the memory 120 for further processing. The audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the terminal device 400.
WiFi属于短距离无线传输技术, 终端设备 400通过 WiFi模块 170可以帮助用户收发 电子邮件、 浏览网页和访问流式媒体等, 它为用户提供了无线的宽带互联网访问。 虽然图 4示出了 WiFi模块 170, 但是可以理解的是, 其并不属于终端设备 400的必须构成, 完全 可以根据需要在不改变发明的本质的范围内而省略。  WiFi is a short-range wireless transmission technology, and the terminal device 400 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 170, which provides users with wireless broadband Internet access. Although FIG. 4 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the terminal device 400, and may be omitted as needed within the scope of not changing the essence of the invention.
处理器 180是终端设备 400的控制中心,利用各种接口和线路连接整个手机的各个部 分, 通过运行或执行存储在存储器 120 内的软件程序和 /或模块, 以及调用存储在存储器 120内的数据, 执行终端设备 400的各种功能和处理数据, 从而对手机进行整体监控。 可 选的, 处理器 180可包括一个或多个处理核心; 优选的, 处理器 180可集成应用处理器和 调制解调处理器, 其中, 应用处理器主要处理操作系统、 用户界面和应用程序等, 调制解 调处理器主要处理无线通信。可以理解的是, 上述调制解调处理器也可以不集成到处理器 180中。  The processor 180 is the control center of the terminal device 400, which connects various portions of the entire handset using various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120. The various functions and processing data of the terminal device 400 are executed to perform overall monitoring of the mobile phone. Optionally, the processor 180 may include one or more processing cores. Preferably, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 180.
终端设备 400还包括给各个部件供电的电源 190 (比如电池) , 优选的, 电源可以通 过电源管理系统与处理器 180逻辑相连, 从而通过电源管理系统实现管理充电、 放电、 以 及功耗管理等功能。电源 190还可以包括一个或一个以上的直流或交流电源、再充电系统、 电源故障检测电路、 电源转换器或者逆变器、 电源状态指示器等任意组件。  The terminal device 400 further includes a power source 190 (such as a battery) for supplying power to the various components. Preferably, the power source can be logically connected to the processor 180 through the power management system to manage functions such as charging, discharging, and power management through the power management system. . Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
尽管未示出, 终端设备 400还可以包括摄像头、 蓝牙模块等, 在此不再赘述。 具体在 本实施例中, 终端设备的显示单元是触摸屏显示器, 终端设备还包括有存储器, 以及一个 或者一个以上的程序, 其中一个或者一个以上程序存储于存储器中, 且经配置以由一个或 者一个以上处理器执行述一个或者一个以上程序包含用于进行以下操作的指令: 在录音过程中, 获取音频数据流; Although not shown, the terminal device 400 may further include a camera, a Bluetooth module, and the like, and details are not described herein again. Specifically, in this embodiment, the display unit of the terminal device is a touch screen display, the terminal device further includes a memory, and one or more programs, wherein one or more programs are stored in the memory, and are configured to be one or Executing one or more programs by one or more processors includes instructions for performing the following operations: during recording, acquiring an audio data stream;
对获取到的音频数据流按照预设的编码格式进行编码,将编码生成的数据写入音频文 件;  And encoding the obtained audio data stream according to a preset encoding format, and writing the encoded data into the audio file;
从正在写入的音频文件中读取数据;  Reading data from the audio file being written;
将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 可选地, 所述终端的存储器中, 还包含用于执行以下操作的指令:  The data read each time is uploaded to the server, so that the server synchronizes according to the received data. Optionally, the memory of the terminal further includes an instruction for performing the following operations:
根据上一次读取到的数据在所述音频文件中的位置, 更新文件的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的起始点, 继续读取数 据。  Updating the read position of the file according to the position of the last read data in the audio file; the updated read position in the audio file being written is the starting point of the current reading, and continues Read the data.
可选地, 所述终端的存储器中, 还包含用于执行以下操作的指令:  Optionally, the memory of the terminal further includes an instruction for performing the following operations:
录音开始时, 向所述服务器发送上传请求, 使得所述服务器为所述音频文件分配文件 标识;  When the recording starts, sending an upload request to the server, so that the server allocates a file identifier for the audio file;
根据所述服务器分配的文件标识,将每次读取的数据上传至服务器所保存的所述文件 标识对应的音频文件的文件末尾。  According to the file identifier allocated by the server, each read data is uploaded to the end of the file of the audio file corresponding to the file identifier saved by the server.
可选地, 所述终端的存储器中, 还包含用于执行以下操作的指令:  Optionally, the memory of the terminal further includes an instruction for performing the following operations:
当读取到所述音频文件的文件末尾且确定本次录音停止时, 结束数据上传。  When the end of the file of the audio file is read and it is determined that the recording is stopped, the data upload is ended.
可选地, 所述终端的存储器中, 还包含用于执行以下操作的指令:  Optionally, the memory of the terminal further includes an instruction for performing the following operations:
将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。 本公开实施例提供的终端设备, 通过在录制音频文件的同时, 对音频文件中的数据进 行上传, 实现了实时的录音同步, 即能够达到随录随存随上传的效果, 还能够使得在录音 未结束被意外打断或意外删除时,能够根据在服务器上已经进行的同步而最大限度的恢复 录音内容, 保护了音频文件的安全, 提高音频文件的稳定性, 达到数据恢复的目的。  The audio file being written is divided into a plurality of file segments, and the plurality of file segments are separately read. The terminal device provided by the embodiment of the present disclosure realizes real-time recording synchronization by uploading data in the audio file while recording the audio file, that is, the effect of uploading with the record can be achieved, and the recording can be made. When it is accidentally interrupted or accidentally deleted, it can restore the recording content to the maximum extent according to the synchronization already performed on the server, protect the security of the audio file, improve the stability of the audio file, and achieve the purpose of data recovery.
以上所述仅为本公开的较佳实施例, 并不用以限制本公开, 凡在本公开的精神和原则 之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本公开的保护范围之内。  The above description is only the preferred embodiment of the present disclosure, and is not intended to limit the disclosure, and any modifications, equivalents, improvements, etc., made within the spirit and principles of the present disclosure should be included in the protection of the present disclosure. Within the scope.

Claims

权利要求 Rights request
1、 一种录音方法, 其特征在于, 所述方法包括: 1. A recording method, characterized in that the method includes:
在录音过程中, 获取音频数据流; During the recording process, obtain the audio data stream;
对获取到的音频数据流按照预设的编码格式进行编码,将编码生成的数据写入音频文 件; Encode the obtained audio data stream according to the preset encoding format, and write the data generated by encoding into the audio file;
从正在写入的音频文件中读取数据; Read data from the audio file being written;
将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 The data read each time is uploaded to the server, so that the server synchronizes according to the received data.
2、 根据权利要求 1所述的方法, 其特征在于, 从正在写入的音频文件中读取数据, 包括: 2. The method according to claim 1, characterized in that reading data from the audio file being written includes:
根据上一次读取到的数据在所述音频文件中的位置, 更新文件的已读位置; 以所述正在写入的音频文件中更新后的已读位置为本次读取的起始点, 继续读取数 据。 According to the position of the last read data in the audio file, update the read position of the file; use the updated read position in the audio file being written as the starting point of this reading, continue Read data.
3、 根据权利要求 1所述的方法, 其特征在于, 将每次读取到的数据上传至服务器, 包括: 3. The method according to claim 1, characterized in that uploading each read data to the server includes:
录音开始时, 向所述服务器发送上传请求,使得所述服务器为所述音频文件分配文件 标识; When recording starts, send an upload request to the server, causing the server to assign a file identification to the audio file;
根据所述服务器分配的文件标识,将每次读取的数据上传至服务器所保存的所述文件 标识对应的音频文件的文件末尾。 According to the file identification assigned by the server, the data read each time is uploaded to the end of the audio file corresponding to the file identification saved by the server.
4、 根据权利要求 1所述的方法, 其特征在于, 将每次读取到的数据上传至服务器之 后, 所述方法还包括: 4. The method according to claim 1, characterized in that after each read data is uploaded to the server, the method further includes:
当读取到所述音频文件的文件末尾且确定本次录音停止时, 结束数据上传。 When the end of the audio file is read and it is determined that the current recording has stopped, the data upload is completed.
5、 根据权利要求 1所述的方法, 其特征在于, 从正在写入的音频文件中读取数据包 括- 将所述正在写入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。 5. The method according to claim 1, characterized in that, reading data from the audio file being written includes - dividing the audio file being written into a plurality of file fragments, and dividing the plurality of file fragments into Read separately.
6、 一种录音同步装置, 其特征在于, 所述装置包括: 6. A recording synchronization device, characterized in that the device includes:
音频数据流获取模块, 用于在录音过程中, 获取音频数据流; The audio data stream acquisition module is used to obtain the audio data stream during the recording process;
写入模块,用于对获取到的音频数据流按照预设的编码格式进行编码,将编码生成的 数据写入音频文件; The writing module is used to encode the obtained audio data stream according to the preset encoding format, and write the data generated by encoding into the audio file;
数据读取模块, 用于从正在写入的音频文件中读取数据; Data reading module, used to read data from the audio file being written;
上传模块,用于将每次读取到的数据上传至服务器,使得所述服务器根据接收到数据 进行同步。 The upload module is used to upload the data read each time to the server, so that the server can synchronize according to the received data.
7、 根据权利要求 6所述的装置, 其特征在于, 所述数据读取模块用于根据上一次读 取到的数据在所述音频文件中的位置,更新文件的已读位置; 以所述正在写入的音频文件 中更新后的已读位置为本次读取的起始点, 继续读取数据。 7. The device according to claim 6, wherein the data reading module is configured to update the read position of the file according to the position of the last read data in the audio file; The updated read position in the audio file being written is the starting point of this reading, and the data continues to be read.
8、 根据权利要求 6所述的装置, 其特征在于, 所述上传模块用于录音开始时, 向所 述服务器发送上传请求,使得所述服务器为所述音频文件分配文件标识;根据所述服务器 分配的文件标识,将每次读取的数据上传至服务器所保存的所述文件标识对应的音频文件 的文件末尾。 8. The device according to claim 6, characterized in that the upload module is used to send the The server sends an upload request, causing the server to assign a file identifier to the audio file; according to the file identifier assigned by the server, the data read each time is uploaded to the audio file corresponding to the file identifier saved by the server. End of file.
9、 根据权利要求 6所述的装置, 其特征在于, 所述上传模块还用于当读取到所述音 频文件的文件末尾且确定本次录音停止时, 结束数据上传。 9. The device according to claim 6, wherein the upload module is also configured to end the data upload when the end of the audio file is read and it is determined that the current recording has stopped.
10、根据权利要求 6所述的装置, 其特征在于, 所述数据读取模块用于将所述正在写 入的音频文件分成多个文件片段, 对所述多个文件片段进行分别读取。 10. The device according to claim 6, wherein the data reading module is configured to divide the audio file being written into multiple file segments, and read the multiple file segments respectively.
11、 一种终端设备, 其特征在于, 终端设备包括有存储器, 以及一个或者一个以上的 程序,其中一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理 器执行述一个或者一个以上程序包含用于进行以下操作的指令: 11. A terminal device, characterized in that the terminal device includes a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors. Or more than one program contains instructions for:
在录音过程中, 获取音频数据流; During the recording process, obtain the audio data stream;
对获取到的音频数据流进行编码, 将编码生成的数据写入音频文件; Encode the obtained audio data stream and write the data generated by encoding into the audio file;
从正在写入的音频文件中读取数据; Read data from the audio file being written;
将每次读取到的数据上传至服务器, 使得所述服务器根据接收到数据进行同步。 The data read each time is uploaded to the server, so that the server synchronizes according to the received data.
PCT/CN2014/076199 2013-05-29 2014-04-25 Sound recording synchronization method, apparatus, and device WO2014190830A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2013102070771A CN103269374A (en) 2013-05-29 2013-05-29 Method, device and equipment for recording synchronization
CN201310207077.1 2013-05-29

Publications (1)

Publication Number Publication Date
WO2014190830A1 true WO2014190830A1 (en) 2014-12-04

Family

ID=49012983

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/076199 WO2014190830A1 (en) 2013-05-29 2014-04-25 Sound recording synchronization method, apparatus, and device

Country Status (2)

Country Link
CN (1) CN103269374A (en)
WO (1) WO2014190830A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103269374A (en) * 2013-05-29 2013-08-28 北京小米科技有限责任公司 Method, device and equipment for recording synchronization
CN103617099B (en) * 2013-12-10 2016-01-06 焦点科技股份有限公司 A kind of real-time user file content auditing method and system
CN105450944A (en) * 2015-11-13 2016-03-30 北京自由坊科技有限责任公司 Method and device for synchronously recording and reproducing slides and live presentation speech
CN105472039B (en) * 2016-01-05 2019-04-12 珠海格力电器股份有限公司 Recording synchronous method and device
CN106202324B (en) * 2016-06-30 2020-10-30 北京奇虎科技有限公司 Data processing method and device for real-time computing platform
CN106878444B (en) * 2017-03-08 2019-08-20 深圳市八圈科技有限公司 Terminal, host equipment, computer readable storage medium and data processing method
CN109119100A (en) * 2017-06-26 2019-01-01 北京嘀嘀无限科技发展有限公司 The storage method of audio data or video data, storage system and computer equipment
CN209747122U (en) * 2019-05-23 2019-12-06 新中音私人有限公司 Portable digital recorder
CN111583941B (en) * 2020-05-07 2024-01-16 珠海格力电器股份有限公司 Household appliance recording method and device, storage medium and household appliance
CN112908307A (en) * 2021-01-29 2021-06-04 云从科技集团股份有限公司 Audio feature extraction method, system, device and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641748A (en) * 2004-01-06 2005-07-20 华为技术有限公司 Voice data storage method
CN102291401A (en) * 2011-08-09 2011-12-21 百度在线网络技术(北京)有限公司 Method, client and system for transmitting stream data in wireless application protocol (WAP) environment
CN103269374A (en) * 2013-05-29 2013-08-28 北京小米科技有限责任公司 Method, device and equipment for recording synchronization

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098304A (en) * 2011-01-25 2011-06-15 北京天纵网联科技有限公司 Method for simultaneously recording and uploading audio/video of mobile phone

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641748A (en) * 2004-01-06 2005-07-20 华为技术有限公司 Voice data storage method
CN102291401A (en) * 2011-08-09 2011-12-21 百度在线网络技术(北京)有限公司 Method, client and system for transmitting stream data in wireless application protocol (WAP) environment
CN103269374A (en) * 2013-05-29 2013-08-28 北京小米科技有限责任公司 Method, device and equipment for recording synchronization

Also Published As

Publication number Publication date
CN103269374A (en) 2013-08-28

Similar Documents

Publication Publication Date Title
WO2014190830A1 (en) Sound recording synchronization method, apparatus, and device
WO2017202348A1 (en) Video playing method and device, and computer storage medium
WO2018049897A1 (en) Data backup method and device
US9760998B2 (en) Video processing method and apparatus
WO2018049912A1 (en) Data transmission method and related devices
WO2017215660A1 (en) Scene sound effect control method, and electronic device
CN106649735B (en) Method and device for recording log data
EP3429176B1 (en) Scenario-based sound effect control method and electronic device
WO2018049971A1 (en) Hotspot network switching method and terminals
WO2018049894A1 (en) Data transmission method and device
US10463965B2 (en) Control method of scene sound effect and related products
WO2018049905A1 (en) Data migration method and related devices
BR112016018783B1 (en) METHOD, APPARATUS, DEVICE AND INTERCOMMUNICATION SYSTEM
WO2018049904A1 (en) Data migration method and related devices
WO2018006841A1 (en) Qr code information transmission method, device and apparatus
WO2018049921A1 (en) Data transmission processing method and related device
WO2017096909A1 (en) Data connection establishing method and apparatus
US9781380B2 (en) Method, apparatus and terminal for playing multimedia content
WO2016192511A1 (en) Method and apparatus for remotely deleting information
CN110688051B (en) Screen recording operation method and device, computer readable storage medium and terminal
WO2018049969A1 (en) Hotspot establishment method and related device
WO2018049902A1 (en) Data migration method and relevant device
WO2018049901A1 (en) Data migration method and related devices
WO2017000495A1 (en) Method and device for adding contacts
KR101876394B1 (en) Method and device for playing media data on a terminal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14804841

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14804841

Country of ref document: EP

Kind code of ref document: A1