Good afternoon everybody,
I am trying to do something which I thought would be quite easy but I’m struggling. I currently have 6 audio files (.wav) loaded into TouchDesigner and I have setup a random generator to switch between them by providing the generated number as the index for a switch CHOP. When I generate a new random number, the switch CHOP does it’s thing and the new audio file plays but the transition between the two is a hard cut. How would I change the transition to a dissolve?
Thanks in advance.
a switchCHOP will cut between sources. If you want to fade, you’re looking a series of math chops, and likely a selectCHOP A/B switch system that has the current player, the one you’re fading to, and adjusts gain with whatever crossfade curve you’re trying to achieve, and another math chop set to add the CHOP values together, which is the source from which you’ll play back
Have a look at the Cross CHOP which is basically a switch with fading.
My technic is to put a math on each input with something moving gain on each channel (python script, slider, any suitable device) and a math adding every “channel”. All is included in a system where a “cueList” table have all the states, with a select/cross system to fade between base (sound and video).
Here is a quick example.
baseMixing.toe (27.7 KB)
This makes sense and looks applicable, I will give this a try. How do you go about triggering the cues? I am guessing that I would have to do so via Python as it would occur automatically when a pulse is received from a timer CHOP.
When using the Math CHOP for audio it’s also important to have everything at as high of a sample rate as possible. If you’re exporting a value to the .gain parameter of the Math CHOP then there will be steppiness in the output. It would be better to wire in a high-sample rate input and set the Combine CHOPs parameter to multiply. The Trigger CHOP can be useful as a high sample rate signal for volume.
I would recommend controlling the volume levels directly and doing this by using a timer as a ramp using the fraction index from 0 to 1 as the ramp to control the volume level - use a maths chop to set a reverse range from 1 to 0 so one side fades down as the other fades up. This is a nice way to do it as you can easily set the time you want to fade to occur over and change this dynamically, simply by changing the time over which the timer runs and you are assured of a nice crossfade.
I’ve knocked up a quick example for you - it uses the audio play chop which is great for working with audio files and clips - just tell each one your paths to the files you have to play in a .dat. You can use the crossfade button to trigger your next audio cue/clip or the 0 to 1 of the timer fraction etc etc.
I’ve put the crossfade time period in table1 so you can just update this per audio clip if you want a variable crossover time for different audio samples.
Audiocrossfade Example.toe (7.4 KB)
The Interp Pars per Sample parameter is taking care of that
Interp Pars per Sample
interppars - Use this option when the input is a higher frequency than the timeline (example: audio). It will avoid any pops or crackles in the output when adjusting the multiply, add or range parameters.