Audio data uploading method and device
By caching and uploading audio stream data in segments during recording, the problem of uploading the entire audio stream data at the end of recording in the prior art is solved, and the effect of shortening user waiting time and improving the success rate of data upload is achieved.
Patent Information
- Application Number
- CN202411884994.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art requires uploading audio stream data for the entire recording process at the end of recording, resulting in a long wait time for the user and affecting the user experience. The data upload process is greatly affected by network jitter and has a low success rate.
Real-time audio stream data is cached during recording, and upload unuploaded data segments to the server when specific conditions are met (such as the data segment size or recording duration reaches a preset value). Only the remaining unuploaded data segments are uploaded at the end of recording.
It shortens the waiting time for users, improves the user experience, and reduces the impact of network jitter on data upload through segmented uploads, and improves the success rate.
Smart Images

Figure CN119814821A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to the field of data processing technology, and more particularly to a method and device for uploading audio data. Background Art
[0002] Nowadays, the recording function has become one of the common functions of the client. The user can use the recording function of the client to record and obtain the recorded audio data. In addition, the client can interact with the server and upload the recorded audio data to the server. Summary of the invention
[0003] The present invention provides a method and device for uploading audio data.
[0004] In a first aspect, an embodiment of the present disclosure provides an audio data uploading method, which is applied to a client and includes:
[0005] In response to the recording being started, buffering the real-time audio stream data generated during the recording process;
[0006] If the data upload conditions are met during the recording process, the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process are uploaded to the server;
[0007] In response to the end of recording, the remaining data segments in the cached audio stream data that have not been uploaded and the target recording identifier are uploaded to the server, and a recording end notification carrying the target recording identifier is sent to the server.
[0008] In a second aspect, the embodiment of the present disclosure provides another method for uploading audio data, which is applied to a server and includes:
[0009] Receive audio data segments uploaded by the client multiple times and a target recording identifier corresponding to the recording process, wherein the audio data segment is: a data segment that is not uploaded in the audio stream data generated in the recording process and cached when the client determines that a data upload condition is met or the recording is finished during the recording process;
[0010] In response to receiving a recording end notification sent by the client and carrying the target recording identifier, an audio file containing each target data segment generated according to the audio timestamp in the target data segment is obtained, wherein the target data segment is: the data segment in the received audio data segment corresponding to the target recording identifier.
[0011] In a third aspect, an embodiment of the present disclosure provides an audio data uploading device, which is applied to a client and includes:
[0012] A data caching module, for caching the real-time audio stream data generated during the recording process in response to the recording starting;
[0013] A first uploading module, configured to upload to the server the data segments that have not been uploaded in the cached audio stream data and the target recording identifier corresponding to the recording process if the data uploading condition is met during the recording process;
[0014] The second uploading module is used to upload the remaining unuploaded data segments in the cached audio stream data and the target recording identifier to the server in response to the end of recording, and send a recording end notification carrying the target recording identifier to the server.
[0015] In a fourth aspect, an embodiment of the present disclosure provides an audio data uploading device, which is applied to a server and includes:
[0016] A data receiving module is used to receive audio data segments uploaded by the client multiple times and a target recording identifier corresponding to the recording process, wherein the audio data segment is: a data segment that is not uploaded in the audio stream data generated in the recording process when the client determines that the data upload condition is met or the recording is finished, and the data segment has been cached during the recording process;
[0017] The file acquisition module is used to obtain an audio file containing each target data segment generated according to the audio timestamp in the target data segment in response to receiving a recording end notification sent by the client and carrying the target recording identifier, wherein the target data segment is: a data segment corresponding to the target recording identifier in the received audio data segment.
[0018] In a fifth aspect, an embodiment of the present disclosure provides a client, including:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0022] In a sixth aspect, an embodiment of the present disclosure provides a server, including:
[0023] at least one processor; and
[0024] a memory communicatively connected to the at least one processor; wherein,
[0025] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the second aspect.
[0026] In a seventh aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the method described in the first or second aspect above.
[0027] In an eighth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method described in the first or second aspect when executed by a processor.
[0028] From the above, it can be seen that when uploading audio data using the solution provided by the embodiment of the present disclosure, if the client meets the data uploading conditions during the recording process, it can upload the data segments in the cached data to the server. In this way, at the end of the recording, it is only necessary to upload the remaining data segments in the cached audio stream data that have not been uploaded to the server. There is no need to upload the audio stream data of the entire recording process at the end of the recording, which can greatly shorten the user's waiting time and improve the user experience.
[0029] Furthermore, since the client uploads only a small segment of the audio stream data of the entire recording process to the server each time, it can be understood that the client uploads the audio stream data in segments. Therefore, the audio data uploading process is less affected by network jitter, thereby improving the success rate of data uploading.
[0030] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0032] Figure 1 A flowchart of a first method for uploading audio data provided by an embodiment of the present disclosure;
[0033] Figure 2 A schematic diagram of audio stream data provided by an embodiment of the present disclosure;
[0034] Figure 3 A flowchart of a second method for uploading audio data provided by an embodiment of the present disclosure;
[0035] Figure 4 A schematic diagram of the structure of a first audio data uploading device provided in an embodiment of the present disclosure;
[0036] Figure 5 A schematic diagram of the structure of a second audio data uploading device provided in an embodiment of the present disclosure;
[0037] Figure 6 It is a block diagram of an electronic device used to implement the audio data uploading method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0039] In the existing solution for uploading the audio data obtained by recording, after the user clicks to end the recording, the client uploads the complete recorded audio data to the server.
[0040] The time from when the user clicks on the end of recording to when the complete audio stream data is uploaded can be considered as the waiting time for the user to complete the recording upload. Since the existing solution uploads the audio data only after the user clicks on the end of recording, and the audio data of the entire recording process needs to be uploaded, the uploaded audio data is large. Therefore, the upload time is long, which will cause the user's waiting time to be long and affect the user experience.
[0041] Furthermore, when uploading a large amount of data, the data upload process is greatly affected by network jitter, which may lead to data upload failure. Therefore, the upload success rate of the existing solution is low.
[0042] In order to solve the above technical problems, the embodiments of the present disclosure provide a method and device for uploading audio data, which will be introduced one by one through specific embodiments below.
[0043] See also Figure 1 , Figure 1 This is a flow chart of a first method for uploading audio data provided in an embodiment of the present disclosure. In this embodiment, the method is applied to a client and includes the following steps S101-S103.
[0044] Step S101: In response to the start of recording, real-time audio stream data generated during the recording process is cached.
[0045] The user can use the recording function of the client to record. When the user clicks to start recording, that is, when the user starts recording, the client can respond to the recording start and cache the real-time audio stream data generated during the recording process.
[0046] In addition, the user can also record audio through recording devices such as recording pens and recorders, and the above-mentioned client can be a mobile phone, tablet computer, etc. In this case, the recording device can interact with the client, and when the user starts recording on the recording device, the recording device can notify the client user to start recording. At this time, the client can respond to the recording start, obtain the real-time audio stream data generated by the recording device during the recording process, and cache the obtained audio stream data.
[0047] For the above-mentioned real-time audio stream data, the client or recording device has a microphone for collecting sound data. The above-mentioned real-time audio stream data can be the sound data collected by the microphone, or the above-mentioned real-time audio stream data can be audio data in a preset format obtained by compressing the sound data collected by the microphone.
[0048] For example, the above-mentioned preset format may be MP3 (Moving Picture Experts Group Audio LayerIII), WAV (Wavefirm audio file format), and the like.
[0049] When the real-time audio stream data is audio data of a preset format obtained by compressing the sound data collected by a microphone, the data size can be reduced through compression, so that subsequent processing of the audio stream data can reduce the workload of data processing and improve upload efficiency.
[0050] Specifically, recording is a continuous process. During this process, the client or the recording device continuously generates audio stream data. Therefore, the client caches the audio stream data continuously. That is, each time the client generates or obtains audio stream data, it caches the generated or obtained audio stream data.
[0051] Step S102: if the data upload condition is met during the recording process, the data segments that have not been uploaded in the cached audio stream data and the target recording identifier corresponding to the recording process are uploaded to the server.
[0052] The target recording identifier may be an identifier generated for the current recording process of the client, and is used to represent the current recording process of the client.
[0053] Since the server can interact with multiple clients and the same client can perform multiple recordings, in order to enable the server to accurately identify which client uploaded the uploaded data segment and the recording process in which the uploaded data segment originated, each time each client uploads a data segment, it can simultaneously upload the client that represents the source of the uploaded data segment and the recording identifier of the recording process in which the uploaded data segment is located.
[0054] For an introduction to the above data uploading conditions, please refer to the subsequent embodiments, which will not be described in detail here.
[0055] The following is an explanation of what the client does during the recording process.
[0056] During the recording process, the client can continuously cache the real-time audio stream data generated during the recording process, and can periodically or in real time detect whether the client meets the data upload conditions.
[0057] From the moment the client responds to the start of recording, the client begins to cache the audio stream data and starts to detect whether it meets the data upload conditions. As the recording continues, when the client detects for the first time that it meets the data upload conditions, this moment is called the first moment. At the first moment, the client caches the audio stream data from the start moment to the first moment, and the client does not upload the audio stream data for this time period. Therefore, the client can send the audio stream data for this time period to the server.
[0058] During the data sending process, the recording is still going on, and the client is still caching the audio stream data and detecting whether the data upload conditions are met. As the recording continues, when the client detects again that it meets the data upload conditions, this moment is called the second moment. At the second moment, the client caches the audio stream data from the startup moment to the second moment, and, in the audio stream data, the audio stream data from the startup moment to the first moment has been uploaded, and the audio stream data from the first moment to the second moment has not yet been uploaded. Therefore, the client can send the audio stream data from the first moment to the second moment to the server.
[0059] Similarly, when the client detects for the third time that it meets the data upload condition, this moment is called the third moment. At the third moment, the client can send the audio stream data of the time period from the second moment to the third moment to the server.
[0060] Therefore, when the client detects for the first time that it meets the data upload conditions, the data segment that has not been uploaded in the audio stream data cached by the client is the entire data segment cached at that time. The client can upload all the cached audio stream data and the target recording identifier to the server.
[0061] When the client detects that it meets the data upload conditions for another time, in the audio stream data cached by the client, the data segments that have not been uploaded are the data segments of the time period from the last time it was detected that the data upload conditions were met to the time when the data upload conditions were detected this time. The client can upload the data segments of this time period and the target recording identifier to the server.
[0062] Step S103: In response to the end of recording, the remaining data segments in the cached audio stream data that have not been uploaded and the target recording identifier are uploaded to the server, and a recording end notification carrying the target recording identifier is sent to the server.
[0063] When the user clicks on the end of recording, the client can respond to the end of recording and call this moment the end moment. At the end moment, the client caches the audio stream data of the time period from the start moment to the end moment, and, in the audio stream data, the data segment of the time period from the start moment to the target moment (the target moment is the moment closest to the end moment and the client detects that the data upload conditions are met) has been uploaded, and the remaining data segment that has not been uploaded is the data segment of the time period from the target moment to the end moment. Therefore, the client can send the data segment of the time period from the target moment to the end moment to the server at the end moment.
[0064] In addition, the client can simultaneously send a recording end notification to the server when uploading the remaining data segments that have not been uploaded and the target recording identifier to the server to notify the server that the recording has ended; or the client can send a recording end notification to the server after uploading the remaining data segments that have not been uploaded and the target recording identifier to the server.
[0065] See also Figure 2 , showing the audio stream data obtained by the client cache recording. Figure 2 In the example, the client starts recording at time t0 and at time t n End recording at time t1-t n-1 These n-1 moments are all moments when the client detects that the data upload conditions are met.
[0066] Combine the following Figure 2 , and introduce the recording process.
[0067] The client starts recording at t0. When the time reaches t1, the client detects that the data upload condition is met. At this time, the client has cached the data segment that has not been uploaded as data segment 1. The client uploads data segment 1 and the target recording identifier to the server. When the time reaches t2, the client detects that the data upload condition is met. The client has cached the data segment that has not been uploaded as data segment 2. The client uploads data segment 2 and the target recording identifier to the server. After t2-t n-1During this time period, the client also uploads the unuploaded data segments and target recording identifiers to the server every time the detection meets the data upload conditions. n At time , the client ends recording. At this time, the data segment that has not been uploaded is data segment n. Therefore, the client uploads data segment n and the target data segment to the server, and the client also sends a recording end notification carrying the target recording identifier to the server.
[0068] From the above, it can be seen that when uploading audio data using the solution provided by the embodiment of the present disclosure, if the client meets the data uploading conditions during the recording process, it can upload the data segments in the cached data to the server. In this way, at the end of the recording, it is only necessary to upload the remaining data segments in the cached audio stream data that have not been uploaded to the server. There is no need to upload the audio stream data of the entire recording process at the end of the recording, which can greatly shorten the user's waiting time and improve the user experience.
[0069] Furthermore, since the client uploads only a small segment of the audio stream data of the entire recording process to the server each time, it can be understood that the client uploads the audio stream data in segments. Therefore, the audio data uploading process is less affected by network jitter, thereby improving the success rate of data uploading.
[0070] In one embodiment of the present disclosure, after the client uploads all the complete audio stream data of the recording process to the server, the server can also perform audio processing on the complete audio stream data to obtain an audio processing result, and the server can feed back the audio processing result to the client. After receiving the audio data result, the client can display the audio processing result for the user to view.
[0071] For example, the server can perform audio-to-text processing on the complete audio stream data to obtain the text of the complete audio stream data, so that the client can obtain and display the text of the complete audio stream data.
[0072] For another example, the server can perform sound processing on the complete audio stream data to achieve the effect of voice change, so that the client can obtain and play the audio stream data after the voice change.
[0073] Since the faster the client uploads audio data, the faster the server feeds back the audio processing results, and thus the faster the client displays the audio processing results, the audio data uploading scheme provided by the embodiment of the present disclosure can just significantly shorten the time from when the user clicks on the end of recording to when the complete audio stream data is uploaded, that is, significantly shorten the user's waiting time. Therefore, applying the audio data uploading scheme provided by the embodiment of the present disclosure can also significantly shorten the time from when the user clicks on the end of recording to when the user views the audio processing results of the recording. In this way, the user can quickly view the audio processing results of the recording, thereby improving the user experience.
[0074] The data uploading conditions mentioned in the aforementioned step S102 are introduced below.
[0075] In one embodiment of the present disclosure, the above data upload condition includes at least one of the following conditions:
[0076] The first condition: the size of the data segment that has not been uploaded in the cached audio stream data is greater than or equal to the preset size.
[0077] The second condition: the recording duration corresponding to the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the first preset duration.
[0078] The third condition: the time interval between the upload time of the last uploaded data is greater than or equal to the second preset time length.
[0079] These three conditions are introduced below.
[0080] For the first condition mentioned above, the preset size is a pre-set data size, such as 4mb, 0.5mb, etc.
[0081] Whenever the size of the data segment that has not been uploaded in the audio stream data cached by the client reaches a preset size, it means that the client meets the first condition.
[0082] For the second condition mentioned above, the first preset time length is a preset time length, such as 0.5s, 1s, etc.
[0083] During the recording process, the user may pause the recording and then continue the recording after a period of time. The above recording duration can be understood as the actual recording duration. For example, if the user clicks to start recording 1 second later, then pauses the recording, and then continues the recording after 2 seconds, and then ends the recording after 3 seconds, during this process, the recording duration of the audio stream data obtained by the client is 1+3=4s.
[0084] Therefore, whenever the recording duration corresponding to the data segment that has not been uploaded in the audio stream data cached by the client reaches the first preset duration, it means that the client meets the second condition.
[0085] For the third condition, the second preset duration is a preset duration, such as 1s, 2s, etc.
[0086] Each time the client uploads a data segment and a target recording identifier, it can record the time of uploading the data. When the client is detecting whether it meets the data uploading conditions, it can detect whether the time interval between the time of the last data upload and the time of the detection is greater than or equal to a second preset duration. If the time interval is greater than or equal to the second preset duration, the client meets the third condition.
[0087] The following introduces the above data upload conditions in combination with the above three conditions.
[0088] The above data upload conditions may include one or more of the above three conditions. In the case of including multiple conditions, only when the client meets all the conditions included in the data upload conditions can it be considered that the client meets the data upload conditions.
[0089] For example, when the data upload conditions include the first and second conditions, it can be determined that the client meets the data upload conditions only when the size of the unuploaded data segment in the audio stream data cached by the client is greater than or equal to the preset size, and the recording duration corresponding to the unuploaded data segment is greater than or equal to the first preset duration.
[0090] As can be seen from the above, when the scheme provided by the embodiment of the present disclosure is applied to upload audio data, the data upload condition can include at least one of the above three conditions. The user can flexibly combine the above three conditions to form the data upload condition according to their own needs, thereby using the data upload condition to achieve the purpose of uploading audio data. It can be seen that the audio data uploading scheme provided by the embodiment of the present disclosure can be flexibly adjusted according to user needs, thereby improving the flexibility of audio data uploading and improving the user experience.
[0091] When uploading data, the client may upload the unuploaded data segments in the cached audio stream data and the target recording identifier in the manner mentioned in the following embodiments.
[0092] In one embodiment of the present disclosure, when the client detects that it meets the data uploading conditions, it can determine the first number of first tasks that are in an unfinished state in the tasks for uploading data segments; if the first number is less than the preset number of tasks, the idle process is called to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server.
[0093] The preset task number is the maximum number of data upload tasks that are preset and support parallel execution. For example, the preset task number may be 5, indicating that the client can execute up to 5 data upload tasks in parallel.
[0094] The above data upload task is: when the client meets the data upload conditions, it uploads the unuploaded data segments in the cached audio stream data and the target recording identifier.
[0095] For example, when the number of preset tasks is 2, that is, the client can execute at most 2 data upload tasks in parallel, if the client detects that the data upload condition is met at the third second of the recording, it will execute a data upload task. If the client detects that the data upload condition is met again at the sixth second of the recording, and the previous data upload task is still being executed at the sixth second and has not yet ended, the data upload task corresponding to the sixth second can be executed in parallel with the data upload task corresponding to the third second. If the client detects that the data upload condition is met again at the ninth second of the recording, and the first two data upload tasks have not yet ended, since the client only supports the execution of two data upload tasks in parallel at most, the data upload task corresponding to the ninth second needs to wait until one of the first two tasks is completed before it can be executed.
[0096] Specifically, the first number may be determined by any one of the following two implementation methods.
[0097] In the first implementation, each time the client detects that the data upload condition is met, a data upload task may be generated and the status of the data upload task may be maintained. The task status may include an unfinished state and a finished state. The unfinished state indicates that the data in the task is waiting to be uploaded or is being uploaded, and the finished state indicates that the data in the task has been uploaded. In this way, when determining the first quantity, the number of data upload tasks in the unfinished state may be counted to obtain the counted number as the first quantity.
[0098] In the second implementation, a preset number of upload processes can be created in the client, and each process can be used to execute a single data upload task, upload a data segment and a target recording identifier. When determining the first number, the number of upload processes in operation can be counted to obtain the counted number as the first number.
[0099] After determining the first number, the first number can be compared with the preset task number. If the first number is smaller than the preset task number, it means that the client has not reached the upper limit of parallel execution of data upload tasks. At this time, the idle process can be called to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server.
[0100] From the above, it can be seen that when the solution provided by the embodiment of the present disclosure is used to upload audio data, the first number is the number of tasks in an unfinished state in the tasks for uploading data segments. When this number is less than the preset number of tasks, the idle process can be called to upload data. It can be seen that the audio data uploading solution provided by the embodiment of the present disclosure supports the parallel execution of multiple data upload tasks, which can improve the data upload efficiency.
[0101] On the basis of the above embodiment, if the first number is equal to the preset number of tasks, the method provided in the following embodiment can be executed.
[0102] In one embodiment of the present disclosure, if the first number is equal to the preset number of tasks, the second task whose status is switched to the ended state in the first task is monitored; in response to monitoring the second task, a process is called from the process released from the second task to upload the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server.
[0103] Specifically, if the first number is equal to the preset number of tasks, it means that the client has reached the upper limit of the parallel execution of data upload tasks. At this time, it is necessary to wait for the first task to be completed and monitor the second task whose status in the first task switches to the ended state. For example, the status of each first task can be periodically traversed to monitor whether the status of the first task switches from the unfinished state to the ended state.
[0104] When the second task is monitored, that is, when the status of one or more tasks in the first task is monitored to switch from an unfinished state to a finished state, it means that the first task has been executed at this time. In this way, the first number of first tasks in the unfinished state is less than the preset number of tasks, so that the client can call one or more processes from each process released by each second task in the finished state to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0105] As can be seen from the above, when the scheme provided by the embodiment of the present disclosure is applied to upload audio data, the first number is equal to the preset number of tasks, indicating that the client has reached the upper limit of the parallel execution of data upload tasks. At this time, the client will call the process released by the second task to upload data only when it detects that the state of the second task in the first task switches to the ended state. In this way, the number of data upload tasks executed in parallel can be limited by using the preset number of tasks, thereby avoiding excessive client resource usage due to too many data upload tasks executed in parallel, affecting the normal operation of other processes on the client. Therefore, the audio data upload scheme provided by the embodiment of the present disclosure can ensure that all processes on the client can operate normally, ensuring that users can use the client smoothly.
[0106] When calling the process released by the second task to upload data, the data can be uploaded in any of the following two implementation modes.
[0107] In a first implementation manner, based on the second quantity of the second task, a process released from the second task can be called to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0108] Specifically, after the client detects the second task, it can count the second number of the second task, and based on the number of the second task, determine the number of processes to be called and the amount of data uploaded by each process from the processes released by the second task, so that according to the two determined numbers, the calling process uploads the unuploaded data segments and target recording identifiers in the cached audio stream data to the server. It can be seen that based on the number of the second task, the process can be reasonably allocated and managed, so as to upload the data segments and target recording identifiers as quickly as possible, thereby improving the efficiency of uploading audio data.
[0109] For each called process, when each process is called to upload data, the data uploaded by each process may carry the target recording identifier.
[0110] The specific method of calling the process to upload data based on the second quantity of the second task can be found in the subsequent embodiments and will not be described in detail here.
[0111] In the second implementation, after the client detects the second task, it can select any process from the processes released by the second tasks, and call the process to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0112] Two specific implementation methods of calling a process to upload data based on the second quantity of the second task are described below.
[0113] In the first implementation method, when the second number is greater than 1, the multiple of the data amount of the data segments in the cached audio stream data that have not been uploaded relative to the preset data amount can be calculated; if the multiple is greater than or equal to the second number, the average data amount of the data segments in the cached audio stream data that have not been uploaded relative to the second number is calculated, and each process released by the second task is called to upload the average data amount of the data segments in the cached audio stream data and the target recording identifier to the server; if the multiple is less than the second number, from the processes released by the second task, multiple processes are called to upload the preset data amount of the data segments in the cached audio stream data and the target recording identifier to the server.
[0114] The preset data volume is a pre-set data volume, such as 0.1 mb, 0.2 mb, etc.
[0115] The above-mentioned preset data amount can be understood as the ideal value of the data amount uploaded by a process at one time. If the client calls a process to upload data, if the data amount of the uploaded data is the preset data amount, the upload effect of the process will be best. If the data amount of the uploaded data is higher than the preset data amount, the upload effect of the process will be reduced.
[0116] If the second number is greater than 1, it means that the client has monitored multiple second tasks and there are multiple processes released from the second task. In this case, the client can call one or more of the processes to upload data. The more processes called, the less data each process needs to upload. Moreover, when calling each process to upload data, the data uploaded by each process carries the target recording identifier.
[0117] Specifically, when the second number is greater than 1, the client can calculate the multiple of the data amount of the data segments that have not been uploaded in the cached audio stream data relative to the preset data amount. The multiple can be understood as: on the premise of determining that each process uploads the preset data amount, the number of processes required to upload the data amount of the data segments that have not been uploaded. If the multiple is not an integer, the number of processes required is the next integer of the multiple. For example, if the multiple is 4.8, the number of processes required is 5.
[0118] If the multiple is equal to the second quantity, the average data volume is exactly equal to the preset data volume, and each process released from each second task is called to upload data, so that each process can upload the preset data volume.
[0119] If the above multiple is greater than the second amount, it means that even if each process released from each second task is called to upload data, the amount of data that each process needs to upload will exceed the preset data amount. At this time, you can make a second choice and divide the amount of data segments that have not been uploaded in the cached audio stream data by the second amount to get the average data amount. Since the second amount is less than the above multiple, the average data amount is greater than the preset data amount. After calculating the average data amount, call each process released by the second task to upload the average amount of data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server.
[0120] If the above multiple is less than the second number, if the processes released from the second tasks are also called to upload data at this time, the amount of data required to upload by each process is less than the preset data amount, which does not give full play to the upload performance of each process. Therefore, when the above multiple is less than the second number, it is only necessary to call the above multiple processes to upload the preset data amount of the cached audio stream data and the target recording identifier to the server respectively. This can ensure that each process has the above preset data amount of data, thereby giving full play to the upload performance of the called processes and achieving the best upload effect. This can also avoid the waste of resources caused by calling unnecessary processes.
[0121] In this implementation, when the second number is greater than 1, the above-mentioned multiple is calculated, and according to different numerical relationships between the above-mentioned multiple and the second number, different methods are used to upload the unuploaded data segments and target recording identifiers in the cached audio stream data, so that the unuploaded data segments and target recording identifiers can be uploaded as quickly as possible, thereby improving the efficiency of uploading audio data.
[0122] In a second implementation, when the second number is equal to 1, the process released by the second task is called to upload the target data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0123] The target data volume is: the data volume of the data segment that has not been uploaded or the preset data volume.
[0124] The second number is equal to 1, which indicates that the client monitors one second task and there is only one process released from the second task. In this case, the client can call one of the released processes to upload data.
[0125] Specifically, when the target data volume is the data volume of the data segments that have not been uploaded, the client can call the released process to upload all the data segments that have not been uploaded in the cached audio stream data and the target recording identifier.
[0126] When the target data volume is the preset data volume, the client can call the released process to upload the preset data volume of the cached audio stream data, the unuploaded data segments and the target recording identifier. If the data volume of the unuploaded data segments is greater than the preset data volume, then for the data in the unuploaded data other than the preset data volume uploaded, the client can call the process released from the monitored second task to continue uploading these data and the target recording identifier when the second task is subsequently detected.
[0127] In this implementation, when the second number is equal to 1, the process released by the second task is called to upload the target data volume of the cached audio stream data and the target recording identifier to the server. This means that as long as the client detects the emergence of a second task, it immediately calls the process released by the second task to upload data, which can improve the efficiency of data upload.
[0128] Corresponding to the audio data uploading method applied to the client, the embodiment of the present disclosure also provides an audio data uploading method applied to the server.
[0129] In one embodiment of the present disclosure, see Figure 3 , a flow chart of a second method for uploading audio data is provided. In this embodiment, the above method is applied to a server, including the following steps S301-S302.
[0130] Step S301: receiving audio data segments uploaded by the client multiple times and target recording identifiers corresponding to the recording process.
[0131] The audio data segment is: the data segment that is not uploaded in the audio stream data generated during the recording process and cached when the client determines that the data upload conditions are met or the recording is finished during the recording process.
[0132] The description of the audio data segment can be found in the aforementioned embodiment and will not be repeated here.
[0133] Specifically, each time the client detects that the data upload condition is met during the recording process, the client uploads to the server the data segments that have not been uploaded in the cached audio stream data at the moment when the data upload condition is detected to be met, as well as the target recording identifier. Furthermore, when the recording ends, the client can upload to the server the remaining data segments that have not been uploaded in the cached audio stream data at the end of the recording, as well as the target recording identifier, and also send a recording end notification carrying the target recording identifier to the server. In this way, when the server receives the recording end notification, it can determine that the recording process indicated by the target recording identifier has ended based on the target recording identifier carried in the notification, and the audio data segments that have been received multiple times before and uploaded synchronously with the target recording identifier are all the audio data segments of the recording process indicated by the target recording identifier.
[0134] Step S302: in response to receiving a recording end notification sent by the client and carrying a target recording identifier, obtaining an audio file containing each target data segment that is generated according to the audio timestamp in the target data segment.
[0135] The target data segment is: a data segment corresponding to the target recording identifier in the received audio data segment.
[0136] Two implementation methods for obtaining audio files are described below.
[0137] In a first implementation manner, the server may arrange the target data segments in order from earliest to latest audio timestamps in the target data segments; encapsulate the arranged target data segments to generate audio files.
[0138] Specifically, before receiving the recording end notification carrying the target recording identifier, the server can only store the received audio data segment and the target recording identifier each time it receives the audio data segment uploaded by the client and the target recording identifier, and determine that the audio data segment received each time corresponds to the target recording identifier. When the server receives the recording end notification, it can respond to the notification and retrieve the audio data segment corresponding to the target recording identifier from the various audio data segments stored by the server, that is, retrieve the target data segment, and then arrange the target data segments in order from early to late according to the audio timestamps of the target data segments. After the arrangement is completed, the arranged target data segments are packaged to generate an audio file. In this way, the server can obtain a complete recording file of the recording process indicated by the target recording identifier.
[0139] In the second implementation method, each time the server receives the audio data segment uploaded by the client and the target recording identifier, if it is determined that the data segment corresponding to the target recording identifier has been stored, the server will store the audio data segment received each time in the order of the audio timestamps in the audio data segment received each time and the stored data segment from early to late; and encapsulate the data segments stored in the order of the audio timestamps from early to late to generate an audio file.
[0140] Specifically, each time the server receives an audio data segment and a target recording identifier uploaded by the client, it can detect whether there is a data segment corresponding to the target recording identifier in the stored audio data segments.
[0141] If the data segment corresponding to the target recording identifier does not exist in the stored audio data segments, it means that the server has received the data segment in the recording process indicated by the target recording identifier for the first time. At this time, the server can store the received audio data segment and the target recording identifier.
[0142] If there is a data segment corresponding to the target recording identifier in the stored audio data segments, it means that the server has previously received the data segment of the recording process indicated by the target recording identifier. When the server has received and stored the data segment of the recording process indicated by the target recording identifier, each subsequent time the server receives a data segment of the recording process indicated by the target recording identifier, the server stores the received audio data segment in the order of the audio timestamps in the received audio data segment and the stored data segment from early to late. After storing the data segment, the data segments stored in the order of the audio timestamps from early to late are encapsulated to generate an audio file.
[0143] The following further describes the implementation according to the order in which the server receives the audio data segments in the recording process indicated by the target recording identifier. For ease of description, the recording process indicated by the target recording identifier is referred to as the target recording process.
[0144] When the server receives the first audio data segment of the target recording process and the target recording identifier, there is no data segment corresponding to the target recording identifier in the audio data segments stored by the server. Therefore, the server can store the first audio data segment. At this time, the server also stores the data segment corresponding to the target recording identifier. At this time, the server can generate a recording file containing the first audio data segment. Starting from the server receiving the second audio data segment of the target recording process, each time the server receives an audio data segment of the target recording process, it can arrange the received audio data segment at the end of the audio data segment of the target recording process stored in the recording file, and encapsulate it to obtain a new recording file, until the server receives a recording end notification carrying the target recording identifier, at which time the complete audio file of the entire target recording process can be obtained.
[0145] It can be seen from the above that when the solution provided by the embodiment of the present disclosure is used to upload audio data, the audio data segment received by the server is the data segment that has not been uploaded in the audio stream data generated in the cached recording process when the client determines that the data upload conditions are met during the recording process or determines that the recording is finished. It can be seen that the client can upload data synchronously during the recording process. In this way, after the user clicks on the end of recording, the client only needs to upload the remaining data segments that have not been uploaded in the cached audio stream data to the server, and there is no need to upload the audio stream data of the entire recording process at the end of recording, which can greatly shorten the user's waiting time and improve the user experience.
[0146] Furthermore, since the client uploads the target recording identifier each time during the uploading process, the client and the server can cooperate with each other to achieve breakpoint-resume transmission of audio data, thereby improving the convenience and security of data uploading.
[0147] In one embodiment of the present disclosure, after receiving the complete audio stream data of the recording process indicated by the target recording identifier, the server can perform audio processing on the complete audio stream data to obtain an audio processing result, and feed back the audio processing result to the client that sent the target recording identifier.
[0148] Corresponding to the aforementioned audio data uploading method, the embodiment of the present disclosure also provides an audio data uploading device.
[0149] In one embodiment of the present disclosure, see Figure 4, provides a structural diagram of a first audio data uploading device. In this embodiment, the above device is applied to a client, including:
[0150] The data caching module 401 is used to cache the real-time audio stream data generated during the recording process in response to the recording starting;
[0151] The first uploading module 402 is used to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server if the data uploading condition is met during the recording process;
[0152] The second uploading module 403 is used to upload the remaining unuploaded data segments in the cached audio stream data and the target recording identifier to the server in response to the end of recording, and send a recording end notification carrying the target recording identifier to the server.
[0153] From the above, it can be seen that when uploading audio data using the solution provided by the embodiment of the present disclosure, if the client meets the data uploading conditions during the recording process, it can upload the data segments in the cached data to the server. In this way, at the end of the recording, it is only necessary to upload the remaining data segments in the cached audio stream data that have not been uploaded to the server. There is no need to upload the audio stream data of the entire recording process at the end of the recording, which can greatly shorten the user's waiting time and improve the user experience.
[0154] Furthermore, since the client uploads only a small segment of the audio stream data of the entire recording process to the server each time, it can be understood that the client uploads the audio stream data in segments. Therefore, the audio data uploading process is less affected by network jitter, thereby improving the success rate of data uploading.
[0155] In one embodiment of the present disclosure, the data upload condition includes at least one of the following conditions:
[0156] The size of the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the preset size;
[0157] The recording duration corresponding to the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the first preset duration;
[0158] The time interval between the uploading time of the last uploaded data is greater than or equal to the second preset time length.
[0159] As can be seen from the above, when the scheme provided by the embodiment of the present disclosure is applied to upload audio data, the data upload condition can include at least one of the above three conditions. The user can flexibly combine the above three conditions to form the data upload condition according to their own needs, thereby using the data upload condition to achieve the purpose of uploading audio data. It can be seen that the audio data uploading scheme provided by the embodiment of the present disclosure can be flexibly adjusted according to user needs, thereby improving the flexibility of audio data uploading and improving the user experience.
[0160] In one embodiment of the present disclosure, the first uploading module 402 includes:
[0161] A quantity determination submodule, used to determine a first quantity of first tasks in an unfinished state among tasks for uploading data segments;
[0162] The first calling submodule is used to call the idle process to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server if the first number is less than the preset task number.
[0163] From the above, it can be seen that when the solution provided by the embodiment of the present disclosure is used to upload audio data, the first number is the number of tasks in an unfinished state in the tasks for uploading data segments. When this number is less than the preset number of tasks, the idle process can be called to upload data. It can be seen that the audio data uploading solution provided by the embodiment of the present disclosure supports the parallel execution of multiple data upload tasks, which can improve the data upload efficiency.
[0164] In one embodiment of the present disclosure, the above device further includes:
[0165] A detection submodule, configured to monitor a second task in the first task whose state is switched to a finished state if the first number is equal to the preset number of tasks;
[0166] The second calling submodule is used to, in response to monitoring the second task, call a process from a process released by the second task to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0167] As can be seen from the above, when the scheme provided by the embodiment of the present disclosure is applied to upload audio data, the first number is equal to the preset number of tasks, indicating that the client has reached the upper limit of the parallel execution of data upload tasks. At this time, the client will call the process released by the second task to upload data only when it detects that the state of the second task in the first task switches to the ended state. In this way, the number of data upload tasks executed in parallel can be limited by using the preset number of tasks, thereby avoiding excessive client resource usage due to too many data upload tasks executed in parallel, affecting the normal operation of other processes on the client. Therefore, the audio data upload scheme provided by the embodiment of the present disclosure can ensure that all processes on the client can operate normally, ensuring that users can use the client smoothly.
[0168] In one embodiment of the present disclosure, the second calling submodule includes:
[0169] A data uploading unit is used to call a process from a process released by the second task based on the second quantity of the second task to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
[0170] In this solution, based on the number of second tasks, the process can be reasonably allocated and managed, so that the data segments and target recording identifiers can be uploaded as quickly as possible, thereby improving the efficiency of uploading audio data.
[0171] In one embodiment of the present disclosure, the data uploading unit is specifically used to:
[0172] If the second number is greater than 1, calculating a multiple of the amount of data of the data segments that have not been uploaded in the cached audio stream data relative to the preset data amount;
[0173] If the multiple is greater than or equal to the second number, calculating the average data amount of the data segments that have not been uploaded in the cached audio stream data relative to the second number, calling each process released by the second task to upload the average data amount of the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server respectively;
[0174] If the multiple is smaller than the second number, the multiple processes are called from the processes released from the second task to upload the preset data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server respectively.
[0175] In this scheme, when the second number is greater than 1, the above-mentioned multiple is calculated, and according to different numerical relationships between the above-mentioned multiple and the second number, different methods are used to upload the unuploaded data segments and target recording identifiers in the cached audio stream data, so that the unuploaded data segments and target recording identifiers can be uploaded as quickly as possible, thereby improving the efficiency of uploading audio data.
[0176] In one embodiment of the present disclosure, the data uploading unit is specifically used to:
[0177] If the second number is equal to 1, the process released by the second task is called to upload the target data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server, wherein the target data volume is: the data volume of the unuploaded data segments or the preset data volume.
[0178] In this scheme, when the second number is equal to 1, the process released by the second task is called to upload the target data volume of the cached audio stream data and the target recording identifier to the server. This means that as long as the client detects the emergence of a second task, it will immediately call the process released by the second task to upload data, which can improve the efficiency of data upload.
[0179] In one embodiment of the present disclosure, the real-time audio stream data is: audio data in a preset format obtained by compressing sound data collected by a microphone.
[0180] When the real-time audio stream data is audio data of a preset format obtained by compressing the sound data collected by a microphone, the data size can be reduced through compression, so that subsequent processing of the audio stream data can reduce the workload of data processing and improve upload efficiency.
[0181] In one embodiment of the present disclosure, see Figure 5 , a schematic diagram of the structure of a second audio data uploading device is provided. In this embodiment, the above device is applied to a server, including:
[0182] The data receiving module 501 is used to receive the audio data segments uploaded by the client multiple times and the target recording identifier corresponding to the recording process, wherein the audio data segment is: the data segment that has not been uploaded in the audio stream data generated in the recording process when the client determines that the data upload condition is met or the recording is finished, and the data segment that has been cached during the recording process is generated;
[0183] The file acquisition module 502 is used to obtain an audio file containing each target data segment generated according to the audio timestamp in the target data segment in response to receiving a recording end notification sent by the client and carrying the target recording identifier, wherein the target data segment is: a data segment corresponding to the target recording identifier in the received audio data segment.
[0184] It can be seen from the above that when the solution provided by the embodiment of the present disclosure is used to upload audio data, the audio data segment received by the server is the data segment that has not been uploaded in the audio stream data generated in the cached recording process when the client determines that the data upload conditions are met during the recording process or determines that the recording is finished. It can be seen that the client can upload data synchronously during the recording process. In this way, after the user clicks on the end of recording, the client only needs to upload the remaining data segments that have not been uploaded in the cached audio stream data to the server, and there is no need to upload the audio stream data of the entire recording process at the end of recording, which can greatly shorten the user's waiting time and improve the user experience.
[0185] In one embodiment of the present disclosure, the device further includes:
[0186] A data storage module, for storing each received audio data segment in the order of the audio timestamps in the received audio data segment and the stored data segment from early to late, if it is determined that a data segment corresponding to the target recording identifier has been stored after receiving the audio data segment uploaded by the client and the target recording identifier each time;
[0187] The file acquisition module 502 is specifically used for:
[0188] The data segments stored in the order of audio timestamps from early to late are encapsulated to generate an audio file.
[0189] By applying this solution, the server can obtain the complete recording file of the recording process indicated by the target recording identifier.
[0190] In one embodiment of the present disclosure, the file obtaining module 502 is specifically used to:
[0191] Arrange the target data segments in order of the audio timestamps in the target data segments from earliest to latest;
[0192] The arranged target data segments are encapsulated to generate audio files.
[0193] By applying this solution, the server can obtain the complete recording file of the recording process indicated by the target recording identifier.
[0194] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0195] It should be noted that the head model in this embodiment is not a head model for a specific user and cannot reflect the personal information of a specific user.
[0196] It should be noted that the two-dimensional face images in this embodiment come from a public data set.
[0197] According to an embodiment of the present disclosure, the present disclosure also provides a client, a server, a readable storage medium and a computer program product.
[0198] In one embodiment of the present disclosure, a client is provided, including:
[0199] at least one processor; and
[0200] a memory communicatively connected to the at least one processor; wherein,
[0201] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the aforementioned audio data uploading method applied to the client.
[0202] In one embodiment of the present disclosure, a server is provided, including:
[0203] at least one processor; and
[0204] a memory communicatively connected to the at least one processor; wherein,
[0205] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the aforementioned audio data uploading method applied to the server.
[0206] The structural diagram of the above client or server is as follows Figure 6 , Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0207] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0208] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0209] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the audio data upload method. For example, in some embodiments, the audio data upload method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the audio data upload method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the audio data upload method in any other appropriate manner (e.g., by means of firmware).
[0210] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0211] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0212] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0213] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0214] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0215] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0216] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0217] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for uploading audio data, applied to a client, comprising: In response to the recording being started, buffering the real-time audio stream data generated during the recording process; If the data upload conditions are met during the recording process, the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process are uploaded to the server; In response to the end of recording, the remaining data segments in the cached audio stream data that have not been uploaded and the target recording identifier are uploaded to the server, and a recording end notification carrying the target recording identifier is sent to the server.
2. The method according to claim 1, wherein: The data upload condition includes at least one of the following conditions: The size of the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the preset size; The recording duration corresponding to the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the first preset duration; The time interval between the uploading time of the last uploaded data is greater than or equal to the second preset time length.
3. The method according to claim 1 or 2, wherein: The uploading to the server of the data segments that have not been uploaded in the buffered audio stream data and the target recording identifier corresponding to the recording process includes: Determine a first number of first tasks in an unfinished state among the tasks for uploading data segments; If the first number is less than the preset task number, the idle process is called to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server.
4. The method according to claim 3, further comprising: If the first number is equal to the preset number of tasks, monitoring a second task in the first task whose status is switched to a completed status; In response to monitoring the second task, a process released from the second task is called to upload the unuploaded data segments of the cached audio stream data and the target recording identifier to the server.
5. The method according to claim 4, wherein: The calling process in the process released from the second task to upload the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server includes: Based on the second number of the second tasks, a process is called from a process released from the second task to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
6. The method according to claim 5, wherein: The calling process from the process released by the second task based on the second number of the second task to upload the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server includes: If the second number is greater than 1, calculating a multiple of the amount of data of the data segments that have not been uploaded in the cached audio stream data relative to the preset data amount; If the multiple is greater than or equal to the second number, calculating the average data amount of the data segments that have not been uploaded in the cached audio stream data relative to the second number, calling each process released by the second task to upload the average data amount of the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server respectively; If the multiple is smaller than the second number, the multiple processes are called from the processes released from the second task to upload the preset data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server respectively.
7. The method according to claim 5, wherein: The calling process from the process released by the second task based on the second number of the second task to upload the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server includes: If the second number is equal to 1, the process released by the second task is called to upload the target data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server, wherein the target data volume is: the data volume of the unuploaded data segments or the preset data volume.
8. The method according to claim 1 or 2, wherein: The real-time audio stream data is audio data in a preset format obtained by compressing the sound data collected by the microphone.
9. A method for uploading audio data, applied to a server, comprising: Receive audio data segments uploaded by the client multiple times and a target recording identifier corresponding to the recording process, wherein the audio data segment is: a data segment that is not uploaded in the audio stream data generated in the recording process and cached when the client determines that a data upload condition is met or the recording is finished during the recording process; In response to receiving a recording end notification sent by the client and carrying the target recording identifier, an audio file containing each target data segment generated according to the audio timestamp in the target data segment is obtained, wherein the target data segment is: the data segment in the received audio data segment corresponding to the target recording identifier.
10. The method according to claim 9, wherein: The method further comprises: After receiving the audio data segment uploaded by the client and the target recording identifier each time, if it is determined that the data segment corresponding to the target recording identifier has been stored, the audio data segment received each time is stored in the order of the audio timestamps in the audio data segment received each time and the audio timestamps in the stored data segment from early to late; The step of obtaining an audio file generated according to the audio timestamps in the target data segments and containing each target data segment comprises: The data segments stored in the order of audio timestamps from early to late are encapsulated to generate an audio file.
11. The method according to claim 9, wherein: The step of obtaining an audio file generated according to the audio timestamps in the target data segments and containing each target data segment comprises: Arrange the target data segments in order of the audio timestamps in the target data segments from earliest to latest; The arranged target data segments are encapsulated to generate audio files.
12. An audio data uploading device, applied to a client, comprising: A data caching module, for caching the real-time audio stream data generated during the recording process in response to the recording starting; A first uploading module, for uploading to the server the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process if the data uploading condition is met during the recording process; The second uploading module is used to upload the remaining unuploaded data segments in the cached audio stream data and the target recording identifier to the server in response to the end of recording, and send a recording end notification carrying the target recording identifier to the server.
13. The device according to claim 12, wherein: The data upload condition includes at least one of the following conditions: The size of the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the preset size; The recording duration corresponding to the data segment in the cached audio stream data that has not been uploaded is greater than or equal to the first preset duration; The time interval between the uploading time of the last uploaded data is greater than or equal to the second preset time length.
14. The device according to claim 12 or 13, wherein: The first uploading module includes: A quantity determination submodule, used to determine a first quantity of first tasks in an unfinished state among tasks for uploading data segments; The first calling submodule is used to call the idle process to upload the unuploaded data segments in the cached audio stream data and the target recording identifier corresponding to the recording process to the server if the first number is less than the preset task number.
15. The apparatus according to claim 14, further comprising: A detection submodule, configured to monitor a second task in the first task whose state is switched to a finished state if the first number is equal to the preset number of tasks; The second calling submodule is used to, in response to monitoring the second task, call a process from a process released by the second task to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
16. The device according to claim 15, wherein: The second calling submodule includes: A data uploading unit is used to call a process from a process released by the second task based on the second quantity of the second task to upload the unuploaded data segments in the cached audio stream data and the target recording identifier to the server.
17. The device according to claim 16, wherein: The data uploading unit is specifically used for: If the second number is greater than 1, calculating a multiple of the amount of data of the data segments that have not been uploaded in the cached audio stream data relative to the preset data amount; If the multiple is greater than or equal to the second number, calculating the average data amount of the data segments that have not been uploaded in the cached audio stream data relative to the second number, calling each process released by the second task to upload the average data amount of the data segments that have not been uploaded in the cached audio stream data and the target recording identifier to the server respectively; If the multiple is smaller than the second number, the multiple processes are called from the processes released from the second task to upload the preset data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server respectively.
18. The device according to claim 16, wherein: The data uploading unit is specifically used for: If the second number is equal to 1, the process released by the second task is called to upload the target data volume of the unuploaded data segments in the cached audio stream data and the target recording identifier to the server, wherein the target data volume is: the data volume of the unuploaded data segments or the preset data volume.
19. The device according to claim 12 or 13, wherein: The real-time audio stream data is audio data in a preset format obtained by compressing the sound data collected by the microphone.
20. An audio data uploading device, applied to a server, comprising: A data receiving module is used to receive audio data segments uploaded by the client multiple times and a target recording identifier corresponding to the recording process, wherein the audio data segment is: a data segment that is not uploaded in the audio stream data generated in the recording process when the client determines that the data upload condition is met or the recording is finished, and the data segment has been cached during the recording process; The file acquisition module is used to obtain an audio file containing each target data segment generated according to the audio timestamp in the target data segment in response to receiving a recording end notification sent by the client and carrying the target recording identifier, wherein the target data segment is: a data segment corresponding to the target recording identifier in the received audio data segment.
21. The device according to claim 20, wherein: The device also includes: A data storage module, for storing each received audio data segment in the order of the audio timestamps in the received audio data segment and the stored data segment from early to late, if it is determined that a data segment corresponding to the target recording identifier has been stored after receiving the audio data segment uploaded by the client and the target recording identifier each time; The file acquisition module is specifically used for: The data segments stored in the order of audio timestamps from early to late are encapsulated to generate an audio file.
22. The device according to claim 20, wherein: The file acquisition module is specifically used for: Arrange the target data segments in order of the audio timestamps in the target data segments from earliest to latest; The arranged target data segments are encapsulated to generate audio files.
23. A client, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
24. A server, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 9 to 11.
25. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.
26. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.