Audio compression method and device, storage medium, and electronic device
By parsing game audio event files, counting the number of event triggers, and determining compression information based on the number of triggers, the problem of balancing audio quality and file size in existing technologies is solved, thereby improving the playback quality of game audio resources and the smoothness of gameplay.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-07
- Publication Date
- 2026-04-14
AI Technical Summary
Current technology cannot balance audio quality and compressed file size, affecting game smoothness.
By acquiring game audio event files, parsing audio event names, counting the number of times events are triggered, and determining the compression information for different audio resources based on the number of triggers, compression is performed.
It improves the playback quality of audio resources in the game, avoids performance loss, and enhances game smoothness.
Smart Images

Figure CN115804947B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of audio processing technology, and in particular to an audio compression method and an audio compression apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] Currently, most virtual games contain a large amount of audio resources, such as audio resources corresponding to shooting events or footsteps. To meet audio memory requirements, these audio resources are usually compressed.
[0003] In related technologies, it is usually necessary to conduct cyclical tests on game performance to determine a compression format that is more suitable for various game performance requirements. However, this method cannot simultaneously meet the requirements of both audio quality and compressed file size. It may reduce the audio quality of some audio resources or increase the memory usage of some audio resources, thereby affecting the smoothness of the game.
[0004] Therefore, there is an urgent need in this field to develop a new audio compression method and apparatus.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this disclosure is to provide an audio compression method, an audio compression apparatus, a computer-readable storage medium, and an electronic device, thereby overcoming, at least to some extent, the problem that related technologies cannot simultaneously meet the requirements of audio quality and compressed file size.
[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0008] According to a first aspect of the present invention, an audio compression method is provided, the method comprising: acquiring a game audio event file corresponding to a target game; parsing the game audio event file to obtain an audio event name; counting the number of times the audio event name appears to obtain an event trigger count corresponding to the audio event name; and determining corresponding compression information for the audio resource corresponding to the audio event name based on the event trigger count, so as to compress the audio resource according to the compression information.
[0009] According to a second aspect of the present invention, an audio compression apparatus is provided, the apparatus comprising: a parsing module configured to acquire a game audio event file corresponding to a target game, and to parse the game audio event file to obtain an audio event name; a statistics module configured to count the number of times the audio event name appears to obtain an event trigger count corresponding to the audio event name; and a compression module configured to determine corresponding compression information for the audio resource corresponding to the audio event name based on the event trigger count, and to compress the audio resource according to the compression information.
[0010] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores computer-readable instructions, which, when executed by the processor, implement the audio compression method of any of the above exemplary embodiments.
[0011] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the audio compression method in any of the above exemplary embodiments.
[0012] As can be seen from the above technical solutions, the audio compression method, audio compression device, computer storage medium, and electronic device in the exemplary embodiments of the present invention have at least the following advantages and positive effects:
[0013] In the methods and apparatus provided by the exemplary embodiments of this disclosure, compression information corresponding to different audio resources is determined according to different event trigger counts. This avoids the problem in the prior art that it is impossible to balance the requirements of audio quality and the size of the compressed file. As a result, not only is the playback quality of the audio resources in the target game improved, but excessive performance loss is also avoided, thereby improving the smoothness of the game in the target game.
[0014] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0016] Figure 1 The schematic diagram illustrates the flow chart of the audio compression method in an embodiment of this disclosure;
[0017] Figure 2 This illustration shows a flowchart of parsing game audio event files to obtain audio event names in the audio compression method of this embodiment.
[0018] Figure 3 This illustration shows a flowchart of parsing game audio event files to obtain audio event names in the audio compression method of this embodiment.
[0019] Figure 4 This schematic diagram illustrates the process of obtaining the number of event triggers corresponding to the audio event name in the audio compression method of this embodiment;
[0020] Figure 5 This schematic diagram illustrates the process of counting the number of times an audio event name appears in the audio compression method of this embodiment.
[0021] Figure 6 This schematic diagram illustrates a process for determining corresponding compression information for audio resources corresponding to audio event names in an audio compression method according to an embodiment of the present disclosure.
[0022] Figure 7 This schematic diagram illustrates another audio compression method in this embodiment of the present disclosure, which involves determining the corresponding compression information for audio resources corresponding to audio event names.
[0023] Figure 8 This schematic diagram illustrates another aspect of the audio compression method in this disclosure, which involves determining the corresponding compression information for audio resources corresponding to audio event names.
[0024] Figure 9 This schematic diagram illustrates the process of determining corresponding compression information for audio resources in the audio compression method of this disclosure embodiment;
[0025] Figure 10 This schematic diagram illustrates the process after the audio resources are compressed according to the compression information in the audio compression method of this embodiment.
[0026] Figure 11 This illustration schematically depicts an apparatus for an audio compression method according to an embodiment of the present disclosure;
[0027] Figure 12 An electronic device for an audio compression method is illustrated in an embodiment of this disclosure;
[0028] Figure 13 The illustration schematically shows a computer-readable storage medium for an audio compression method according to an embodiment of the present disclosure. Detailed Implementation
[0029] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0030] The terms “a,” “an,” “the,” and “the” are used in this specification to indicate the presence of one or more elements / components / etc.; the terms “including” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first” and “second” are used only as markings and are not a limitation on the number of objects.
[0031] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0032] In view of the problems existing in related technologies, this disclosure proposes an audio compression method. Figure 1 A flowchart illustrating an audio compression method is shown, such as... Figure 1 As shown, the audio compression method includes at least the following steps:
[0033] Step S110. Obtain the game audio event file corresponding to the target game, and parse the game audio event file to obtain the audio event name.
[0034] Step S120. Count the number of times the audio event name appears to obtain the number of times the event is triggered corresponding to the audio event name.
[0035] Step S130. Based on the number of event triggers, determine the corresponding compression information for the audio resource corresponding to the audio event name, and compress the audio resource according to the compression information.
[0036] In the methods and apparatus provided by the exemplary embodiments of this disclosure, compression information corresponding to different audio resources is determined according to different event trigger counts. This avoids the problem in the prior art that it is impossible to balance the requirements of audio quality and the size of the compressed file. As a result, not only is the playback quality of the audio resources in the target game improved, but excessive performance loss is also avoided, thereby improving the smoothness of the game in the target game.
[0037] The following section provides a detailed explanation of each step in the audio compression method.
[0038] In step S110, the game audio event file corresponding to the target game is obtained, and the game audio event file is parsed to obtain the audio event name.
[0039] In the exemplary embodiments disclosed herein, the target game refers to any virtual game. An audio event refers to a game event that a player may trigger while playing the target game. It is worth noting that when a player triggers this game event, corresponding audio will be generated in the game.
[0040] A game audio event file is a file that stores audio events. The game audio event files obtained can be those generated when the target game ends, those generated during the game's progress, those generated at crucial moments in the game, or a specified number of game audio event files. Specifically, you can flexibly obtain the game audio event files corresponding to the target game according to your needs.
[0041] Therefore, when parsing the game audio event file, the names of the audio events corresponding to the audio events stored in the game audio event file will be obtained. For example, the audio event name can be the name corresponding to the audio event of shooting, the audio event of walking, or the audio event of hitting. This exemplary embodiment does not make any special limitations on this.
[0042] For example, when the target game ends, a large number of profile files (i.e., game audio event files) are automatically retrieved from the Wwise (Wave Works Interactive SoundEngine) client. Parsing each of these large number of game audio event files yields multiple audio event names.
[0043] In an optional embodiment, Figure 2 The diagram illustrates the process of parsing game audio event files to obtain audio event names in an audio compression method, such as... Figure 2As shown, the method includes at least the following steps: In step S210, the game audio event file is parsed to obtain parsed data, and preset audio trigger keywords are determined.
[0044] Parsing the game audio event file yields the parsed data. Preset audio trigger keywords refer to the keywords generated in the game audio event file when a player triggers an audio event. Often, the string immediately adjacent to the preset audio trigger keyword is the name of the corresponding audio event.
[0045] For example, parsing the game's audio event file yields parsed data, and the preset audio trigger keyword obtained is "Play".
[0046] In step S220, if a preset audio trigger keyword exists in the parsed data, the audio event name corresponding to the preset audio trigger keyword is extracted from the parsed data.
[0047] When a preset audio trigger keyword exists in the parsed data, it proves that an audio event triggered by a game player exists in the parsed data, and thus there is an audio event name corresponding to the preset audio trigger keyword.
[0048] For example, if there are 10 instances of "Play" in the parsed data, then the corresponding 10 audio event names can be extracted from the parsed data.
[0049] In this exemplary embodiment, if there is a preset audio trigger keyword in the parsed data, the audio event name corresponding to the preset audio trigger keyword is extracted from the parsed data, so as to lay the foundation for subsequent statistics on the number of times the audio event name appears.
[0050] In an optional embodiment, Figure 3 The diagram illustrates the process of parsing game audio event files to obtain audio event names in an audio compression method, such as... Figure 3 As shown, the method includes at least the following steps: In step S310, the file size corresponding to the game audio event file is determined, and a preset file size threshold corresponding to the game audio event file is determined.
[0051] Here, file size refers to the disk space occupied by the game audio event file. The preset file size threshold refers to the minimum disk space that the game audio event file should occupy if there are no missing contents.
[0052] For example, the file size corresponding to the game audio event file is 30M, and the default file size threshold is 10M.
[0053] In step S320, if a first audio event file exists in the game audio event file, the first audio event file is deleted from the game audio event file to obtain the target game audio event file; the file size of the first audio event file is less than or equal to a preset file size threshold.
[0054] The first audio event file refers to one or more files existing in the game audio event file. The file size of the first audio event file is less than or equal to a preset file size threshold. Based on this, it can be proven that the first audio event file is an audio event file with potentially missing content. Therefore, the first audio event file needs to be deleted from the game audio event file to obtain a target game audio event file with no missing content.
[0055] For example, there exists a first audio event file C-1 in the game audio event file, with a file size less than 10MB. Based on this, the first audio event file C-1 is deleted from the game audio event file to obtain the target game audio event file.
[0056] In step S330, the target game audio event file is parsed to obtain the audio event name.
[0057] The target game audio event file is a game audio event file with no missing content. Therefore, after obtaining the target game audio event file, it can be parsed to obtain the audio event names, so as to ensure that more accurate and complete audio event names are obtained.
[0058] In this exemplary embodiment, the first audio event file is deleted from the game audio event file to obtain the target game audio event file, so as to ensure that the correct and complete audio event name can be obtained after the target game audio event file is parsed.
[0059] In step S120, the number of times the audio event name appears is counted to obtain the number of times the event is triggered corresponding to the audio event name.
[0060] In an exemplary embodiment of this disclosure, the number of times the same audio event name appears in all game audio event files is counted, and the resulting count is the number of times the event is triggered corresponding to the audio event name (i.e., the number of times the same audio event is triggered by the game player during the target game).
[0061] For example, there are 10 game audio event files. Audio event name A appears twice in the first file, eight times in the second, seven times in the third, and so on, up to nine times in the tenth file. By counting the occurrences of audio event name A, we can obtain the number of times the event corresponding to audio event name A is triggered.
[0062] It's worth noting that after counting the number of times each audio event name is triggered, we can determine which audio events have not been triggered. These untriggered audio events are called untriggered audio events, and they are deleted. Therefore, no compression information will be assigned to the audio resources corresponding to these untriggered audio events to reduce computer performance overhead.
[0063] In an optional embodiment, Figure 4 The diagram illustrates the process of obtaining the number of event triggers corresponding to audio event names in an audio compression method. The number of event triggers includes the average number of event triggers, such as... Figure 4 As shown, the method includes at least the following steps: In step S410, the number of times the same audio event name appears in each game audio event file is counted to obtain the number of times the first event is triggered.
[0064] Specifically, the number of event triggers can be the average number of event triggers, which refers to the average number of times the audio event name appears in all game audio event files.
[0065] Before calculating the average number of event triggers, it is necessary to first calculate the number of first event triggers. The number of first event triggers refers to the number of times an audio event name appears in the parsed data corresponding to each game audio event file.
[0066] For example, if audio event name C-2 appears 1 time in the parsed data corresponding to game audio event file A, appears 2 times in the parsed data corresponding to game audio event file B, appears 3 times in the parsed data corresponding to game audio event file C, and appears 4 times in the parsed data corresponding to game audio event file D, then the number of times the first event is triggered includes f1, f2, f3, and f4.
[0067] In step S420, the number of times the first event is triggered is calculated to obtain the total number of times the same audio event name appears in all game audio event files.
[0068] By summing up the number of times the first event is triggered, we can obtain the total number of times the same audio event name appears in all game audio event files (i.e., the total number of triggers).
[0069] For example, summing f1, f2, f3, and f4 gives the total number of triggers, f_total.
[0070] In step S430, the total number of triggers is calculated based on the number of files in all game audio event files to obtain the average number of event triggers corresponding to the audio event name.
[0071] The number of files refers to the number of game audio event files. By calculating the total number of triggers and the number of files, we can obtain the average number of times the same audio event name appears in all game audio event files (i.e., the average number of event triggers).
[0072] For example, if the total number of game audio event files is 4, then the average number of event triggers can be obtained by dividing the total number of triggers f by the total number of files 4.
[0073] In this exemplary embodiment, the average number of times the event corresponding to the audio event name is triggered is calculated to reflect the frequency of the audio event corresponding to the audio event name being triggered during the target game. This helps to determine the compression information of the corresponding audio resource based on the frequency of the audio event being triggered, so as to take into account both the audio quality of the audio resource and the file size of the compressed audio resource.
[0074] In an optional embodiment, Figure 5 The diagram illustrates a flowchart of an audio compression method that counts the frequency of audio event names. Figure 5 As shown, the method includes at least the following steps: In step S510, the key audio event name corresponding to the target game is obtained. If the key audio event name does not exist in the audio event name, the second game audio event file corresponding to the audio event name is determined.
[0075] The key event name refers to the name of the audio event that will definitely be triggered during the target game. If the key audio event name is not found in the audio event names, it indicates that the player may have encountered some unexpected situation while playing the target game, or it may prove that the player is not playing the game correctly. Therefore, it is necessary to identify the second game audio event file corresponding to the audio event name so that the second game audio event file can be deleted later.
[0076] For example, the key audio event name could be either the audio event name N-1 corresponding to the game start event or the audio event name N-2 corresponding to the game end event. However, the key audio event names N-1 and N-2 are not present in any of the audio event names corresponding to the second game audio event file C-3.
[0077] In step S520, the second game audio event file is deleted from the game audio event file, and the first audio event name corresponding to the second game audio event file is deleted from the audio event name to obtain the target audio event name.
[0078] Since the second game audio event file does not contain an audio event name matching the key audio event name, it's possible that the second game audio event file was generated by an unauthorized player while playing the target game. Therefore, the second game audio event file needs to be deleted from the game audio event file. Furthermore, since the second game audio event file has already been parsed, the first audio event name corresponding to the second game audio event file also needs to be deleted from the audio event name file. Based on the above process, the target audio event name can be obtained.
[0079] For example, the second game audio event file C-3 is deleted from the game audio event file, and the first audio event name corresponding to the second game audio event file C-3 is deleted from the audio event name to obtain the target audio event name N-3.
[0080] In step S530, the number of times the target audio event name appears is counted.
[0081] After obtaining the target audio event name, the number of times the target audio event name appears can be counted to ensure the accuracy of the counted event trigger count.
[0082] For example, count the number of times the same audio event name appears in the target audio event name N-3.
[0083] In this exemplary embodiment, the second game audio event is deleted from the game audio events, and the name of the first audio event corresponding to the second game audio event is deleted from the audio event names to obtain the target audio event name. This helps to improve the accuracy of the event trigger count obtained by subsequently counting the target audio event name.
[0084] In step S130, based on the number of event triggers, corresponding compression information is determined for the audio resource corresponding to the audio event name, so as to compress the audio resource according to the compression information.
[0085] Here, audio resources refer to the audio objects corresponding to the audio event names. Specifically, audio resources can be tone objects corresponding to the audio event names, sound objects corresponding to the audio event names, or any audio-related objects corresponding to the audio event names. This exemplary embodiment does not impose any special limitations on this.
[0086] Compression information refers to the information used when compressing audio resources. Specifically, compression information may include compression format, compression ratio, and any other information used when compressing audio resources; this exemplary embodiment does not impose any particular limitation on this. After determining the compression information, the audio resources will be compressed using the compression information.
[0087] For example, if the audio event name corresponding to the audio event of a shooting is triggered 80 times, then based on the trigger count of 80, the corresponding compression information can be determined for the audio resource corresponding to the audio event name. Specifically, the compression information includes a compression format of ADPCM (Adaptive Differential Pulse Code Modulation, a compression algorithm).
[0088] In an optional embodiment, Figure 6 This illustrates a flowchart of an audio compression method for determining corresponding compression information for audio resources corresponding to audio event names, such as... Figure 6 As shown, the method includes at least the following steps: In step S610, a threshold number corresponding to the average number of times the event is triggered is obtained; if the average number of times the event is triggered is greater than or equal to the threshold number, first compression information is determined for the audio resource corresponding to the audio event name.
[0089] The trigger threshold refers to a critical value used to measure the average number of times an event is triggered. Since the average trigger count represents the frequency at which an audio event (corresponding to its name) is triggered, if the average trigger count is greater than or equal to the threshold, it proves that the audio event corresponding to the average trigger count is frequently triggered by the player. Conversely, if the average trigger count is less than the threshold, it proves that the audio event corresponding to the average trigger count is not frequently triggered by the player.
[0090] For audio events frequently triggered by game players, we need to determine the first compression information for the audio resources. It is worth noting that the compression format determined in the first compression information needs to meet the requirements of a low compression ratio (i.e., the first compression ratio), a medium memory usage, and low CPU performance loss.
[0091] For example, if the threshold number is 50 and the average number of times the event corresponding to the audio event name N-4 is 80, then the average number of times the event is triggered is obviously greater than the threshold number. Therefore, first compression information is determined for the audio resource corresponding to the audio event name N-4, wherein the first compression information includes the compression format ADPCM.
[0092] In step S620, if the average number of times an event is triggered is less than a threshold, second compression information is determined for the audio resource corresponding to the audio event name; the first compression ratio included in the first compression information is less than the second compression ratio included in the second compression information.
[0093] If the average number of times an event is triggered is less than the threshold, second compression information is determined for the audio resource corresponding to the audio event name. It is worth noting that the compression format determined in the second compression information needs to meet the requirements of a high compression ratio (i.e., the second compression ratio, and the second compression ratio is greater than the first compression ratio), a low memory usage, and moderate CPU performance loss.
[0094] For example, if the threshold number is 50 and the average number of times the event corresponding to the audio event name N-5 is 40, then the average number of times the event is triggered is less than the threshold number. Therefore, a second compression information is determined for the audio resource corresponding to the audio event name N-5, wherein the second compression information includes the compression format Vorbis (an audio compression format).
[0095] In this exemplary embodiment, if the average number of event triggers is greater than a threshold, first compression information is determined for the audio resource corresponding to the audio event name; if the average number of event triggers is less than the threshold, second compression information is determined for the audio resource corresponding to the audio event name, and the first compression ratio is less than the second compression ratio. Obviously, different compression information is determined for the corresponding audio resources based on different average number of event triggers, so that frequently triggered audio resources can maintain audio quality while reducing performance loss to the computer, and infrequently triggered audio resources can reduce memory usage, thus avoiding the problem in the prior art that it is impossible to balance the requirements of audio quality and the size of the compressed audio resource file.
[0096] In an optional embodiment, Figure 7 This illustrates another audio compression method that determines the corresponding compression information for audio resources associated with audio event names, such as... Figure 7 As shown, the method includes at least the following steps: in step S710, multiple trigger count intervals corresponding to the average number of event triggers are determined, and the target trigger count interval to which the average number of event triggers belongs is determined from the multiple trigger count intervals.
[0097] Since different audio event names may correspond to different average trigger counts, the possible values for the average trigger count are divided into multiple trigger count intervals. It is worth noting that the frequency of triggering of the audio event (corresponding to the audio event name) varies depending on the trigger count interval.
[0098] For example, multiple trigger count intervals include (0,2], (2,10], (10,100], and greater than 100. When the average number of event triggers is 101, it proves that the target trigger count interval corresponding to the average number of event triggers of 101 is a trigger count interval greater than 100.
[0099] In step S720, the audio event name corresponding to the average number of times the event is triggered is determined, and the event priority range corresponding to the audio event is determined, so as to determine the target priority range corresponding to the audio event name in the event priority range; the audio event corresponds to the audio event name.
[0100] Different audio events play different game functions in the target game, and their corresponding priorities can be determined according to these functions. A priority range is a division of the possible priority values, and different priority ranges represent different levels of audio event priority.
[0101] For example, the audio event name corresponding to the average number of triggers is "shot," and the audio event identified corresponding to the audio event name "shot" is a shooting event. The event priority ranges include three event priority ranges: [0, 40), [40, 70), and [70, 100).
[0102] If the priority corresponding to the shooting incident is 75, then the target priority range corresponding to the audio event name "shot" is [70, 100].
[0103] In step S730, based on the target trigger count range and the target priority range, the corresponding compression information is determined for the audio resource corresponding to the audio event name.
[0104] Table 1 schematically illustrates a compression information table in an exemplary embodiment of this disclosure.
[0105] Table 1 Compression Information Table
[0106] [70,100) [40,70) [0,40) Greater than 100 ADPCM high ADPCM low Vorbis high (10,100] ADPCM high ADPCM low Vorbis low (2,10] Vorbis high Vorbis high Vorbis low (0,2] Vorbis low Vorbis low /
[0107] The event priority range [70, 100) represents high priority, [40, 70) represents medium priority, and [0, 40) represents low priority. The trigger frequency range (0, 2] represents extremely difficult to trigger, (2, 10] represents low trigger frequency, (10, 100] represents medium trigger frequency, and a trigger frequency range greater than 100 represents high trigger frequency.
[0108] ADPCM and Vorbis represent different compression formats. In the ADPCM compression format, the compression ratio of ADPCM high is less than that of ADPCM low. Similarly, in the Vorbis compression format, the compression ratio of Vorbis high is less than that of Vorbis low.
[0109] If the target trigger count range is greater than 100 and the target priority range is [70, 100), then the compression format in the compression information determined by the audio resource corresponding to the audio event name is ADPCM high.
[0110] In this exemplary embodiment, compression information is determined for the audio resources corresponding to the audio event names based on two dimensions: the average number of event triggers and the event priority. This not only avoids the problem of not being able to balance the requirements of audio quality and the size of the compressed audio resource file, but also subdivides the audio resources in different situations to determine more accurate compression information for the audio resources.
[0111] In an optional embodiment, Figure 8 This illustrates a flowchart of another audio compression method that determines the corresponding compression information for audio resources corresponding to audio event names, such as... Figure 8 As shown, the method includes at least the following steps: In step S810, the audio resource corresponding to the audio event name is determined.
[0112] This involves identifying the audio resource corresponding to the audio event name. For example, the audio resource corresponding to the audio event name could be the tone object corresponding to the audio event name "shot".
[0113] In step S820, if the playback mode corresponding to the audio resource is streaming playback mode, the audio duration corresponding to the audio resource is determined.
[0114] Streaming playback refers to a method of continuously and in real-time transmitting audio resources from a streaming media server to a user client. When the playback method corresponding to an audio resource is streaming playback, it is necessary to determine the audio duration of the audio resource (i.e., the duration of the audio in the audio resource).
[0115] For example, if the playback mode corresponding to audio resource A-1 is streaming playback, then the audio duration corresponding to audio resource A-1 is determined to be 100s.
[0116] In step S830, an audio duration interval corresponding to the audio duration is determined, and the target audio duration interval to which the audio duration belongs is determined within the audio duration interval.
[0117] Since different audio resources have different audio durations, the audio duration can be divided into audio duration intervals. It is worth noting that different audio duration intervals represent different duration levels.
[0118] For example, the audio duration range includes three intervals: [0,2), [2,10), and [10,1000000). Since the audio duration corresponding to audio resource A-1 is 100s, the target audio duration range is [10,1000000).
[0119] In step S840, based on the target trigger count range, target priority range, and target audio duration range, the corresponding compression information for the audio resource is determined.
[0120] Specifically, by defining the target trigger count range, target priority range, and target audio duration range, a corresponding compression information can be determined for the audio resource.
[0121] For example, Table 2 schematically illustrates the trigger count range, event priority range, and audio duration range in embodiments of this disclosure.
[0122] Table 2: Trigger frequency range, event priority range, and audio duration range
[0123] interval degree Interval range Event priority range Low [0,40) Event priority range medium [40,70) Event priority range high [70,100) Trigger count range It rarely triggers (0,1] Trigger count range Extremely difficult to trigger (1,2] Trigger count range Low trigger frequency (2,10] Trigger count range Trigger frequency is moderate (10,100] Trigger count range High trigger frequency (100,1000000] Audio duration range short (0,2] Audio duration range medium (2,10] Audio duration range long (10,1000000]
[0124] If the playback mode of the audio resource is streaming, and the determined target trigger count range is (100, 1000000], the determined target priority range is [70, 100), and the determined target audio duration range is (0, 2], then the compression information determined for the audio resource is ADPCM Auto Detect High.
[0125] For the ADPCM compression format, there are ADPCM High / Medium / Low. ADPCM High can be further divided into ADPCM Quality High and ADPCM Auto Detect High. The compression ratio corresponding to ADPCM Quality High is greater than that corresponding to ADPCM Auto Detect High. Similarly, the classification of ADPCM Medium and ADPCM Low is similar to the above.
[0126] In this exemplary embodiment, when the audio resource is played in streaming mode, the audio playback duration dimension is introduced. Then, the compression information corresponding to the audio resource is determined from three dimensions: average number of event triggers, event priority, and audio duration. This not only avoids the problem of not being able to meet the requirements of both audio quality and the size of the compressed audio resource file, but also subdivides the audio resources in different situations to determine more accurate compression information for the audio resources.
[0127] In an optional embodiment, Figure 9 This diagram illustrates the process of determining the corresponding compression information for audio resources in an audio compression method. Figure 9 As shown, the method includes at least the following steps: In step S910, a compression information template is determined; the compression information template includes multiple compression formats.
[0128] The compressed information template can be a compressed information template in Wwise or a compressed information template defined by the user. This exemplary embodiment does not impose any special limitations on this.
[0129] For example, Table 3 schematically illustrates a compressed information template in an embodiment of this disclosure.
[0130] Table 3 Compression Information Template
[0131]
[0132] In step S920, based on the target trigger count range, target priority range, and target duration range, the target compression format corresponding to the audio resource is determined from multiple compression formats.
[0133] Specifically, based on the target trigger count range, target priority range, and target duration range, the target compression format corresponding to the audio resource can be determined from among various compression formats in the compression information template.
[0134] For example, the determined target trigger count range is (100, 1000000], the determined target priority range is [70, 100), and the determined target audio duration range is (0, 2]. Based on the target trigger count range, target priority range, and target audio duration range, it can be determined that this audio resource is a frequently triggered audio resource, and it is a priority audio resource to be processed in the target game. At the same time, the audio duration of this audio resource is not long. Therefore, it is necessary to reduce the memory usage when decompressing this audio resource, and to ensure the audio quality after the audio resource is compressed. Therefore, the target compression format determined for the audio resource can be ADPCM Auto Detect High.
[0135] In this exemplary embodiment, the target compression format corresponding to the audio resource is determined from multiple compression formats based on the target trigger count range, the target priority range, and the target duration range. This can improve the accuracy of the determined target compression format and further balance the quality of the audio resource and the size of the compressed audio resource file.
[0136] In an optional embodiment, before determining the compressed information template, the method further includes: determining an initial compressed information template and editing the initial compression format in the initial compressed information template to obtain the compressed information template.
[0137] The initial compression information template is the same as the compression information template in Wwise. Staff can add, delete, or modify the initial compression formats included in the initial compression information template to flexibly edit it and obtain the desired compression information template.
[0138] For example, the initial compression information template is shown in Table 3. Obviously, the maximum compression ratio in Table 3 is 45:1. If the required compression ratio is 50:1, then a new compression format needs to be added to Table 3, and the compression ratio corresponding to the new compression format is 50:1, thus obtaining the compression information template.
[0139] In this exemplary embodiment, the initial compression format in the initial compression information template is edited to obtain the compression information template. The compression information template can be flexibly edited to determine more accurate compression information corresponding to the audio resources in the future.
[0140] In an optional embodiment, Figure 10 The diagram illustrates the process of compressing audio resources according to compression information in an audio compression method, such as... Figure 10As shown, the method includes at least the following steps: In step S1010, the performance index to be observed is determined.
[0141] The observed metrics refer to the performance metrics used to evaluate the compressed audio resources. Specifically, the observed performance metrics may be the CPU usage metrics of the corresponding thread during the compression of audio resources, the memory allocated during the compression of audio resources, the number of calls made by the audio engine to the API at a specific moment, or other metrics that need to be observed. This exemplary embodiment does not impose any special limitations on these metrics.
[0142] In step S1020, the size of the first indicator of the performance index to be observed corresponding to the audio resource is determined, and the size of the second indicator of the performance index to be observed corresponding to the default audio resource is determined; the default audio resource is obtained by compressing the audio resource according to the default compression format.
[0143] Here, the first metric refers to the value of the performance metric to be observed during the compression of the audio resource according to the compression format. The second metric refers to the value of the performance metric to be observed during the compression of the audio resource according to the default compression format. The default compression format can be a compression format in the prior art or a compression format previously determined for the audio resource; this exemplary embodiment does not impose any special limitations on it.
[0144] For example, suppose the performance metric to be observed is the CPU usage of the corresponding thread during the compression of audio resources. Furthermore, the first metric has a size of M, and the second metric has a size of N.
[0145] In step S1030, if the size of the first indicator is less than or equal to the size of the second indicator, the compression information is adjusted; or the parameter range is adjusted; the parameter range includes the trigger count range, the event priority range, and the audio duration range.
[0146] Specifically, when the first indicator is less than or equal to the second indicator, it indicates that the compression format determined at this time does not produce better compression performance than the default compression format. Based on this, the parameter range or the compression information needs to be adjusted. The parameter range can be one or more of the following: trigger count range, event priority range, and audio duration range.
[0147] For example, if the size of the first indicator is M and the size of the second indicator is N, then the compression format in the compressed information is adjusted.
[0148] In this exemplary embodiment, if the size of the first index is less than or equal to the size of the second index, the compression information is adjusted; or the parameter range is adjusted, providing a way to verify compression performance in order to further improve the accuracy of the determined compression information.
[0149] In the methods and apparatus provided by the exemplary embodiments of this disclosure, compression information corresponding to different audio resources is determined according to different event trigger counts. This avoids the problem in the prior art that it is impossible to balance the requirements of audio quality and the size of the compressed file. As a result, not only is the playback quality of the audio resources in the target game improved, but excessive performance loss is also avoided, thereby improving the smoothness of the game in the target game.
[0150] The audio compression method in this embodiment will be described in detail below with reference to an application scenario.
[0151] Obtain the game audio event file corresponding to the target game, parse the game audio event file to obtain multiple audio event names; count the number of times the same audio event name appears in all game audio event files to obtain the event trigger count corresponding to the audio event name; if the event trigger count is greater than 70, determine the compression information for the audio resource corresponding to the audio event name (the compression information includes the compression format as ADPCM), and compress the audio resource according to the ADPCM compression format.
[0152] In this application scenario, compression information corresponding to different audio resources is determined based on the number of times different events are triggered. This avoids the problem in existing technologies that cannot balance the requirements of audio quality and the size of the compressed file. As a result, not only is the playback quality of audio resources in the target game improved, but excessive performance loss is also avoided, thus improving the smoothness of the game.
[0153] Furthermore, in an exemplary embodiment of this disclosure, an audio compression device is also provided. Figure 11 A schematic diagram of the audio compression device is shown, such as... Figure 11 As shown, the audio compression device 1100 may include: a parsing module 1110, a statistics module 1120, and a compression module 1130. Wherein:
[0154] The parsing module 1110 is configured to obtain the game audio event file corresponding to the target game, and parse the game audio event file to obtain the audio event name; the statistics module 1120 is configured to count the number of times the audio event name appears, and obtain the event trigger count corresponding to the audio event name; the compression module 1130 is configured to determine the corresponding compression information for the audio resource corresponding to the audio event name based on the event trigger count, and compress the audio resource according to the compression information.
[0155] The specific details of the aforementioned audio compression device 1100 have been described in detail in the corresponding audio compression method, so they will not be repeated here.
[0156] It should be noted that although several modules or units of the audio compression device 1100 are mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0157] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0158] The following reference Figure 12 To describe an electronic device 1200 according to such an embodiment of the present invention. Figure 12 The electronic device 1200 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0159] like Figure 12 As shown, the electronic device 1200 is manifested in the form of a general-purpose computing device. The components of the electronic device 1200 may include, but are not limited to: at least one processing unit 1210, at least one storage unit 1220, a bus 1230 connecting different system components (including storage unit 1220 and processing unit 1210), and a display unit 1240.
[0160] The storage unit stores program code that can be executed by the processing unit 1210, causing the processing unit 1210 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention.
[0161] Storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 1221 and / or cache memory 1222, and may further include a read-only memory (ROM) 1223.
[0162] Storage unit 1220 may also include a program / utility 1224 having a set (at least one) program module 1225, such program module 1225 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may contain the reality of the network environment.
[0163] Bus 1230 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0164] Electronic device 1200 can also communicate with one or more external devices 1270 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 1200, and / or with any device that enables electronic device 1200 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1250. Furthermore, electronic device 1200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1260. As shown, network adapter 1260 communicates with other modules of electronic device 1200 via bus 1230. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0165] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0166] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section above.
[0167] refer to Figure 13As shown, a program product 1300 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0168] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0169] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0170] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0171] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0172] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
Claims
1. An audio compression method, characterized in that, The method includes: Obtain the game audio event file corresponding to the target game, and parse the game audio event file to obtain the audio event name; The number of times the audio event name appears is counted to obtain the event trigger count corresponding to the audio event name; Based on the number of times the event is triggered, corresponding compression information is determined for the audio resource corresponding to the audio event name, so as to compress the audio resource according to the compression information; The event trigger count includes the average event trigger count. Based on the event trigger count, corresponding compression information is determined for the audio resource corresponding to the audio event name, including: A target trigger count interval is determined from multiple trigger count intervals, to which the average trigger count of an event belongs. The average trigger count refers to the average number of times the audio event name appears in the game's audio event file. The audio event name corresponding to the average trigger count is determined, and the event priority interval corresponding to the audio event is determined, so as to determine the target priority interval corresponding to the audio event name within the event priority interval. The audio event corresponds to the audio event name. Based on the target trigger count interval and the target priority interval, corresponding compression information is determined for the audio resource corresponding to the audio event name.
2. The audio compression method according to claim 1, characterized in that, The step of counting the number of times the audio event name appears to obtain the event trigger count corresponding to the audio event name includes: The number of times the same audio event name appears in each of the game audio event files is counted to obtain the number of times the first event is triggered. The number of times the first event is triggered is calculated to obtain the total number of times the same audio event name appears in all the game audio event files; Based on the total number of all the game audio event files, the total number of triggers is calculated to obtain the average number of triggers for each audio event name.
3. The audio compression method according to claim 2, characterized in that, The step of determining the corresponding compression information for the audio resource corresponding to the audio event name based on the number of event triggers includes: Obtain a threshold number corresponding to the average number of times the event is triggered. If the average number of times the event is triggered is greater than or equal to the threshold number, determine the first compression information for the audio resource corresponding to the audio event name. If the average number of times the event is triggered is less than the threshold number, second compression information is determined for the audio resource corresponding to the audio event name; the first compression ratio included in the first compression information is less than the second compression ratio included in the second compression information.
4. The audio compression method according to claim 1, characterized in that, The step of determining the corresponding compression information for the audio resource corresponding to the audio event name includes: Identify the audio resource corresponding to the audio event name; If the playback method corresponding to the audio resource is streaming playback, determine the audio duration corresponding to the audio resource; Determine the audio duration interval corresponding to the audio duration, and determine the target audio duration interval to which the audio duration belongs within the audio duration interval; Based on the target trigger count range, the target priority range, and the target audio duration range, corresponding compression information is determined for the audio resource.
5. The audio compression method according to claim 1, characterized in that, The step of determining corresponding compression information for the audio resource based on the target trigger count range, the target priority range, and the target audio duration range includes: Determine the compression information template; the compression information template includes multiple compression formats; Based on the target trigger count range, the target priority range, and the target audio duration range, a target compression format corresponding to the audio resource is determined from among the multiple compression formats.
6. The audio compression method according to claim 5, characterized in that, Before determining the compressed information template, the method further includes: Determine an initial compression information template, and edit the initial compression format in the initial compression information template to obtain a compressed information template.
7. The audio compression method according to claim 4, characterized in that, After compressing the audio resource according to the compression information, the method further includes: Determine the performance indicators to be observed; Determine the size of a first indicator of the performance metric to be observed corresponding to the audio resource, and determine the size of a second indicator of the performance metric to be observed corresponding to the default audio resource; the default audio resource is obtained by compressing the audio resource according to the default compression format; If the size of the first indicator is less than or equal to the size of the second indicator, the compression information is adjusted; or the parameter range is adjusted; the parameter range includes the trigger count range, the event priority range, and the audio duration range.
8. The audio compression method according to claim 1, characterized in that, The process of parsing the game audio event file to obtain the audio event name includes: The game audio event file is parsed to obtain parsed data, and preset audio trigger keywords are determined; If the preset audio trigger keyword exists in the parsed data, extract the audio event name corresponding to the preset audio trigger keyword from the parsed data.
9. The audio compression method according to claim 1, characterized in that, The process of parsing the game audio event file to obtain the audio event name includes: Determine the file size corresponding to the game audio event file, and determine a preset file size threshold corresponding to the game audio event file; If a first audio event file exists in the game audio event file, delete the first audio event file from the game audio event file to obtain the target game audio event file; the file size of the first audio event file is less than or equal to the preset file size threshold. The audio event names are obtained by parsing the target game audio event file.
10. The audio compression method according to claim 1, characterized in that, The counting of the number of times the audio event name appears includes: Obtain the key audio event name corresponding to the target game. If the key audio event name does not exist in the audio event name list, determine the second game audio event file corresponding to the audio event name. The second game audio event file is deleted from the game audio event file, and the first audio event name corresponding to the second game audio event file is deleted from the audio event name to obtain the target audio event name; The number of times the target audio event name appears is counted.
11. An audio compression device, characterized in that, include: The parsing module is configured to obtain the game audio event file corresponding to the target game, and parse the game audio event file to obtain the audio event name; The statistics module is configured to count the number of times the audio event name appears, and obtain the number of event triggers corresponding to the audio event name; A compression module is configured to determine corresponding compression information for the audio resource corresponding to the audio event name based on the event trigger count, and to compress the audio resource according to the compression information; wherein, the event trigger count includes the average event trigger count, and the compression module is specifically configured to: A target trigger count interval is determined from multiple trigger count intervals, to which the average trigger count of an event belongs. The average trigger count refers to the average number of times the audio event name appears in the game's audio event file. The audio event name corresponding to the average trigger count is determined, and the event priority interval corresponding to the audio event is determined, so as to determine the target priority interval corresponding to the audio event name within the event priority interval. The audio event corresponds to the audio event name. Based on the target trigger count interval and the target priority interval, corresponding compression information is determined for the audio resource corresponding to the audio event name.
12. An electronic device, characterized in that, include: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the audio compression method of any one of claims 1-10 by executing the executable instructions.
13. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a processor, it implements the audio compression method according to any one of claims 1-10.
Citation Information
Patent Citations
Game micro-end construction method based on click density
CN109783732A
Audio resource allocation method, device and facilityin game applicationand storage medium
CN110270096A