Fade in and fade out an audio file
Hi all,
I would like to create a spatial sound atmosphere. I made a script (very rudimentary) in which whenever the user turns the head 20 degrees, hears a different file (therefore I have 18 audio files in the scene, played simultaneously; one with volume =1, and the rest with volume = 0) Is there a way to made a fade out of the previous file and fade in of the new one in an overlapping sector of 10 degrees: 0-10 degrees: file 1 volume 1 (rest volume 0) 10-20: file 1 fade out, file 2 fade in (rest volume 0) 20-30: file 2 volume 1 (rest volume 0) 30-40: file 2 fade out, file 3 fade in (rest volume 0).... Maybe a way of changing the volume gradually in these junction circular sector regarding the position of the head? Thanks in advance |
I forgot to say that the user will be in a fixed position within the scene, and will only have the possibility of turning 360 degrees in this fixed position without displacements.
|
You could use the head tracker euler values to trigger custom events. There isn't built in sound fading so you would have to write a simple sound fader that reduces volume over a small period of time.
|
Quote:
|
Quote:
Any idea of how to write a fader that decreases the volume? Is there any tool with which it can be done? I am new in Vizard and I have no idea on how to make it in a simple way... |
You could use vizact.onupdate to register a function that's called every frame. In that function, get the viewpoint orientation and based on that value play and fade audio files. Here's an example:
Code:
#0-10 degrees: play file 1 |
All times are GMT -7. The time now is 05:59 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC