Sound reproduction method and apparatus, storage medium, and electronic apparatus
Abstract
This application discloses a sound reproduction method performed at a computing device. The method includes: detecting, by the computing device, a sound triggering event that corresponds to a first virtual object, the sound triggering event carrying sound source feature information used for matching a sound source; determining, by the computing device according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located; determining, by the terminal according to the first transmission distance, a target sound of the sound source at the first position; and generating, by the terminal, the target sound at the first position in the virtual scene. This application resolves a technical problem that accuracy of sound reproduction is relatively low in a sound reproduction method.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A sound reproduction method performed at a computing device having one or more processors and memory storing a plurality of programs to be executed by the one or more processors, the method comprising:
configuring, by the computing device, a sound effect for a first virtual object in a virtual scene, the sound effect being associated with an attribute of the first virtual object;
detecting, by the computing device, a sound triggering event within a sound source detection scope that is in the virtual scene and that corresponds to a first virtual object, the sound triggering event carrying sound source feature information used for defining a sound source in the virtual scene and generated after the first virtual object performs a triggering operation;
after the sound triggering event is detected, determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene;
determining, by the computing device and according to the first transmission distance, a target sound signal of the sound source at the first position; and
generating, by the computing device, the target sound signal at the first position in the virtual scene.
2. The method according to claim 1 , wherein the determining, by the computing device and according to the first transmission distance, a target sound signal of the sound source at the first position comprises:
determining, by the computing device, a virtual environment in which the first virtual object is currently located based on the virtual scene;
obtaining, by the computing device, a sound curve of the sound source matching the virtual environment, the sound curve being used for indicating a correspondence between a sound signal generated by the sound source and a transmission distance; and
determining, by the computing device from the sound curve, the target sound signal matching the first transmission distance.
3. The method according to claim 2 , wherein before the detecting, by the computing device, a sound triggering event, the method further comprises:
generating, by the computing device, the sound curve of the sound source, the sound curve comprising: a first curve and a second curve, the first curve being used for indicating a curve segment without attenuation of the sound triggered by the sound source, and the second curve being used for indicating a curve segment with attenuation of the sound triggered by the sound source.
4. The method according to claim 2 , wherein the determining, by the computing device from the sound curve, the target sound signal matching the first transmission distance comprises:
obtaining, by the computing device from the sound curve, an attenuation distance of the sound source, wherein the sound triggered by the sound source becomes irreproducible beyond the attenuation distance; and
determining, by the computing device, the target sound signal matching the first transmission distance when the first transmission distance is less than the attenuation distance.
5. The method according to claim 1 , wherein the determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene comprises:
extracting, by the computing device and from the sound source feature information, sound source coordinates used for indicating the sound source position; and
calculating, by the computing device, the first transmission distance according to the sound source coordinates and position coordinates corresponding to the first position in the virtual scene.
6. The method according to claim 1 , wherein the generating, by the computing device, the target sound signal at the first position in the virtual scene comprises:
when one sound source is detected, determining, by the computing device, the target sound signal of the sound source at the first position; and generating the target sound signal at the first position; and
when at least two sound sources are detected, determining, by the computing device, respective object target sound signals of the at least two sound sources at the first position; synthesizing the object target sound signals into the target sound signal; and generating the target sound signal at the first position.
7. The method according to claim 6 , wherein the synthesizing, by the computing device, the object target sound signals into the target sound signal comprises at least one of the following:
synthesizing, by the computing device, the object target sound signals according to preconfigured proportions, into the target sound signal;
obtaining, by the computing device, the target sound signal from the object target sound signals according to preconfigured priorities; and
randomly retrieving, by the computing device, the target sound signal from the object target sound signals.
8. The method according to claim 1 , wherein the detecting, by the computing device, a sound triggering event comprises at least one of the following:
detecting, by the computing device, whether the first virtual object performs a sound triggering action, the sound triggering action being used for generating the sound triggering event;
detecting, by the computing device, whether a second virtual object interacting with the first virtual object triggers the sound triggering event, the second virtual object being controlled by the first virtual object;
detecting, by the computing device, whether a third virtual object triggers the sound triggering event, a fourth virtual object used for controlling the third virtual object and the first virtual object being associated objects in the virtual scene; and
detecting, by the computing device, whether the virtual environment in which the first virtual object is currently located comprises an environmental sound triggering object, the environmental sound triggering object being used for triggering the sound triggering event according to a predetermined period.
9. A computing device comprising one or more processors, memory coupled to the one or more processors, and a plurality of programs stored in the memory that, when executed by the one or more processors, cause the computing device to perform a plurality of operations including:
configuring, by the computing device, a sound effect for a first virtual object in a virtual scene, the sound effect being associated with an attribute of the first virtual object;
detecting, by the computing device, a sound triggering event within a sound source detection scope that is in the virtual scene and that corresponds to a first virtual object, the sound triggering event carrying sound source feature information used for defining a sound source in the virtual scene and generated after the first virtual object performs a triggering operation;
after the sound triggering event is detected, determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene;
determining, by the computing device and according to the first transmission distance, a target sound signal of the sound source at the first position; and
generating, by the computing device, the target sound signal at the first position in the virtual scene.
10. The computing device according to claim 9 , wherein the determining, by the computing device and according to the first transmission distance, a target sound signal of the sound source at the first position comprises:
determining, by the computing device, a virtual environment in which the first virtual object is currently located based on the virtual scene;
obtaining, by the computing device, a sound curve of the sound source matching the virtual environment, the sound curve being used for indicating a correspondence between a sound signal generated by the sound source and a transmission distance; and
determining, by the computing device from the sound curve, the target sound signal matching the first transmission distance.
11. The computing device according to claim 10 , wherein the plurality of operations further comprise:
before detecting, by the computing device, the sound triggering event, generating, by the computing device, the sound curve of the sound source, the sound curve comprising: a first curve and a second curve, the first curve being used for indicating a curve segment without attenuation of the sound triggered by the sound source, and the second curve being used for indicating a curve segment with attenuation of the sound triggered by the sound source.
12. The computing device according to claim 10 , wherein the determining, by the computing device from the sound curve, the target sound signal matching the first transmission distance comprises:
obtaining, by the computing device from the sound curve, an attenuation distance of the sound source, wherein the sound triggered by the sound source becomes irreproducible beyond the attenuation distance; and
determining, by the computing device, the target sound signal matching the first transmission distance when the first transmission distance is less than the attenuation distance.
13. The computing device according to claim 9 , wherein the determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene comprises:
extracting, by the computing device and from the sound source feature information, sound source coordinates used for indicating the sound source position; and
calculating, by the computing device, the first transmission distance according to the sound source coordinates and position coordinates corresponding to the first position in the virtual scene.
14. The computing device according to claim 9 , wherein the generating, by the computing device, the target sound signal at the first position in the virtual scene comprises:
when one sound source is detected, determining, by the computing device, the target sound signal of the sound source at the first position; and generating the target sound signal at the first position; and
when at least two sound sources are detected, determining, by the computing device, respective object target sound signals of the at least two sound sources at the first position; synthesizing the object target sound signals into the target sound signal; and generating the target sound signal at the first position.
15. The computing device according to claim 14 , wherein the synthesizing, by the computing device, the object target sound signals into the target sound signal comprises at least one of the following:
synthesizing, by the computing device, the object target sound signals according to preconfigured proportions, into the target sound signal;
obtaining, by the computing device, the target sound signal from the object target sound signals according to preconfigured priorities; and
randomly retrieving, by the computing device, the target sound signal from the object target sound signals.
16. The computing device according to claim 9 , wherein the detecting, by the computing device, a sound triggering event comprises at least one of the following:
detecting, by the computing device, whether the first virtual object performs a sound triggering action, the sound triggering action being used for generating the sound triggering event;
detecting, by the computing device, whether a second virtual object interacting with the first virtual object triggers the sound triggering event, the second virtual object being controlled by the first virtual object;
detecting, by the computing device, whether a third virtual object triggers the sound triggering event, a fourth virtual object used for controlling the third virtual object and the first virtual object being associated objects in the virtual scene; and
detecting, by the computing device, whether the virtual environment in which the first virtual object is currently located comprises an environmental sound triggering object, the environmental sound triggering object being used for triggering the sound triggering event according to a predetermined period.
17. A non-transitory computer readable storage medium, storing a plurality of computer programs in connection with a computing device having one or more processors, wherein the plurality of computer programs, when executed by the one or more processors, cause the computing device to perform a plurality of operations including:
configuring, by the computing device, a sound effect for a first virtual object in a virtual scene, the sound effect being associated with an attribute of the first virtual object;
detecting, by the computing device, a sound triggering event within a sound source detection scope that is in the virtual scene and that corresponds to a first virtual object, the sound triggering event carrying sound source feature information used for defining a sound source in the virtual scene and generated after the first virtual object performs a triggering operation;
after the sound triggering event is detected, determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene;
determining, by the computing device and according to the first transmission distance, a target sound signal of the sound source at the first position; and
generating, by the computing device, the target sound signal at the first position in the virtual scene.
18. The non-transitory computer readable storage medium according to claim 17 , wherein the determining, by the computing device and according to the sound source feature information, a sound source position at which the sound source is located, and obtaining a first transmission distance between the sound source position and a first position at which the first virtual object is located in the virtual scene comprises:
extracting, by the computing device and from the sound source feature information, sound source coordinates used for indicating the sound source position; and
calculating, by the computing device, the first transmission distance according to the sound source coordinates and position coordinates corresponding to the first position in the virtual scene.
19. The non-transitory computer readable storage medium according to claim 17 , wherein the generating, by the computing device, the target sound signal at the first position in the virtual scene comprises:
when one sound source is detected, determining, by the computing device, the target sound signal of the sound source at the first position; and generating the target sound signal at the first position; and
when at least two sound sources are detected, determining, by the computing device, respective object target sound signals of the at least two sound sources at the first position; synthesizing the object target sound signals into the target sound signal; and generating the target sound signal at the first position.
20. The non-transitory computer readable storage medium according to claim 17 , wherein the detecting, by the computing device, a sound triggering event comprises at least one of the following:
detecting, by the computing device, whether the first virtual object performs a sound triggering action, the sound triggering action being used for generating the sound triggering event;
detecting, by the computing device, whether a second virtual object interacting with the first virtual object triggers the sound triggering event, the second virtual object being controlled by the first virtual object;
detecting, by the computing device, whether a third virtual object triggers the sound triggering event, a fourth virtual object used for controlling the third virtual object and the first virtual object being associated objects in the virtual scene; and
detecting, by the computing device, whether the virtual environment in which the first virtual object is currently located comprises an environmental sound triggering object, the environmental sound triggering object being used for triggering the sound triggering event according to a predetermined period.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.