Scratch audio storage method and device, electronic equipment, program product and medium
By adjusting the audio quality and storage strategy according to the access popularity level of the draft audio, the problem of storage resources occupied by draft audio recorded in karaoke software is solved, and efficient storage resource management and improved user experience are achieved.
Patent Information
- Application Number
- CN202510895630.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-09-30
AI Technical Summary
When users use karaoke software to record draft audio, the storage resources of electronic devices are seriously occupied, which reduces the user experience.
According to the access popularity level of the draft audio, audio files with audio quality corresponding to the current access popularity level are stored, and the storage resource usage is reduced by adjusting audio parameters and compression encoding.
Meet the quality requirements of draft audio with high access popularity, reduce the storage resource usage of draft audio with low access popularity, and improve user experience.
Smart Images

Figure CN120723931A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file storage, and in particular to a method, device, electronic device, program product and medium for storing draft audio. Background Art
[0002] With the rise of karaoke software, more and more users are choosing to install karaoke software on their electronic devices and use it to record their singing works. However, users may use this software to record a large number of draft audios, which will seriously occupy the storage resources of electronic devices and reduce the user experience. Summary of the Invention
[0003] The purpose of the present invention is to provide a storage method, device, electronic device, program product and medium for draft audio, which can store audio files with audio quality corresponding to the current access heat level of the user to the draft audio, thereby reducing the storage resources occupied by the draft audio.
[0004] To solve the above technical problems, the present invention provides a method for storing draft audio, comprising:
[0005] When the detection conditions are met, access records of the target draft audio are obtained;
[0006] Determine the current access popularity level of the target draft audio according to the access record;
[0007] Acquire a target audio file whose audio quality matches the current access popularity level;
[0008] The target audio file is stored as an audio source of the target draft audio.
[0009] Optionally, obtaining a target audio file whose audio quality matches the current access popularity level includes:
[0010] Obtaining the original audio file of the target draft audio;
[0011] The audio parameters of the target draft audio are adjusted down to values that match the current access heat level, and the original audio file is compressed and encoded according to the adjusted audio parameters to obtain the target audio file.
[0012] Optionally, obtaining a target audio file whose audio quality matches the current access popularity level includes:
[0013] Obtaining a stored audio file of the target draft audio;
[0014] When it is determined that the current access heat level is the highest access heat level or the current access heat level is unchanged compared to the historical access heat level of the target draft audio, the stored audio file is used as the target audio file;
[0015] When it is determined that the current access heat level is lower than the historical access heat level of the target draft audio, the audio parameters of the target draft audio are lowered to a value that matches the current access heat level, and the stored audio file is re-compressed and encoded according to the lowered audio parameters to obtain the target audio file.
[0016] Optionally, the step of adjusting the audio parameters of the target draft audio to a value matching the current access popularity level includes:
[0017] Determining an audio parameter to be adjusted among the audio parameters corresponding to the current access popularity level;
[0018] The audio parameter to be adjusted is adjusted down to a value that matches the current access heat level.
[0019] Optionally, it also includes:
[0020] When it is determined that the user accesses the target draft audio, determining a target audio parameter of the target draft audio to be downwardly adjusted;
[0021] Determining a corresponding audio restoration algorithm according to the parameter type of the target audio parameter, and performing audio restoration on the draft audio using the audio restoration algorithm according to the original value of the target audio parameter;
[0022] Output and display the repaired draft audio.
[0023] Optionally, determining the current access popularity level of the target draft audio according to the access record includes:
[0024] Determining, based on the access record, whether the target draft audio has been accessed in a recent first time period;
[0025] If the target draft audio is accessed in the first time period, determining that the current access heat level is a high access heat level;
[0026] If the target draft audio has not been accessed in the first time period, determining whether the target draft audio has been accessed in a recent second time period according to the access record; the second time period is longer than the first time period;
[0027] If the target draft audio is accessed in the second time period, determining that the current access heat level is a medium access heat level;
[0028] If the target draft audio has not been accessed in the second time period, it is determined that the current access heat level is a low access heat level.
[0029] Optionally, after determining the current access popularity level of the target draft audio according to the access record, the method further includes:
[0030] When it is determined that the current access heat level is not the highest access heat level, obtaining the resource file corresponding to the target draft audio, and obtaining the database information corresponding to the target draft audio in the management database;
[0031] Determining a corresponding compression algorithm according to the file type of each resource file, and compressing the corresponding resource file using the compression algorithm;
[0032] The core information in the database information is retained in the management database, and the non-core information in the database information is converted into an archive file and saved.
[0033] Optionally, it also includes:
[0034] When it is determined that the user accesses the target draft audio, decompressing the compressed file corresponding to the corresponding resource file using the compression algorithm;
[0035] Extracting the non-core information from the archive file and re-adding the non-core information to the management database;
[0036] The resource files and database information corresponding to the target draft audio are output and displayed.
[0037] Optionally, it also includes:
[0038] Periodically check whether the machine is idle;
[0039] When it is determined that the machine is idle, it is determined that the detection condition is satisfied.
[0040] The present invention also provides a storage device for draft audio, comprising:
[0041] An access record acquisition module, used to acquire the access record of the target draft audio when the detection condition is met;
[0042] A level determination module, configured to determine a current access popularity level of the target draft audio according to the access record;
[0043] An audio file acquisition module, configured to acquire a target audio file whose audio quality matches the current access popularity level;
[0044] A storage module is used to store the target audio file as the audio source of the target draft audio.
[0045] The present invention further provides an electronic device, comprising:
[0046] memory for storing computer programs;
[0047] A processor is used to implement the draft audio storage method as described above when executing the computer program.
[0048] The present invention also provides a computer program product, comprising a computer program or instructions, which, when executed by a processor, implements the method for storing draft audio as described above.
[0049] The present invention also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the method for storing draft audio as described above is implemented.
[0050] The present invention provides a method for storing draft audio, comprising: when a detection condition is met, obtaining an access record of a target draft audio; determining a current access heat level of the target draft audio based on the access record; obtaining a target audio file whose audio quality matches the current access heat level; and storing the target audio file as the audio source of the target draft audio.
[0051] It can be seen that when the detection conditions are met, the present invention can obtain the access record of the target draft audio, and can determine the current access heat level of the target draft audio based on the access record. Subsequently, the present invention can obtain the target audio file whose audio quality matches the current access heat level, and can store the target audio file as the audio source of the target audio draft. For example, for the target draft audio with a lower current access heat level, the target audio file with lower audio quality can be stored as the audio source of the target audio draft; for the target draft audio with a higher current access heat level, the target audio file with higher audio quality can be stored as the audio source of the target audio draft. In this way, the present invention can store audio files with audio quality corresponding to the current access heat level, meet the user's quality requirements for target draft audio with high access heat levels, and reduce the storage resource occupation of target draft audio with low access heat levels, thereby improving the user experience.
[0052] The present invention also provides a storage device, electronic device, computer program product and computer-readable storage medium for draft audio, which have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0054] Figure 1 A flowchart of a method for storing draft audio provided by an embodiment of the present invention;
[0055] Figure 2 A flowchart of another method for storing draft audio provided by an embodiment of the present invention;
[0056] Figure 3 A flowchart of a draft audio restoration process provided by an embodiment of the present invention;
[0057] Figure 4 A schematic diagram of a draft database information archiving method provided by an embodiment of the present invention;
[0058] Figure 5 A schematic diagram of resource file compression provided by an embodiment of the present invention;
[0059] Figure 6 A structural block diagram of a device for storing draft audio provided by an embodiment of the present invention;
[0060] Figure 7 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0062] With the rise of karaoke software, more and more users are choosing to install it on their electronic devices and use it to record their singing. However, users may use this software to record a large number of draft audios. The original draft audio files are large in size, which can lead to a serious occupation of electronic device storage resources and reduce the user experience.
[0063] In view of this, in order to solve the technical problem of how to reduce the occupation of storage resources of user electronic devices by draft files, the present invention can provide a storage method for draft audio, which can store audio files with audio quality corresponding to the access heat level of the user to the draft audio, and can meet the user's quality requirements for target draft audio with high access heat level, and can reduce the occupation of storage resources by target draft audio with low access heat level, thereby improving the user experience. For easier understanding, please refer to Figure 1 , Figure 1 This is a flow chart of a method for storing draft audio provided by an embodiment of the present invention. This method is applied to a user's electronic device (i.e., the user's device). This method may include:
[0064] S101. When a detection condition is met, obtain access records of the target draft audio.
[0065] In this step, the detection condition is a preset condition that triggers the execution of this method. This embodiment does not limit the specific detection condition, and it can be set according to actual application requirements. For example, to implement periodic detection, the detection condition can be to determine whether the detection time of the next detection cycle has been reached. If so, the detection condition is determined to be satisfied. For another example, to avoid occupying the local computing resources, the local computer can be periodically checked to see if it is idle. If it is determined that the local computer is idle, the detection condition is determined to be satisfied.
[0066] Based on this, before determining the current access popularity level of the draft audio according to the access record of the draft audio, the following steps may also be included:
[0067] Step 11: Periodically check whether the machine is idle;
[0068] Step 12: When it is determined that the machine is idle, it is determined that the detection condition is met.
[0069] It should be noted that this embodiment does not limit how to detect whether the electronic device is idle. For example, whether the electronic device is idle can be determined based on the hardware resource occupancy (such as processor occupancy) of the electronic device.
[0070] Furthermore, draft audio refers to the audio to be edited recorded by the user and saved in the software draft box. The user device stores the audio files of each draft audio so that the audio files can be used as the audio source of the draft audio. The target draft audio can be any draft audio in the software draft box. When it is determined that the detection conditions are met, this embodiment can obtain the access record of the target draft audio, and the access record can include the access time information corresponding to the user accessing the target draft audio. In this way, it can be determined whether the target draft audio has been accessed within a period of time based on the access record, and the number of times the target draft audio has been accessed within a period of time can be determined, thereby determining the access popularity of the target draft audio.
[0071] It should be noted that the draft audio can be either dry singing audio (pure vocal data) without accompaniment, or complete singing audio including accompaniment.
[0072] S102. Determine the current access popularity level of the target draft audio according to the access record.
[0073] In this step, the access heat represents the frequency of recent access to the draft audio, and the access heat level is a plurality of levels preset for access heat, and different access heat levels can represent different access heat. It should be noted that in this embodiment, the access heat level of each draft audio can be determined and updated multiple times.
[0074] In actual application scenarios, users may record several draft audios, but their access to each draft audio may be different. For example, some draft audios may be frequently accessed and edited, while other draft audios are not frequently accessed. In order to ensure the user experience, the audio quality of the draft audios that users frequently access should be prioritized. For draft audios with lower access popularity, if their original audio files are preserved for a long time, it will cause a waste of storage resources. Therefore, their audio quality can be appropriately reduced to free up storage resources. Therefore, this step will determine the current access heat level of the target draft audio based on the access record of the target draft audio, so as to adjust the target audio file of the target draft audio according to the current access heat level.
[0075] It should be noted that this embodiment does not limit the number of access heat levels, which can be set according to actual application requirements. For example, three types of access heat levels can be set: high access heat level, medium access heat level, and low access heat level. This embodiment also does not limit the method for determining the current access heat level, which can be set according to actual application requirements. For example, the number of times the draft audio is accessed in a preset time period can be determined based on the access records, and the current access heat level of the draft audio can be determined based on the number of accesses. For another example, multiple time periods of different lengths can be set, and these time periods can be used to determine multiple time ranges before the current moment. Furthermore, the access status of the draft audio in these multiple time ranges can be determined based on the access records, and the current access heat level of the draft audio can be determined based on the access status of the draft audio in these multiple time ranges. In order to facilitate the determination of the access heat level, this embodiment can adopt the latter method to determine the current access heat level of the draft audio.
[0076] Based on this, determining the current access popularity level of the target draft audio according to the access record includes:
[0077] Step 21: Determine whether the target draft audio has been accessed in the most recent first time period based on the access record; if the target draft audio has been accessed in the first time period, proceed to step 22; if the target draft audio has not been accessed in the first time period, proceed to step 23.
[0078] Step 22: Determine that the current access heat level is a high access heat level.
[0079] Step 23: Determine whether the target draft audio has been accessed in a recent second time period based on the access record; the second time period is longer than the first time period.
[0080] Step 24: If the target draft audio is accessed in the second time period, it is determined that the current access heat level is a medium access heat level.
[0081] Step 25: If the target draft audio has not been accessed in the second time period, it is determined that the current access heat level is a low access heat level.
[0082] It should be noted that this embodiment does not limit the specific length of the first time period and the second time period, and can be set according to actual application requirements. The following describes steps 11 to 15 using a specific example. In one possible scenario, the length of the first time period is 1 month, and the length of the second time period is 3 months. First, based on the access record of the draft audio, it can be determined whether the draft audio has been accessed in the last month. If it has been accessed, it can be determined that the draft audio corresponds to a high access heat level. If the draft audio has not been accessed in the last month, it can be determined whether the draft audio has been accessed in the last 3 months. If it has been accessed, it can be determined that the draft audio corresponds to a medium access heat level. If the draft audio has not been accessed in the last 3 months, it can be determined that the draft audio corresponds to a low access heat level. In this way, based on different time period lengths, the current access heat level corresponding to the draft audio can be determined among the high access heat level, the medium access heat level, and the low-medium access heat level.
[0083] S103: Acquire a target audio file whose audio quality matches the current access popularity level.
[0084] In this step, the target audio file whose audio quality matches the current access heat level obtained in the previous step can be obtained. The lower the current access heat level, the lower the audio quality of the target audio file; the higher the current access heat level, the higher the audio quality of the target audio file. For example, for a target draft audio with a higher current access heat level, a target audio file with higher audio quality can be obtained as the audio source of the target audio draft to meet the user's requirements for audio quality. For a target draft audio with a lower current access heat level, a target audio file with lower audio quality can be stored as the audio source of the target audio draft to reduce the occupancy of the user's device storage resources.
[0085] It should be noted that this embodiment does not limit the method for obtaining the target audio file. For example, the server may store multiple candidate audio files based on the target draft audio file and corresponding to various access popularity levels. In this case, the local machine may send the current access popularity level of the target draft audio file to the server, and the server will match the target audio file based on the current access popularity level and return it.
[0086] Based on this, obtaining a target audio file whose audio quality matches the current access popularity level may include:
[0087] Step 31: Send the current access heat level to the server, so that the server obtains and returns the target audio file that matches the current access heat level from multiple candidate audio files corresponding to multiple access heat levels based on the target draft audio.
[0088] It should be noted that the server can internally compress the original audio file of the target draft audio file according to audio parameters of different audio qualities to obtain candidate audio files corresponding to different access popularity levels. Audio parameters refer to parameters that affect audio quality and file size, such as sampling rate, bit depth, and bit rate. For example, for a high access popularity level, the original audio file may not be compressed and directly used as a candidate audio file for the high access popularity level. For a medium access popularity level, the audio parameter values of the original audio file may be lowered to a first preset value, and the original audio file is compressed based on the lowered audio parameter values to obtain a candidate audio file for the medium access popularity level. Finally, for a low access popularity level, the audio parameter values of the original audio file may be lowered to a second preset value (the second value is less than the first value), and the original audio file is compressed based on the lowered audio parameter values to obtain a candidate audio file for the low access popularity level. The first and second preset values can be set as needed; furthermore, the lowered audio parameters can be one, multiple, or all audio parameters in the original audio file.
[0089] In another embodiment, the target draft audio file may be compressed on the user's local computer to obtain a target audio file whose audio quality matches the current access popularity level. It should be noted that, on the user's local computer, compression may be performed on either the original audio file of the target draft audio or a stored audio file of the target draft audio. A stored audio file refers to an audio file that has been stored on the user's local computer and may have been previously compressed.
[0090] The following first introduces a specific method of compressing the original audio file of the target draft audio in the user's local computer. Based on this, the method of obtaining the target audio file whose audio quality matches the current access popularity level may include:
[0091] Step 41: Obtain the original audio file of the target draft audio.
[0092] In this step, the user device may obtain the original audio file of the target draft audio from the server.
[0093] Step 42: The audio parameters of the target draft audio are adjusted down to values that match the current access heat level, and the original audio file is compressed and encoded according to the adjusted audio parameters to obtain the target audio file.
[0094] Similar to the above embodiment, this step can lower the audio parameters of the target draft audio to a value that matches the current access heat level, and compress and encode the original audio file based on the lowered audio parameters to obtain the target audio file. For example, for a high access heat level, the original audio file may not be compressed, and the original audio file may be directly used as the target audio file of the high access heat level. For a medium access heat level, the audio parameter value of the original audio file can be lowered to a first preset value, and the original audio file can be compressed based on the lowered audio parameter value to obtain a target audio file of the medium access heat level. Finally, for a low access heat level, the audio parameter value of the original audio file can be lowered to a second preset value (the second value is less than the first value), and the original audio file can be compressed based on the lowered audio parameter value to obtain a target audio file of the low access heat level. Similarly, the above-mentioned first preset value and second preset value can be set as required; in addition, the audio parameters that are lowered can be one, multiple or all audio parameters in the original audio file.
[0095] The following further describes a specific method for compressing the stored audio file of the target draft audio in the user's local computer. Based on this, the method of obtaining the target audio file whose audio quality matches the current access popularity level includes:
[0096] Step 51: Obtain a stored audio file of the target draft audio.
[0097] As mentioned above, a stored audio file refers to an audio file that is already stored on the user's device and may have been compressed. For example, if the target draft audio file was previously detected as having a high access popularity level, the stored audio file of the target draft audio file has not been compressed. For another example, if the target draft audio file was previously detected as having a medium access popularity level, the stored audio file of the target draft audio file has been compressed to a medium access popularity level.
[0098] Step 52: When it is determined that the current access heat level is the highest access heat level or the current access heat level is unchanged compared to the historical access heat level of the target draft audio, the stored audio file is used as the target audio file.
[0099] In this step, first, when it is determined that the current access heat level of the target draft audio is the highest access heat level (such as a high access heat level), it can be determined that the user frequently accesses the target draft audio. At this time, the sound quality of the draft audio should be prioritized. For this reason, the present embodiment does not compress the audio file of the target draft audio, but directly stores the original audio file of the target draft audio. Of course, the present embodiment can also perform ordinary encoding processing on the original audio file to reduce the volume of the original draft audio based only on the encoding format, and reduce the user's perception of sound quality loss based on the advantages of the encoding format. For example, considering that Opus is a coding format that can reduce the volume of audio files and can ensure high sound quality and low latency, the Opus encoding algorithm can be used to encode the original audio file of the target draft audio.
[0100] Furthermore, when it is determined in this step that the current access popularity level of the target draft audio has not changed compared with its historical access popularity level, the stored audio file may not be processed.
[0101] Step 53: When it is determined that the current access heat level is lower than the historical access heat level of the target draft audio, the audio parameters of the target draft audio are lowered to a value that matches the current access heat level, and the stored audio file is re-compressed and encoded according to the lowered audio parameters to obtain the target audio file.
[0102] In this step, when it is determined that the current access heat level of the draft audio is lower than the historical access heat level of the draft audio (such as changing from a high access heat level to a medium access heat level, or from a medium access heat level to a low access heat level), it can be determined that the user's recent access frequency to the draft audio has decreased. At this time, saving the original version or a less compressed version of the draft audio will waste storage resources. Therefore, this embodiment can lower the audio parameters of the draft audio according to the current access heat level, and re-compress and encode the draft audio according to the lowered audio parameters. In this way, this embodiment can reduce the size of draft audio that is not frequently accessed by users by sacrificing audio quality, thereby achieving the effect of releasing storage resources. Furthermore, after the draft audio is compressed, compression information can be added to it to record its compression history. In this way, if the access heat level of the draft audio has not changed, it will not be compressed again.
[0103] Furthermore, whether compressing the original audio file or compressing the stored audio file, it involves the downward adjustment of the audio parameters. This embodiment does not limit how to adjust the audio parameters according to the current access heat level. For example, a single or multiple audio parameters can be adjusted downward at the same time, and different access heat levels correspond to different reduction values. For another example, each access heat level corresponds to an audio parameter to be adjusted, and then when the current access heat level becomes a specific access heat level, the specific audio parameter to be adjusted is adjusted downward.
[0104] Based on this, adjusting the audio parameters of the target draft audio to a value matching the current access heat level may include:
[0105] Step 61: determining the audio parameter to be adjusted corresponding to the current access popularity level among the audio parameters;
[0106] Step 62: Lower the audio parameter to be adjusted to a value that matches the current access heat level.
[0107] For example, the audio parameter to be adjusted for a medium access level is the sampling rate, while the audio parameter to be adjusted for a low access level is the bitrate. Furthermore, for draft audio with a medium access level, the audio can be downsampled, using Opus to re-encode the original 48,000 Hz sampling rate audio to a 24,000 Hz sampling rate (the specific value can be dynamically sent). For draft audio with a low access level, after downsampling the audio, the original 320 kbps bitrate audio can be re-encoded to a 128 kbps bitrate (the specific value can be dynamically sent).
[0108] For draft audio with medium access popularity, the uncompressed audio file size is calculated using the following formula:
[0109] File size (bytes) = sampling rate (Hz) * bit depth (bit) * number of channels * time (seconds) / 8;
[0110] It can be calculated that when the original audio sampling is reduced from 48000Hz to 24000Hz, the space occupied by the original human voice can be saved by 50%. After Opus compression, the space is reduced by nearly 50% relative to direct compression (this is only an estimated average value due to the influence of the human voice material).
[0111] For draft audio with low access popularity, based on the medium-frequency draft access, the calculation formula for the compressed audio file size is:
[0112] File size (bytes) = bitrate (bps) * time (seconds) / 8;
[0113] It can be calculated that the audio file bit rate is reduced from 320kbs to 128kbs (the compression target value can be dynamically issued), and the compressed audio file size is reduced by 60%. Taking into account the audio downsampling rate and compression rate, the low-frequency access draft can reduce the file size by 80% compared to the human voice directly encoded with Opus, thereby effectively reducing the storage resources occupied by the draft audio.
[0114] S104: Storing the target audio file as the audio source of the target draft audio.
[0115] In this step, the target audio file whose audio quality matches the current access popularity level can be stored as the audio source of the target draft audio. In this way, audio files with audio quality corresponding to the current access popularity level can be stored, meeting the user's quality requirements for target draft audio with high access popularity levels, while reducing the storage resource usage of target draft audio with low access popularity levels, thereby improving the user experience.
[0116] Based on the above embodiment, when the detection conditions are met, the present invention can obtain the access record of the target draft audio, and can determine the current access heat level of the target draft audio based on the access record. Subsequently, the present invention can obtain the target audio file whose audio quality matches the current access heat level, and can store the target audio file as the audio source of the target audio draft. For example, for the target draft audio with a lower current access heat level, the target audio file with lower audio quality can be stored as the audio source of the target audio draft; for the target draft audio with a higher current access heat level, the target audio file with higher audio quality can be stored as the audio source of the target audio draft. In this way, the present invention can store audio files with audio quality corresponding to the current access heat level, meet the user's quality requirements for target draft audio with high access heat levels, and reduce the storage resource occupation of target draft audio with low access heat levels, thereby improving the user experience.
[0117] Based on the above embodiment, the following describes a method for restoring the draft audio. Based on this, the method may further include:
[0118] S201. When it is determined that a user accesses the target draft audio, determine a target audio parameter of the target draft audio that is adjusted downward.
[0119] S202. Determine a corresponding audio restoration algorithm according to the parameter type of the target audio parameter, and perform audio restoration on the draft audio using the audio restoration algorithm according to the original value of the target audio parameter.
[0120] In steps S201 and S202, considering that the audio parameters of the target draft audio may be lowered, and thus the sound quality of the target draft audio may be greatly damaged, in order to avoid the user's perception of the sound quality degradation of the draft audio as much as possible, this embodiment can use an audio restoration algorithm to repair the draft audio. Specifically, step S201 can first determine the target audio parameters of the target draft audio that have been lowered. Subsequently, step S202 can determine the corresponding audio restoration algorithm based on the parameter type of the target audio parameter, and use the audio restoration algorithm to repair the draft audio based on the original value of the target audio parameter.
[0121] For example, if the audio parameter to be adjusted corresponding to the medium access heat level is the sampling rate, and the adjustment performed at the medium access heat level is to reduce the sampling rate from 48000Hz to 24000Hz, then this embodiment can adopt an audio super-resolution algorithm to perform audio repair on the draft audio of the medium access heat level to restore the sampling rate of the draft audio from 24000Hz to 48000Hz.
[0122] For another example, if the audio parameter to be adjusted corresponding to the low access heat level is the bit rate, and the low access heat level continues to reduce the bit rate from 320kbs to 128kbs on the basis of the adjustment of the medium access heat level, then this embodiment can first adopt an audio bit rate repair algorithm to perform audio repair on the draft audio of the low access heat level to restore the bit rate of the draft audio from 128kbs to 320kbs, and then adopt an audio super-resolution algorithm to perform audio repair on the draft audio of the low access heat level to restore the sampling rate of the draft audio from 24000Hz to 48000Hz.
[0123] In addition, for draft audio with a high access popularity level, since it has only been audio encoded and the audio parameters have not been downgraded, it is only necessary to use the encoding algorithm to decode the draft audio.
[0124] In addition, draft audio can also be repaired using pre-trained machine learning models, which can be set according to actual application needs.
[0125] S203: Output and display the repaired draft audio.
[0126] In this step, after the draft audio is repaired, it can be output and displayed so that the user can access and edit the repaired draft audio.
[0127] Based on the above embodiment, in order to further reduce the occupation of electronic device storage resources, this embodiment can also compress the resource files related to the draft audio. The method of compressing the resource files is introduced below. In another embodiment, after determining the current access popularity level of the target draft audio according to the access record, it can also include:
[0128] S301. When it is determined that the current access heat level is not the highest access heat level, obtain the resource file corresponding to the target draft audio, and obtain the database information corresponding to the target draft audio in the management database.
[0129] In this step, resource files refer to other types of files required to display the draft audio, such as image files, text files, etc. The management database is a database used to manage the draft audio and resource files. The database information recorded can include user information corresponding to the draft audio (such as performance information, editing information, scoring information, etc.), file location, access information, compression information, file location of the resource file, etc. It can be understood that when the user's access heat level to the target draft audio decreases (such as decreasing to a medium access heat level or a low access heat level), especially when it is determined that the current access heat level of the target draft audio is not the highest access heat and the user does not frequently access the target draft audio, not only will the volume of the target draft audio itself cause a waste of the user's local storage resources, but the above-mentioned resource files and database information will also cause a waste of storage resources. Therefore, this embodiment can compress the above-mentioned resource files and archive the database information when it is determined that the current access heat level is not the highest access heat, thereby freeing up storage space.
[0130] S302: Determine a corresponding compression algorithm according to the file type of each resource file, and compress the corresponding resource file using the compression algorithm.
[0131] In this step, because resource files vary in file type, this embodiment determines the corresponding compression algorithm based on the file type and compresses the corresponding resource file using that compression algorithm. For example, an image file can use an image compression algorithm; a draft scoring information file, which contains mostly numerical and similar data, can use a more efficient Huffman coding compression algorithm. The compression algorithm for different resources supports dynamic configuration adjustment.
[0132] S303: retain the core information in the database information in the management database, and convert the non-core information in the database information into an archive file and save it.
[0133] In this step, for drafts with medium or low frequency of access, the database information stored in their database can be compressed, non-core information can be archived into a file, and the file path can be associated with the draft database information. Since these drafts do not need to be accessed frequently, only a small amount of core information can be retained. This can reduce the storage space of the draft audio in the database and effectively improve the speed of draft query.
[0134] It should be noted that this embodiment does not limit the specific core and non-core information; these can be specified based on actual application needs and supports dynamic configuration adjustment. For example, core information may include the audio draft's unique identifier (ID), the audio draft's name, the audio draft's score, rating information (recording score and S, A, B, or C ratings), access time records, and compressed recording information. Non-core information includes editing information, etc.
[0135] It is worth noting that the compression of draft audio, the compression of resource files, and the archiving of database data can be performed using three different asynchronous threads to maximize processing efficiency.
[0136] The following describes a method for restoring resource files related to the draft audio. In another embodiment, the method may further include:
[0137] S401. When it is determined that the user accesses the target draft audio, the compression algorithm is used to decompress the compressed file corresponding to the corresponding resource file.
[0138] It should be noted that the triggering condition of step S401 is to determine whether the user accesses the draft audio, for example, the user views the relevant information of the draft audio and opens the draft audio file.
[0139] S402, extracting the non-core information from the archive file, and re-adding the non-core information to the management database;
[0140] S403: Output and display the resource files and database information corresponding to the target draft audio.
[0141] In steps S401-S403, contrary to the compression and archiving process, this embodiment obtains a compressed file corresponding to the resource file and an archive file corresponding to the database information. It then selects a compression algorithm based on the resource file type to decompress the compressed file, obtains non-core information from the archive file, and rewrites the non-core information into the management database. In this way, this embodiment completes the restoration of the resource file and database information.
[0142] Based on the above embodiment, the above draft audio compression method is fully introduced below based on a specific flowchart.
[0143] Please refer to Figure 2 , Figure 2 This is a flowchart of another method for storing draft audio provided by an embodiment of the present invention. The processing flow may specifically include:
[0144] a. Regularly identify the access time intervals of drafts when the system is idle, and distinguish between three levels of drafts: low-frequency access, medium-frequency access, and high-frequency access;
[0145] b. Frequently accessed draft audio. If the draft audio is the original human voice, it will be lossy compressed using Opus.
[0146] c. For draft audio accessed at the intermediate frequency, downsample the audio. Opus is used to re-encode the 48,000 Hz sampling rate audio to a 24,000 Hz sampling rate (the specific value can be dynamically delivered).
[0147] d. For draft audio files that are accessed infrequently, the 320kbps audio is re-encoded to a 128kbps audio bitrate (the specific value can be dynamically delivered) after downsampling.
[0148] e. For drafts with low or medium frequency of access, database information is compressed in parallel on asynchronous threads. Non-core information is saved to files and associated with the drafts, reducing database storage information and improving data query efficiency.
[0149] f. For drafts that are accessed infrequently or moderately, compression will be performed in parallel on other threads for other types of files in the draft (the best compression algorithm is selected based on the resource type) to improve processing efficiency.
[0150] Please refer to Figure 3 , Figure 3 This is a flowchart of a draft audio restoration process provided by an embodiment of the present invention. The restoration process may include:
[0151] a. Restoration is the reverse process of compression. Audio files are restored using audio bitrate repair and audio super-resolution to maintain the original audio quality as much as possible.
[0152] b. The asynchronous thread restores the database information in parallel, unarchives the archived files, and rewrites the unarchived information into the database;
[0153] c. The asynchronous thread decompresses other resource files in parallel, uses the corresponding compression algorithm to decompress them, and restores the original resource files.
[0154] Specific content of audio multi-level compression:
[0155] This embodiment can distinguish three levels of frequently accessed drafts, medium-frequency accessed drafts, and low-frequency accessed drafts based on the time interval between the user's most recent accesses:
[0156] Frequently accessed drafts are more likely to be accessed again, so user experience should be minimized. If the draft contains the original dry sound, it will be compressed and converted into an Opus format audio file while maintaining the same audio bitrate and sampling rate. This compression is lossy, but sounds the same as the original human voice and is not noticeable to the user. Opus decoding is highly real-time and efficient, supporting real-time decoding when the user accesses the draft, ensuring the same experience as before compression. Opus's high compression ratio, with a maximum compression ratio of 21:1 (the compression ratio varies depending on the vocal material and background noise), can effectively reduce the hard disk space occupied by the dry sound file.
[0157] Accessing the draft for the mid-range frequencies reduces the size of the vocal file by downsampling the original vocal.
[0158] The calculation formula for uncompressed audio file size is:
[0159] File size (bytes) = sampling rate (Hz) * bit depth (bits) * number of channels * time (seconds) / 8
[0160] It can be calculated that by reducing the original audio sampling from 48,000 Hz to 24,000 Hz (the compression target value supports dynamic delivery), the original vocal space can be saved by 50%. After Opus compression, the space is also reduced by nearly 50% relative to direct compression (this is only an estimated average value, affected by the vocal material).
[0161] For low-frequency access drafts, based on the medium-frequency access drafts, the compressed Opus vocal audio files generated are subjected to bit rate reduction processing. The calculation formula for the compressed audio file size is:
[0162] File size (bytes) = bitrate (bps) * time (seconds) / 8
[0163] The audio file bit rate is reduced from 320kbs to 128kbs (the compression target value can be dynamically issued). The compressed audio file size is reduced by 60%. The combined audio downsampling rate and compression rate, as well as the low-frequency access draft, reduce the file size by 80% compared to vocals directly encoded with Opus, effectively reducing the hard disk space occupied by vocal files.
[0164] Detailed implementation of draft database information archiving:
[0165] Please refer to Figure 4 , Figure 4A schematic diagram of a draft database information archiving method provided by an embodiment of the present invention, wherein CoreInfo represents core information and Info represents non-core information. For drafts that are accessed with medium or low frequency, this embodiment can compress the information stored in the database, archive the non-core information into a file, and associate the path of the file with the draft database information. Since frequent access is not required, only a small amount of core information is retained. This can reduce the storage space occupied by drafts in the database by 90%, while effectively improving the speed of querying drafts.
[0166] Automatically select the optimal compression scheme for other files in the draft
[0167] Please refer to Figure 5 , Figure 5 A schematic diagram of resource file compression provided by an embodiment of the present invention. Since the characteristics of audio draft resource files are relatively obvious, different compression algorithms can be used for different resource files to achieve maximum compression efficiency. For example, the scoring information file in the draft, which contains mostly digital and similar data, can use the Huffman coding compression algorithm for higher efficiency. The compression algorithms for different resources support dynamic configuration adjustment.
[0168] The following is an introduction to the storage device, electronic device, program product and medium for the draft audio provided in the embodiments of the present invention. The storage device, electronic device, program product and medium for the draft audio described below can be referenced in correspondence with the draft audio compression method described above.
[0169] Please refer to Figure 6 , Figure 6 This is a structural block diagram of a draft audio storage device provided by an embodiment of the present invention, which may include:
[0170] An access record acquisition module 601 is used to acquire access records of the target draft audio when a detection condition is met;
[0171] A level determination module 602 is configured to determine a current access popularity level of the target draft audio according to the access record;
[0172] An audio file acquisition module 603 is configured to acquire a target audio file whose audio quality matches the current access popularity level;
[0173] The storage module 604 is configured to store the target audio file as the audio source of the target draft audio.
[0174] Optionally, the audio file acquisition module 603 may include:
[0175] The original audio acquisition submodule is used to obtain the original audio file of the target draft audio;
[0176] The compression processing submodule is used to adjust the audio parameters of the target draft audio to a value that matches the current access heat level, and compress and encode the original audio file according to the adjusted audio parameters to obtain the target audio file.
[0177] Optionally, the audio file acquisition module 603 may include:
[0178] A stored audio acquisition submodule, configured to acquire a stored audio file of the target draft audio;
[0179] Setting a submodule for using the stored audio file as the target audio file when it is determined that the current access heat level is the highest access heat level or the current access heat level is unchanged compared to the historical access heat level of the target draft audio;
[0180] The compression processing sub-module can also be used to adjust the audio parameters of the target draft audio to a value that matches the current access heat level when it is determined that the current access heat level is lower than the historical access heat level of the target draft audio, and re-compress and encode the stored audio file according to the lowered audio parameters to obtain the target audio file.
[0181] Optionally, the compression processing submodule may include:
[0182] an audio parameter selection submodule to be adjusted, configured to determine the audio parameter to be adjusted corresponding to the current access popularity level among the audio parameters;
[0183] The adjustment submodule is used to adjust the audio parameter to be adjusted down to a value that matches the current access heat level.
[0184] Optionally, the device may further include:
[0185] a parameter determination module, configured to determine a target audio parameter of the target draft audio to be adjusted downward when it is determined that a user has accessed the target draft audio;
[0186] A repair module, configured to determine a corresponding audio restoration algorithm according to the parameter type of the target audio parameter, and perform audio restoration on the draft audio using the audio restoration algorithm according to the original value of the target audio parameter;
[0187] The output module is used to output and display the repaired draft audio.
[0188] Optionally, the level determination module 602 may include:
[0189] A first judgment submodule, configured to judge whether the target draft audio has been accessed in a recent first time period according to the access record;
[0190] a first level determination submodule, configured to determine that the current access heat level is a high access heat level if the target draft audio is accessed in the first time period;
[0191] a second judgment submodule, configured to, if the target draft audio has not been accessed in the first time period, determine, based on the access record, whether the target draft audio has been accessed in a recent second time period; the second time period being longer than the first time period;
[0192] a second level determination submodule, configured to determine that the current access heat level is a medium access heat level if the target draft audio is accessed in the second time period;
[0193] The third level determination submodule is used to determine that the current access heat level is a low access heat level if the target draft audio has not been accessed in the second time period.
[0194] Optionally, the device may further include:
[0195] An acquisition module, configured to, when determining that the current access heat level is not the highest access heat level, acquire a resource file corresponding to the target draft audio, and acquire database information corresponding to the target draft audio in a management database;
[0196] A resource file compression module, configured to determine a corresponding compression algorithm according to the file type of each resource file, and compress the corresponding resource file using the compression algorithm;
[0197] The database archiving module is used to retain the core information in the database information in the management database, and convert the non-core information in the database information into an archive file and save it.
[0198] Optionally, the device may further include:
[0199] A resource file restoration module, configured to decompress the compressed file corresponding to the corresponding resource file using the compression algorithm when it is determined that the user has accessed the target draft audio;
[0200] A database restoration module, configured to extract the non-core information from the archive file and re-add the non-core information to the management database;
[0201] The output module is used to output and display the resource files and database information corresponding to the target draft audio.
[0202] Optionally, the access record acquisition module 601 may include:
[0203] The idle detection submodule is used to periodically detect whether the machine is idle; when it is determined that the machine is idle, it is determined that the detection condition is met.
[0204] Please refer to Figure 7 , Figure 7 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. The embodiment of the present invention provides an electronic device 10, including a processor 11 and a memory 12; wherein the memory 12 is used to store a computer program; the processor 11 is used to execute the draft audio storage method provided by the aforementioned embodiment when executing the computer program.
[0205] For the specific process of the storage method of the above-mentioned draft audio, please refer to the corresponding content provided in the above-mentioned embodiment, which will not be repeated here.
[0206] Furthermore, the memory 12 as a carrier for resource storage may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.
[0207] In addition, the electronic device 10 also includes a power supply 13, a communication interface 14, an input / output interface 15 and a communication bus 16; wherein, the power supply 13 is used to provide an operating voltage for each hardware device on the electronic device 10; the communication interface 14 can create a data transmission channel between the electronic device 10 and an external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, and is not specifically limited here; the input / output interface 15 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0208] An embodiment of the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for storing draft audio as described in the above embodiment.
[0209] Since the embodiments of the computer program product part correspond to the embodiments of the storage method part of the draft audio, please refer to the description of the embodiments of the storage method part of the draft audio for the embodiments of the computer program product part, and will not be repeated here.
[0210] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for storing draft audio as described in the above embodiment is implemented.
[0211] Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the storage method part of the draft audio, the embodiments of the storage medium part refer to the description of the embodiments of the storage method part of the draft audio, and will not be repeated here.
[0212] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0213] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0214] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0215] The above is a detailed introduction to the storage method, device, electronic device, program product and medium for the draft audio provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A method for storing draft audio, characterized in that: include: When the detection conditions are met, access records of the target draft audio are obtained; Determine the current access popularity level of the target draft audio according to the access record; Acquire a target audio file whose audio quality matches the current access popularity level; The target audio file is stored as an audio source of the target draft audio.
2. The storage method according to claim 1, wherein: The step of obtaining a target audio file whose audio quality matches the current access popularity level includes: Obtaining the original audio file of the target draft audio; The audio parameters of the target draft audio are adjusted down to values that match the current access heat level, and the original audio file is compressed and encoded according to the adjusted audio parameters to obtain the target audio file.
3. The storage method according to claim 1, wherein: The step of obtaining a target audio file whose audio quality matches the current access popularity level includes: Obtaining a stored audio file of the target draft audio; When it is determined that the current access heat level is the highest access heat level or the current access heat level is unchanged compared to the historical access heat level of the target draft audio, the stored audio file is used as the target audio file; When it is determined that the current access heat level is lower than the historical access heat level of the target draft audio, the audio parameters of the target draft audio are lowered to a value that matches the current access heat level, and the stored audio file is re-compressed and encoded according to the lowered audio parameters to obtain the target audio file.
4. The storage method according to claim 2 or 3, characterized in that: The step of adjusting the audio parameters of the target draft audio to a value matching the current access heat level includes: Determining an audio parameter to be adjusted among the audio parameters corresponding to the current access popularity level; The audio parameter to be adjusted is adjusted down to a value that matches the current access heat level.
5. The storage method according to claim 4, characterized in that: Also includes: When it is determined that the user accesses the target draft audio, determining a target audio parameter of the target draft audio to be downwardly adjusted; Determining a corresponding audio restoration algorithm according to the parameter type of the target audio parameter, and performing audio restoration on the draft audio using the audio restoration algorithm according to the original value of the target audio parameter; Output and display the repaired draft audio.
6. The storage method according to claim 1, wherein: Determining the current access popularity level of the target draft audio according to the access record includes: Determining, based on the access record, whether the target draft audio has been accessed in a recent first time period; If the target draft audio is accessed in the first time period, determining that the current access heat level is a high access heat level; If the target draft audio has not been accessed in the first time period, determining whether the target draft audio has been accessed in a recent second time period according to the access record; the second time period is longer than the first time period; If the target draft audio is accessed in the second time period, determining that the current access heat level is a medium access heat level; If the target draft audio has not been accessed in the second time period, it is determined that the current access heat level is a low access heat level.
7. The storage method according to claim 1, wherein: After determining the current access popularity level of the target draft audio according to the access record, the method further includes: When it is determined that the current access heat level is not the highest access heat level, obtaining the resource file corresponding to the target draft audio, and obtaining the database information corresponding to the target draft audio in the management database; Determining a corresponding compression algorithm according to the file type of each resource file, and compressing the corresponding resource file using the compression algorithm; The core information in the database information is retained in the management database, and the non-core information in the database information is converted into an archive file and saved.
8. The storage method according to claim 7, characterized in that: Also includes: When it is determined that the user accesses the target draft audio, decompressing the compressed file corresponding to the corresponding resource file using the compression algorithm; Extracting the non-core information from the archive file and re-adding the non-core information to the management database; The resource files and database information corresponding to the target draft audio are output and displayed.
9. The storage method according to claim 1, wherein: Also includes: Periodically check whether the machine is idle; When it is determined that the machine is idle, it is determined that the detection condition is satisfied.
10. A storage device for draft audio, characterized in that: include: An access record acquisition module, used to acquire the access record of the target draft audio when the detection condition is met; A level determination module, configured to determine a current access popularity level of the target draft audio according to the access record; An audio file acquisition module, configured to acquire a target audio file whose audio quality matches the current access popularity level; A storage module is used to store the target audio file as the audio source of the target draft audio.
11. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the method for storing draft audio as described in any one of claims 1 to 9 when executing the computer program.
12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instructions are executed by a processor, the method for storing draft audio according to any one of claims 1 to 9 is implemented.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the method for storing draft audio according to any one of claims 1 to 9.