Audio playing method and device, medium, electronic equipment and storage medium
By determining the positional relationship between the sounding body and the listener in a virtual scene and selecting appropriate audio resources, the problem that the existing technology cannot distinguish the sound source in the upper and lower space dimensions is solved, and a better gaming experience is achieved.
Patent Information
- Application Number
- CN202510096799.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-04-04
AI Technical Summary
The existing technology cannot accurately distinguish the source of sound in the upper and lower spatial dimensions of the game scene, affecting the player's immersion and competitive experience.
By responding to the sound playback event triggered in the virtual scene, the positional relationship between the sound generator and the listener is determined, the appropriate target audio resource is selected according to the hierarchical relationship, and the playback is performed to achieve three-dimensional positioning of the sound.
This allows players to clearly distinguish the source of sound in the height direction, greatly improving the gaming experience.
Smart Images

Figure CN119746404A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of audio processing technology, and in particular to an audio playback method, device, medium, electronic device and storage medium. Background Art
[0002] In game scenes, especially in game scenes with upper and lower spatial distinctions, the accuracy of sound positioning is crucial to enhancing the player's immersion and competitive experience. In related technologies, the sound can be spatialized so that the user can distinguish the left and right sources of the sound in the game scene. However, spatializing the sound does not allow the user to distinguish the source of the sound in the upper and lower spatial dimensions of the game scene. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides an audio playback method, comprising: In response to a sound playback event triggered in a virtual scene, determining a first position of a sound emitter corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; Determining a hierarchical relationship between the sound emitter and the listener in a height direction of the virtual scene according to the first position and the second position; Determining, according to the hierarchical relationship, a target audio resource emitted by the sound emitter that matches the sound playback event; Play the target audio resource.
[0005] In a second aspect, the present disclosure provides an audio playback device, comprising: A first determination module is configured to determine, in response to a sound playback event triggered in a virtual scene, a first position of a sound emitter corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; A second determining module is configured to determine a hierarchical relationship between the sound source and the listener in a height direction of the virtual scene according to the first position and the second position; A third determination module is configured to determine, according to the hierarchical relationship, a target audio resource emitted by the sound emitter that matches the sound playback event; The playing module is configured to play the target audio resource.
[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when the computer program is executed by a processing device.
[0007] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect when executed by a processor.
[0009] Based on the above technical solution, by responding to a sound playback event triggered in a virtual scene, the first position of the sound source corresponding to the sound playback event in the virtual scene and the second position of the listener in the virtual scene are determined, and then the hierarchical relationship between the sound source and the listener in the height direction of the virtual scene is determined based on the first position and the second position, and based on the hierarchical relationship, the target audio resource emitted by the sound source that matches the sound playback event is determined, and then the target audio resource is played. Since the same sound playback event will correspond to target audio resources with different sound effects under different hierarchical relationships, players can clearly distinguish the source of the sound in the height direction, which greatly improves the player's gaming experience.
[0010] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 The figure is a flowchart of an audio playing method according to an exemplary embodiment.
[0012] Figure 2 yes Figure 1 A detailed flow chart of step 120 is shown.
[0013] Figure 3 is a schematic diagram of a virtual scene according to an exemplary embodiment.
[0014] Figure 4 is a flowchart of an audio playing method according to another exemplary embodiment.
[0015] Figure 5 The figure is a schematic diagram showing the structure of an audio playback device according to an exemplary embodiment.
[0016] Figure 6 It is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0018] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0019] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0024] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information (such as the device type of the terminal device). Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0025] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0026] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0027] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0028] Figure 1 FIG. 1 is a flow chart of an audio playing method according to an exemplary embodiment. Figure 1 As shown, the embodiment of the present disclosure provides an audio playback method, which can be specifically performed by an audio playback device, which can be implemented by software and / or hardware and configured in an electronic device. Figure 1 As shown, the method may include the following steps.
[0029] In step 110, in response to a sound play event triggered in a virtual scene, a first position of a sound emitter corresponding to the sound play event in the virtual scene and a second position of a listener in the virtual scene are determined.
[0030] Here, the virtual scene may refer to a game scene, such as a three-dimensional game scene and a virtual reality scene, etc. The sound playback event may refer to an event triggered by a second virtual character other than the first virtual character controlled by the terminal device in the virtual scene. The second virtual character may be a player-controlled character or a non-player-controlled character. For example, the second virtual character may be a game character controlled by other players, or the second virtual character may be a monster in the virtual scene.
[0031] Of course, the sound playback event can be an event triggered by the second virtual character to instruct the playback of a specific type of sound. For example, the sound playback event can be an event triggered by the second virtual character to instruct the playback of footsteps. It should be noted that the audio resources in the game usually refer to the music, sound effects, voice and other audio in the game. The audio resources in the game are driven by the events of the game and controlled by the game parameters. For example, for shooting games, shooting is a game event and distance is a game parameter. When a character in the game performs a shooting action, the game will play the sound of the gun, and the distance will determine the hearing of the gun.
[0032] It is worth noting that, in the disclosed embodiment, all types of sound playback events can be played by the audio playback method provided by the disclosed embodiment. Of course, only specific types of sound playback events can be played by the audio playback method provided by the disclosed embodiment. For example, for a sound playback event for indicating the playback of footsteps, it can be played by the audio playback method provided by the disclosed embodiment. For a sound playback event for indicating the playback of gunshots, it may not be played by the audio playback method provided by the disclosed embodiment.
[0033] The sound emitter corresponding to the sound playback event refers to the object or event that generates sound in the virtual scene. The sound emitter can be any element in the game world as long as it can make a sound. For example, the dialogue of characters, the sound of weapons shooting, the sound of wind and rain in the environment, the sound of vehicle engines, the footsteps of virtual characters, etc. can all be considered as sound emitters.
[0034] For example, assuming that the sound playing event is triggered by the second virtual character, the sound source corresponding to the sound playing event is an object associated with the second virtual character and used to play the sound triggered by the second virtual character.
[0035] The listener refers to a character or player who receives and perceives sounds in a virtual scene. The listener corresponds to the virtual character controlled by the player, and the player perceives the sounds in the virtual scene through the listener. It should be noted that the second position of the listener is associated with the position of the virtual character controlled by the player corresponding to the listener.
[0036] The first position of the sound emitter in the virtual scene refers to the coordinate position of the sound emitter in the virtual scene. The second position of the listener in the virtual scene refers to the coordinate position of the listener in the virtual scene. In the case where the virtual scene is a three-dimensional game scene, the first position and the second position can be represented by three-dimensional coordinates.
[0037] In step 120, the hierarchical relationship between the sound source and the listener in the height direction of the virtual scene is determined according to the first position and the second position.
[0038] Here, the hierarchical relationship between the sound emitter and the listener in the height direction of the virtual scene refers to the hierarchical nature and relative height difference between different spaces of the sound emitter and the listener in the height direction of the virtual scene. Exemplarily, the hierarchical relationship may refer to the floor relationship between the sound emitter and the listener in the virtual scene. For example, the hierarchical relationship may refer to the sound emitter and the listener being on the same floor, the sound emitter being downstairs from the listener, or the sound emitter being upstairs from the listener.
[0039] Through the first position of the sound emitter and the second position of the listener, the hierarchical relationship between the sound emitter and the listener in the virtual scene can be calculated, so as to determine the audio resources emitted by the sound emitter according to different hierarchical relationships.
[0040] In step 130, a target audio resource that matches the sound playback event and is emitted by the sound emitter is determined according to the hierarchical relationship.
[0041] Here, different target audio resources correspond to different hierarchical relationships. That is, for the same sound playing event, under different hierarchical relationships, the target audio resources corresponding to the sound playing event are different.
[0042] In some embodiments, the hierarchical relationship includes a first hierarchical relationship, a second hierarchical relationship, and a third hierarchical relationship. The first hierarchical relationship indicates that the sound source and the listener are in the same height interval. The second hierarchical relationship indicates that the height interval where the sound source is located is greater than the height interval where the listener is located. The third hierarchical relationship indicates that the height interval where the sound source is located is less than the height interval where the listener is located.
[0043] The height space of the virtual scene can be divided into a plurality of different height intervals in the height direction of the virtual scene. For example, different floors can represent different height intervals. Accordingly, the first hierarchical relationship can represent that the sound emitter and the listener are on the same floor, the second hierarchical relationship can represent that the sound emitter is above the listener, and the third hierarchical relationship can represent that the sound emitter is below the listener.
[0044] Assuming that the sound playback event is an event for indicating the playback of footsteps, when the hierarchical relationship indicates that the sound emitter and the listener are on the same floor, the target audio resource emitted by the sound emitter and matching the sound playback event may be the original footsteps. When the hierarchical relationship indicates that the sound emitter is on the upper floor of the listener, the target audio resource emitted by the sound emitter and matching the sound playback event may be a first audio resource obtained by processing the original footsteps through a low-pass filter and superimposing a preset vibration sound on the processed footsteps. When the hierarchical relationship indicates that the sound emitter is on the lower floor of the listener, the target audio resource emitted by the sound emitter and matching the sound playback event may be a second audio resource obtained by processing the original footsteps through a high-pass filter and a reverb effector.
[0045] That is to say, although the sound emitters all play footsteps, the sound effects of the footsteps will be different under different hierarchical relationships.
[0046] It is worth noting that the target audio resource is determined by the hierarchical relationship. Under different hierarchical relationships, the same sound playback event will correspond to different target audio resources, so that the user can clearly distinguish the source of the sound in the height direction.
[0047] In step 140 , the target audio resource is played.
[0048] Here, the terminal device playing the target audio resource means outputting the target audio resource through the audio output hardware of the terminal device, for example, playing the target audio resource through a speaker of the terminal device or a connected headset.
[0049] Thus, by responding to the sound playback event triggered in the virtual scene, the first position of the sound source corresponding to the sound playback event in the virtual scene and the second position of the listener in the virtual scene are determined, and then the hierarchical relationship between the sound source and the listener in the height direction of the virtual scene is determined based on the first position and the second position, and the target audio resource emitted by the sound source that matches the sound playback event is determined based on the hierarchical relationship, and then the target audio resource is played. Since the same sound playback event will correspond to target audio resources with different sound effects under different hierarchical relationships, players can clearly distinguish the source of the sound in the height direction, which greatly improves the player's gaming experience. For example, in a multiplayer shooting game, for footsteps on the same floor, upstairs, and downstairs, since the sound effects of the footsteps are different, players can clearly distinguish that the footsteps come from the same floor, upstairs, or downstairs of the virtual character controlled by the player.
[0050] Figure 2 yes Figure 1 Detailed flow chart of step 120 is shown. Figure 2 As shown, in some possible implementations, step 120 may include the following steps.
[0051] In step 121, the distance between the sound source and the listener in the height direction is determined according to the first position and the second position.
[0052] Here, the distance between the sound source and the listener in the height direction of the virtual scene is calculated by the first position and the second position. For example, taking a three-dimensional game scene as an example, the first position is (X1, Y1, Z1) and the second position is (X2, Y2, Z2), then the distance between the sound source and the listener in the height direction is the absolute value of (Z1-Z2).
[0053] In step 122, a first angle between a line between the sound source and the listener and a horizontal plane is determined according to the first position and the second position.
[0054] Here, the line between the sound source and the listener is determined through the first position and the second position, and then the first angle between the line between the sound source and the listener and the horizontal plane is determined through the line between the sound source and the listener.
[0055] The horizontal plane of the virtual scene may refer to a plane in the virtual scene that is perpendicular to the direction of gravity, and the horizontal plane is a basic part of the virtual scene.
[0056] It is worth noting that the first angle has a direction and a magnitude. If the connecting line is below the horizontal plane, the first angle is negative, and if the connecting line is above the horizontal plane, the first angle is positive. Exemplarily, the value of the first angle can be [-90°, 90°].
[0057] In step 123, the hierarchical relationship is determined according to the distance and the first angle.
[0058] Here, after the distance and the first angle are determined, the hierarchical relationship between the sound source and the listener is determined by the distance and the first angle.
[0059] It should be noted that the direction of the sound source relative to the listener can be clearly distinguished by the first angle between the line between the sound source and the listener and the horizontal plane. For example, the first angle can be used to distinguish whether the sound source is below or above the listener. The height distance between the sound source and the listener can be used to clearly distinguish whether the sound source and the listener are in the same height range.
[0060] Following the above embodiment, when the distance is less than or equal to a preset distance threshold or the first angle is within a preset angle range, the hierarchical relationship is determined to be a first hierarchical relationship.
[0061] The preset distance threshold may be a distance threshold used to characterize that the sound source and the listener are in the same height range. Exemplarily, the preset distance threshold may be 300 cm. Of course, the preset distance threshold may be set according to actual conditions. For example, the preset distance threshold is determined according to the floor height of the building in the virtual scene. Exemplarily, if the floor height of the building in the virtual scene is 400 cm, the preset distance threshold may be 400 cm.
[0062] The preset angle range may be an angle range used to characterize that the sound source and the listener are in the same height range. Exemplarily, the preset angle range may be [-45°, 45°]. Of course, the preset angle range may also be set according to actual conditions. For example, the preset angle range may be determined according to the floor height of the building in the virtual scene. Exemplarily, the greater the floor height of the building in the virtual scene, the greater the upper limit of the preset angle range may be and the smaller the lower limit of the preset angle range may be. For example, the preset angle range may be [-60°, 60°].
[0063] When the distance between the sound source and the listener in the height direction is less than or equal to the preset distance threshold, it means that the sound source and the listener are in the same height interval. When the first angle is within the preset angle range, it means that the sound source and the listener are in the same height interval.
[0064] When the distance is greater than a preset distance threshold and the first angle is greater than an upper limit of a preset angle range, the hierarchical relationship is determined to be a second hierarchical relationship.
[0065] When the distance between the sound source and the listener in the height direction is greater than the preset distance threshold, it means that the sound source and the listener are in different height intervals. Under the premise that the distance is greater than the preset distance threshold, if the first angle is greater than the upper limit of the preset angle range, it means that the sound source is located above the listener, that is, the height interval where the sound source is located is greater than the height interval where the listener is located. Therefore, the hierarchical relationship between the sound source and the listener is a second-level relationship.
[0066] When the distance is less than the second distance threshold and the first angle is less than the lower limit of the preset angle range, it is determined that the hierarchical relationship is a third hierarchical relationship.
[0067] When the distance between the sound source and the listener in the height direction is greater than the preset distance threshold, it means that the sound source and the listener are in different height intervals. Under the premise that the distance is greater than the preset distance threshold, if the first angle is less than the lower limit of the preset angle range, it means that the sound source is located below the listener, and the height interval where the sound source is located is less than the height interval where the listener is located. Therefore, the hierarchical relationship between the sound source and the listener is a third-level relationship.
[0068] It can be seen that through the distance and the first angle, the different hierarchical relationships between the sound emitter and the listener can be clearly distinguished in the virtual scene, so that the target audio resources played by the same type of sound playback event in different hierarchical relationships are different.
[0069] Figure 3 is a schematic diagram of a virtual scene according to an exemplary embodiment. Figure 3 As shown, in the virtual scene 200, assuming that the listener 201 corresponding to the first virtual character controlled by the electronic device is 310 cm away from the first sound source 202 used to play the footsteps of the second virtual character in the height direction, and the first angle between the listener 201 and the first sound source 202 is 46°, the hierarchical relationship between the first sound source 202 and the listener 201 is a second hierarchical relationship.
[0070] Assuming that the distance in height direction between the listener 201 corresponding to the first virtual character controlled by the electronic device and the second sound-emitting body 203 used to play the footsteps of the third virtual character is 390 cm, and the first angle between the listener 201 and the second sound-emitting body 203 is -70°, the hierarchical relationship between the second sound-emitting body 203 and the listener 201 is a third-level relationship.
[0071] It is worth mentioning that Figure 3 The second position of the listener 201 in the embodiment is only used as an example to illustrate the embodiment of the present disclosure, and does not mean that in a specific implementation, the second position of the listener 201 can only be as follows. Figure 3 As shown, the specific setting method of the listener 201 in the virtual scene can be set according to actual conditions.
[0072] It should be noted that, for other extreme cases, the type of the sound playback event can be used to determine whether to use the audio playback method provided by the embodiment of the present disclosure to process the sound playback event. Of course, it is also possible to determine whether to use the audio playback method provided by the embodiment of the present disclosure to process the sound playback event by setting preset distance thresholds of different sizes for different types of sound playback events.
[0073] like Figure 3 As shown, it is assumed that the distance in the height direction between the listener 201 corresponding to the first virtual character controlled by the electronic device and the third sound-emitting body 204 for playing the footsteps of the fourth virtual character is 150 cm, and the first angle between the listener 201 and the second sound-emitting body 203 is -46°. At this time, the fourth virtual character is on the same floor as the third virtual character, but the fourth virtual character is located on the box, resulting in the distance between the listener 201 and the third sound-emitting body 204 being smaller than the distance between the listener 201 and the second sound-emitting body 203. Since the fourth virtual character and the third virtual character are in contact with different media, the type of footsteps will not be different, so the type of sound playback event will also be different. Therefore, the preset distance threshold corresponding to the sound-emitting body for emitting footsteps located on the box can be set smaller, so that the hierarchical relationship between the third sound-emitting body 204 and the listener 201 can also be determined as a third-level relationship.
[0074] Therefore, through the distance and the first angle, the different hierarchical relationships between the sound source and the listener can be clearly distinguished in the virtual scene, so that the target audio resources played by the same type of sound playback event in different hierarchical relationships are different.
[0075] In some feasible implementations, in step 130, when the hierarchical relationship is a first hierarchical relationship, the original audio resource corresponding to the sound playing event is determined as the target audio resource.
[0076] Here, for a detailed description of the first hierarchical relationship, please refer to the relevant description of the above implementation method, which will not be repeated here. When the hierarchical relationship between the sound source and the listener is a first hierarchical relationship, it means that the sound source and the listener are on the same floor. At this time, the original audio resource corresponding to the sound playback event can be determined as the target audio resource.
[0077] It should be understood that the original audio resource corresponding to the sound play event may refer to a stereo audio resource produced for the sound play event, and the original audio resource may be understood as a basic audio resource. Taking the sound play event as an event for indicating the play of footsteps as an example, the original audio resource is the original footsteps pre-produced by the game developer.
[0078] That is to say, when the hierarchical relationship is the first hierarchical relationship, the sound source plays the original audio resource.
[0079] In some feasible implementations, in step 130, when the hierarchical relationship is the second hierarchical relationship, the first audio resource is determined as the target audio resource, and the first audio resource is obtained by processing the original audio resource through a low-pass filter.
[0080] Here, for a detailed description of the second hierarchical relationship, reference may be made to the relevant description of the above implementation manner, which will not be repeated here. When the hierarchical relationship between the sound source and the listener is a second hierarchical relationship, it means that the sound source and the listener are on different floors, and the sound source is located above the listener. At this time, the first audio resource can be determined as the target audio resource.
[0081] The first audio resource is obtained by processing the original audio resource through a low-pass filter. It should be noted that the parameters of the low-pass filter can be set according to actual conditions.
[0082] In some embodiments, when the original audio resource is footsteps, the first audio resource is obtained by processing the original footsteps through a low-pass filter and superimposing a preset vibration sound on the processed footsteps.
[0083] For example, the preset vibration sound may be an audio resource representing floor vibration. By processing the original footsteps through a low-pass filter and superimposing the audio resource representing floor vibration on the low-pass filtered footsteps, the first audio resource can accurately simulate the footsteps coming from the upper floor.
[0084] In some feasible implementations, in step 130, when the hierarchical relationship is a third hierarchical relationship, a second audio resource is determined as a target audio resource, and the second audio resource is obtained by processing the original audio resource through a high-pass filter and a reverberation effector.
[0085] Here, for a detailed description of the third hierarchical relationship, please refer to the relevant description of the above implementation method, which will not be repeated here. When the hierarchical relationship between the sound source and the listener is the third hierarchical relationship, it means that the sound source and the listener are on different floors, and the sound source is located downstairs from the listener. At this time, the second audio resource can be determined as the target audio resource.
[0086] The second audio resource is obtained by processing the original audio resource through a high-pass filter and a reverb effector. That is, the second audio resource is obtained by adding a high-pass filter and a reverb effector to the original audio resource. It should be noted that the parameters of the high-pass filter and the reverb effector can be set according to actual conditions.
[0087] It is worth noting that the original audio resource, the first audio resource and the second audio resource can all be pre-made audio resources. Of course, in other implementations, the original audio resource can be a pre-made audio resource, and the first audio resource and the second audio resource can be made in real time based on the original audio resource.
[0088] Therefore, under different hierarchical relationships, the sound effects of the target audio resources corresponding to the same type of sound playback event are different, so that players can clearly distinguish the source of the sound in the height direction through hearing, greatly improving the player's gaming experience.
[0089] In some achievable implementations, after step 130, the volume and / or reverberation effect of the target audio resource is adjusted according to the second angle between the orientation of the virtual character corresponding to the listener and the horizontal plane to obtain an adjusted target audio resource. Accordingly, in step 140, the adjusted target audio resource can be played.
[0090] Here, the orientation of the virtual character may refer to the direction the virtual character faces or the main orientation of the body in the virtual scene. Since the listener is associated with the virtual character controlled by the player, and the virtual character has an orientation in the virtual scene, the sound effect of the target audio resource may be different when the orientation is different.
[0091] The second angle has a direction and a magnitude. If the connecting line is below the horizontal plane, the second angle is negative, and if the connecting line is above the horizontal plane, the second angle is positive. Exemplarily, the value of the second angle can be [-90°, 90°].
[0092] For second angles of different sizes, the volume and / or reverberation effect of the target audio resource may be adjusted to different degrees to obtain the adjusted target audio resource.
[0093] As some examples, when the second angle is greater than the first angle threshold, the volume of the target audio resource is increased and the reverberation effect of the target audio resource is reduced.
[0094] The first angle threshold may be 45°, and of course, the first angle threshold may also be set according to actual conditions. The second angle being greater than the first angle threshold actually indicates that the virtual character corresponding to the listener is facing a higher height interval, for example, the virtual character corresponding to the listener is facing upstairs.
[0095] When the second angle is greater than the first angle threshold, by increasing the volume of the target audio resource and reducing the reverberation effect of the target audio resource, the volume of the target audio resource that the player can hear can be louder and the reverberation effect can be lower.
[0096] As some further examples, when the second angle is less than a second angle threshold, the volume of the target audio resource is increased and the reverberation effect of the target audio resource is reduced.
[0097] The second angle threshold may be -45°, and of course, the second angle threshold may also be set according to actual conditions. The second angle being greater than the second angle threshold actually indicates that the virtual character corresponding to the listener is facing a lower height interval, for example, the virtual character corresponding to the listener is facing downstairs.
[0098] When the second angle is smaller than the second angle threshold, by increasing the volume of the target audio resource and reducing the reverberation effect of the target audio resource, the volume of the target audio resource that the player can hear can be louder and the reverberation effect can be lower.
[0099] That is to say, for the footsteps coming from downstairs and upstairs, when the virtual character corresponding to the listener faces different directions, the player will hear different footsteps coming from downstairs and upstairs. When the virtual character faces upstairs, the footsteps coming from upstairs are louder and have lower reverberation effect than those coming from downstairs. When the virtual character faces downstairs, the footsteps coming from downstairs are louder and have lower reverberation effect than those coming from upstairs.
[0100] Therefore, by adjusting the volume and / or reverberation effect of the target audio resource according to different directions, the played target audio resource can be made to meet the direction requirements of the virtual character, making the game more realistic.
[0101] In some feasible implementations, in step 140, based on the first position and the second position, the target audio resource is spatialized, and the spatialized target audio resource is played; and when the virtual character corresponding to the listener triggers the playing of an audio resource of the same type as the target audio resource, the audio resource is played directly.
[0102] Here, in the game, the first virtual character controlled by the electronic device and the second virtual character in the virtual scene usually use the same set of audio resources. For example, for footsteps, the footsteps triggered by the first virtual character and the second virtual character are all from the same set of footsteps resources. Therefore, if the same set of audio resources is used to play the same type of audio triggered by the first virtual character and the second virtual character, the player will not be able to distinguish whether the sound is generated by the first virtual character or the second virtual character.
[0103] In this regard, the target audio resource can be spatialized based on the first position and the second position, and the target audio resource after spatialization can be played. It should be noted that in the embodiments of the present disclosure, no specific limitation is made to spatialization. Spatialization is essentially to simulate the propagation of sound based on the relative position between the sound source and the listener using a sound propagation model, so that the target audio resource after spatialization can be more natural and realistic, or create a specific spatial atmosphere.
[0104] When the virtual character corresponding to the listener triggers the playback of an audio resource of the same type as the target audio resource, the audio resource is not spatialized and the stereo audio resource is played directly.
[0105] Of course, in other implementations, the volume of the target audio resource after spatialization processing may be further reduced to further distinguish the target audio resource triggered by the second virtual character from the audio resource of the same type as the target audio resource triggered by the first virtual character in terms of volume.
[0106] It is worth noting that, following the above implementation, the target audio resource may be an adjusted target audio resource obtained by adjusting the volume and / or reverberation effect of the target audio resource.
[0107] Therefore, through the above-mentioned implementation, even if the first virtual character and the second virtual character use the same audio resource, when the target audio resource triggered by the second virtual character and the audio resource of the same type as the target audio resource triggered by the first virtual character are played at the same time, the player can hear obvious differences in volume, sound image and timbre, thereby facilitating the player to distinguish between the sound triggered by the player himself and the sound triggered by other characters.
[0108] In some feasible implementations, in step 140, an occlusion coefficient corresponding to an obstacle between the sound-emitting body and the listener is determined, and then, when the obstacle includes a virtual object for distinguishing different hierarchical relationships in the height direction, the occlusion coefficient of the virtual object is reduced to obtain an adjusted occlusion coefficient, and based on the adjusted occlusion coefficient, sound occlusion processing is performed on the target audio resource to obtain the target audio resource after occlusion processing, and then the target audio resource after occlusion processing is played.
[0109] Here, in real scenes, the direct sound after the sound is emitted and the reflected sound after multiple reflections are heard by the human ear after a period of time. If there is an obstacle between the sound source and the human ear, the sound will bypass (diffraction) or pass through (transmission) the obstacle, thus forming different sound effects.
[0110] The obstacle between the sound source and the listener may refer to an obstacle on the propagation path between the sound source and the listener. The occlusion coefficient of an obstacle is a parameter used to quantify the effect of an obstacle on sound propagation. The occlusion coefficient indicates the degree to which the sound is attenuated when passing through the obstacle. The value of the occlusion coefficient is usually between 0 and 1. The larger the value, the stronger the occlusion effect of the obstacle on the sound.
[0111] The virtual objects used to distinguish different hierarchical relationships in the height direction are floors and roofs set in the virtual scene. When the sound propagation path between the sound source and the listener includes the virtual objects used to distinguish different hierarchical relationships in the height direction, the occlusion coefficient of the virtual objects is reduced to obtain the adjusted occlusion coefficient.
[0112] That is to say, in the virtual scene, the occlusion coefficient of the roof and the floor will be smaller than the occlusion coefficient of the wall, so that the sounds from upstairs and downstairs can more easily penetrate the roof and the floor and be heard by the first virtual character.
[0113] Sound occlusion processing refers to the process of adjusting and processing the sound signal of the target audio resource according to the impact of obstacles on the sound propagation during the sound propagation process. Obstacles can be walls, buildings, furniture, terrain, etc., which will block or weaken the propagation of sound and change the sound when it reaches the listener.
[0114] By performing sound occlusion processing on the target audio resource through the adjusted occlusion coefficient, the sound emitted from upstairs and downstairs can be more easily penetrated by the roof and the floor, so as to be heard by the first virtual character.
[0115] It is worth noting that, following the above implementation, the target audio resource may be a target audio resource after spatialization processing.
[0116] Therefore, through the above implementation, the sounds emitted from upstairs and downstairs in the virtual scene can more easily penetrate the roof and the floor, and thus be heard by the players.
[0117] In some feasible implementations, in step 140 , the audio format of the target audio resource may be converted into an object-based audio format, and the target audio resource in the object-based audio format may be played.
[0118] Here, the audio format is the carrier of the sound after digitization. Different audio formats have different abilities to record sound. For the stereo audio format, only the sound in the 180° plane in front of the user can be recorded. Sound outside this range will be compressed into this area.
[0119] For a sound of the target audio resource type, the audio format of the target audio resource may be converted to an object-based audio format so that the target audio resource may be played using the object-based audio format.
[0120] Among them, the object-based audio format allows audio content to be divided into multiple independent audio objects or entities, each object can contain different audio elements.
[0121] By playing the target audio resource in the object-based audio format, the sounds from different hierarchical relationships can be played from different height spaces, so that players can more accurately locate the source of the sound. For example, playing the footsteps in the object-based audio format can make the footsteps coming from upstairs or downstairs be played from the upper space of the upstairs or the lower space of the downstairs.
[0122] Of course, other types of audio resources can be played using the Ambisonics audio format. Ambisonics is an audio technology that can capture and reproduce the position and directionality of sound in three-dimensional space. Because Ambisonics simulates the way sound propagates in the real world, including the direction, distance, reflection, and reverberation of sound, Ambisonics makes the audio experience more immersive and realistic.
[0123] It is worth noting that, following the above implementation, the target audio resource may be a target audio resource after spatialization processing. Of course, the target audio resource may also be a target audio resource after occlusion processing.
[0124] Therefore, by converting the audio format of the target audio resource into an object-based audio format, sounds from different hierarchical relationships can be truly played from different height spaces, allowing players to more accurately locate the source of the sound in the height direction.
[0125] In some feasible implementations, in step 140, sound rendering parameters matching the device type can be determined according to the device type to which the electronic device belongs, and based on the sound rendering parameters, the target audio resource can be rendered and the rendered target audio resource can be played.
[0126] Here, sound rendering is the last step in the audio processing flow. Sound rendering adjusts and optimizes the decoded audio data according to specific sound rendering parameters. Among them, sound rendering parameters can include volume, timbre, sound effects and other parameters. Sound rendering parameters determine the final performance of the sound in the speaker. Through sound rendering, audio data is converted into an analog signal suitable for speaker playback. This analog signal can drive the speaker's diaphragm to vibrate, thereby generating sound.
[0127] The device type of the electronic device can be determined by the system version and model of the electronic device. Different sound rendering parameters can be corresponding to electronic devices of different device types.
[0128] Exemplarily, a mapping relationship between different device types and different rendering options may be preconfigured, wherein each rendering option includes a sound rendering parameter that matches the device type.
[0129] After determining that the sound rendering parameters matching the device type are obtained, the target audio resource is rendered using the sound rendering parameters to obtain the rendered target audio resource, and the rendered target audio resource is played.
[0130] It should be understood that if the game does not have a sound rendering parameter that matches the device type, the player can be prompted to enable the corresponding system permissions. If the player does not enable the corresponding system permissions, the preset sound rendering parameters can be used to render the target audio resources to provide a comprehensive spatial positioning experience.
[0131] It is worth noting that since different types of electronic devices use different sound playback technologies, it is difficult for users to understand the difference between different playback technologies. In order for electronic devices to better utilize the characteristics of the system and hardware and render the best sound effects, the target audio resources are rendered using sound rendering parameters that match the device type. The audio resources in the virtual scene can adaptively match electronic devices of different device types to play the target audio resources, thereby achieving the best effect.
[0132] It should be noted that, following the above implementation, the target audio resource may be a target audio resource after spatialization processing, of course, the target audio resource may also be a target audio resource after occlusion processing, or the target audio resource may be a target audio resource in an object-based audio format after format conversion.
[0133] Therefore, through the above implementation, the playback of the target audio resource can be adaptively adapted to electronic devices of different device types, so that the sound effect of the target audio resource can be optimized.
[0134] Below, combined with the attached Figure 4 The above-mentioned embodiment will be described in detail.
[0135] Figure 4 FIG. 1 is a flowchart of an audio playback method according to another exemplary embodiment. Figure 4 As shown, in response to a sound playback event triggered in a virtual scene, a first position of a sound source corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene are determined, and then, based on the first position and the second position, a hierarchical relationship between the sound source and the listener in the height direction of the virtual scene is determined, and then, based on the hierarchical relationship, a target audio resource emitted by the sound source and matching the sound playback event is determined.
[0136] After the target audio resource is determined, the target audio resource may be spatially processed based on the first position and the second position to obtain the target audio resource after spatial processing.
[0137] After obtaining the target audio resource after spatialization processing, sound occlusion processing may be performed on the target audio resource after spatialization processing to obtain the target audio resource after occlusion processing.
[0138] After obtaining the target audio resource after occlusion processing, the audio format of the target audio resource after occlusion processing may be converted into an object-based audio format.
[0139] Finally, the target audio resource in the object-based audio format is rendered using the sound rendering parameters that match the device type, and the rendered target audio resource is played.
[0140] It is worth noting that under different hierarchical relationships, the same sound playback event corresponds to different target audio resources. Then, combined with spatial processing, sound occlusion processing, audio format conversion and sound rendering, it can ensure that players can clearly distinguish the source of the sound in the height direction in multiple processes of sound playback, greatly improving the player's gaming experience.
[0141] Figure 5 FIG. 1 is a schematic diagram showing the structure of an audio playback device according to an exemplary embodiment. Figure 5 As shown, the embodiment of the present disclosure provides an audio playback device 500, and the audio playback device 500 includes: A first determination module 501 is configured to determine, in response to a sound playback event triggered in a virtual scene, a first position of a sound emitter corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; A second determining module 502 is configured to determine a hierarchical relationship between the sound source and the listener in a height direction of the virtual scene according to the first position and the second position; A third determination module 503 is configured to determine, according to the hierarchical relationship, a target audio resource emitted by the sound emitter that matches the sound playback event; The playing module 504 is configured to play the target audio resource.
[0142] Optionally, the second determining module 502 is specifically configured to: Determining the distance between the sound source and the listener in a height direction according to the first position and the second position; Determine a first angle between a line between the sound source and the listener and a horizontal plane according to the first position and the second position; The hierarchical relationship is determined according to the distance and the first angle.
[0143] Optionally, the hierarchical relationship includes a first hierarchical relationship, a second hierarchical relationship and a third hierarchical relationship; the first hierarchical relationship indicates that the sound source and the listener are in the same height interval; the second hierarchical relationship indicates that the height interval where the sound source is located is greater than the height interval where the listener is located; the third hierarchical relationship indicates that the height interval where the sound source is located is less than the height interval where the listener is located; The second determining module 502 is specifically configured to: When the distance is less than or equal to a preset distance threshold or the first angle is within a preset angle range, determining that the hierarchical relationship is the first hierarchical relationship; When the distance is greater than the preset distance threshold and the first angle is greater than the upper limit of the preset angle range, determining that the hierarchical relationship is the second hierarchical relationship; When the distance is smaller than a second distance threshold and the first angle is smaller than a lower limit of the preset angle range, the hierarchical relationship is determined to be the third hierarchical relationship.
[0144] Optionally, the hierarchical relationship includes a first hierarchical relationship, a second hierarchical relationship and a third hierarchical relationship; the first hierarchical relationship indicates that the sound source and the listener are in the same height interval; the second hierarchical relationship indicates that the height interval where the sound source is located is greater than the height interval where the listener is located; the third hierarchical relationship indicates that the height interval where the sound source is located is less than the height interval where the listener is located; The third determining module 503 is specifically configured as follows: In a case where the hierarchical relationship is the first hierarchical relationship, determining the original audio resource corresponding to the sound playing event as the target audio resource; When the hierarchical relationship is the second hierarchical relationship, determining a first audio resource as the target audio resource, where the first audio resource is obtained by processing the original audio resource through a low-pass filter; In a case where the hierarchical relationship is the third hierarchical relationship, a second audio resource is determined as the target audio resource, and the second audio resource is obtained by processing the original audio resource through a high-pass filter and a reverberation effector.
[0145] Optionally, when the original audio resource is footsteps, the first audio resource is obtained by processing the original footsteps through a low-pass filter and superimposing a preset vibration sound on the processed footsteps.
[0146] Optionally, the audio playback device 500 further includes: an adjustment module, configured to adjust the volume and / or reverberation effect of the target audio resource according to a second angle between the orientation of the virtual character corresponding to the listener and the horizontal plane, to obtain an adjusted target audio resource; The playback module 504 is specifically configured as follows: Play the adjusted target audio resource.
[0147] Optionally, the playing module 504 is specifically configured to: Based on the first position and the second position, spatialize the target audio resource, and play the spatialized target audio resource; and In the case where the virtual character corresponding to the listener triggers the playing of an audio resource that is of the same type as the target audio resource, the audio resource is played directly.
[0148] Optionally, the playing module 504 is specifically configured to: Determining an occlusion coefficient corresponding to an obstacle between the sound source and the listener; In a case where the obstacle includes a virtual object for distinguishing different hierarchical relationships in a height direction, reducing an occlusion coefficient of the virtual object to obtain an adjusted occlusion coefficient; According to the adjusted occlusion coefficient, the target audio resource is subjected to sound occlusion processing to obtain the target audio resource after occlusion processing; Play the target audio resource after the occlusion processing.
[0149] Optionally, the playing module 504 is specifically configured to: The audio format of the target audio resource is converted into an object-based audio format, and the target audio resource in the object-based audio format is played.
[0150] Optionally, the playing module 504 is specifically configured to: Determining, according to the device type to which the electronic device belongs, a sound rendering parameter matching the device type; Based on the sound rendering parameters, the target audio resource is rendered, and the rendered target audio resource is played.
[0151] Regarding the audio playback device 500 in the above embodiment, the method logic executed by each functional module has been described in detail in the part about the method, which will not be repeated here.
[0152] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device (e.g., terminal device) 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0153] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0154] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0155] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0156] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0157] In some embodiments, the electronic devices may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0158] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0159] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: in response to a sound playback event triggered in a virtual scene, determines a first position of a sound source corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; determines a hierarchical relationship between the sound source and the listener in the height direction of the virtual scene based on the first position and the second position; determines a target audio resource emitted by the sound source that matches the sound playback event based on the hierarchical relationship; and plays the target audio resource.
[0160] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0161] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0162] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, constitute a limitation on the module itself.
[0163] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0164] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0165] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0166] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0167] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. An audio playback method, characterized in that: include: In response to a sound playback event triggered in a virtual scene, determining a first position of a sound emitter corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; Determining a hierarchical relationship between the sound emitter and the listener in a height direction of the virtual scene according to the first position and the second position; Determining, according to the hierarchical relationship, a target audio resource emitted by the sound emitter that matches the sound playback event; Play the target audio resource.
2. The method according to claim 1, characterized in that The determining, according to the first position and the second position, a hierarchical relationship between the sound emitter and the listener in a height direction of the virtual scene includes: Determining the distance between the sound source and the listener in a height direction according to the first position and the second position; Determine a first angle between a line between the sound source and the listener and a horizontal plane according to the first position and the second position; The hierarchical relationship is determined according to the distance and the first angle.
3. The method according to claim 2, characterized in that The hierarchical relationship includes a first hierarchical relationship, a second hierarchical relationship and a third hierarchical relationship; the first hierarchical relationship indicates that the sound source and the listener are in the same height interval; the second hierarchical relationship indicates that the height interval where the sound source is located is greater than the height interval where the listener is located; the third hierarchical relationship indicates that the height interval where the sound source is located is less than the height interval where the listener is located; The determining the hierarchical relationship according to the distance and the first angle includes: When the distance is less than or equal to a preset distance threshold or the first angle is within a preset angle range, determining that the hierarchical relationship is the first hierarchical relationship; When the distance is greater than the preset distance threshold and the first angle is greater than the upper limit of the preset angle range, determining that the hierarchical relationship is the second hierarchical relationship; When the distance is smaller than a second distance threshold and the first angle is smaller than a lower limit of the preset angle range, the hierarchical relationship is determined to be the third hierarchical relationship.
4. The method according to claim 1, characterized in that The hierarchical relationship includes a first hierarchical relationship, a second hierarchical relationship and a third hierarchical relationship; the first hierarchical relationship indicates that the sound source and the listener are in the same height interval; the second hierarchical relationship indicates that the height interval where the sound source is located is greater than the height interval where the listener is located; the third hierarchical relationship indicates that the height interval where the sound source is located is less than the height interval where the listener is located; The step of determining, according to the hierarchical relationship, a target audio resource emitted by the sound emitter and matching the sound playback event includes: In a case where the hierarchical relationship is the first hierarchical relationship, determining the original audio resource corresponding to the sound playing event as the target audio resource; When the hierarchical relationship is the second hierarchical relationship, determining a first audio resource as the target audio resource, where the first audio resource is obtained by processing the original audio resource through a low-pass filter; In a case where the hierarchical relationship is the third hierarchical relationship, a second audio resource is determined as the target audio resource, and the second audio resource is obtained by processing the original audio resource through a high-pass filter and a reverberation effector.
5. The method according to claim 4, characterized in that In the case that the original audio resource is footsteps, the first audio resource is obtained by processing the original footsteps through a low-pass filter and superimposing a preset vibration sound on the processed footsteps.
6. The method according to claim 1, characterized in that After determining the target audio resource emitted by the sound emitter and matching the sound playback event according to the hierarchical relationship, the method further includes: adjusting the volume and / or reverberation effect of the target audio resource according to a second angle between the orientation of the virtual character corresponding to the listener and the horizontal plane to obtain an adjusted target audio resource; The playing of the target audio resource comprises: Play the adjusted target audio resource.
7. The method according to any one of claims 1 to 6, characterized in that The playing of the target audio resource comprises: Based on the first position and the second position, spatialize the target audio resource, and play the spatialized target audio resource; and In the case where the virtual character corresponding to the listener triggers the playing of an audio resource that is of the same type as the target audio resource, the audio resource is played directly.
8. The method according to any one of claims 1 to 6, characterized in that The playing of the target audio resource comprises: Determining an occlusion coefficient corresponding to an obstacle between the sound source and the listener; In a case where the obstacle includes a virtual object for distinguishing different hierarchical relationships in a height direction, reducing an occlusion coefficient of the virtual object to obtain an adjusted occlusion coefficient; According to the adjusted occlusion coefficient, the target audio resource is subjected to sound occlusion processing to obtain the target audio resource after occlusion processing; Play the target audio resource after the occlusion processing.
9. The method according to any one of claims 1 to 6, characterized in that The playing of the target audio resource comprises: The audio format of the target audio resource is converted into an object-based audio format, and the target audio resource in the object-based audio format is played.
10. The method according to any one of claims 1 to 6, characterized in that The playing of the target audio resource comprises: Determining, according to the device type to which the electronic device belongs, a sound rendering parameter matching the device type; Based on the sound rendering parameters, the target audio resource is rendered, and the rendered target audio resource is played.
11. An audio playback device, characterized in that: include: A first determination module is configured to determine, in response to a sound playback event triggered in a virtual scene, a first position of a sound emitter corresponding to the sound playback event in the virtual scene and a second position of a listener in the virtual scene; A second determining module is configured to determine a hierarchical relationship between the sound source and the listener in a height direction of the virtual scene according to the first position and the second position; A third determination module is configured to determine, according to the hierarchical relationship, a target audio resource emitted by the sound emitter that matches the sound playback event; The playing module is configured to play the target audio resource.
12. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 10 are implemented.
13. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 10.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.