Creating Audio with CHOPs
Audio is managed with CHOPs in TouchDesigner. CHOPs can generate sounds and can read sounds into TouchDesigner from external sources. Audio can be generated, played from audio files, filtered, mixed and recorded.
The ways to obtain audio in CHOPs include: from files, movies, microphones or line in. These are described in detail in the section below. To hear audio output from CHOPs, send the audio to an Audio Device Out CHOP.
For example, the Audio Oscillator CHOP can generate a constant-frequency audio signal. The Trigger CHOP takes an on-off control from TouchDesigner, and generates a volume envelope with a delay, attack, decay, sustain and release transition that can multiplied with an audio CHOP with a Math CHOP controlling its loudness. The Math CHOP and Audio Dynamics CHOP act as a mixer and the Audio Para EQ CHOP filters the spectrum of audio.
Quick Audio Startup
To quickly get audio going, try the following: File:Audio with CHOPS ex.tox
- Connect a default LFO CHOP to a default Audio Oscillator CHOP.
- Connect the Audio Oscillator CHOP to an Audio Device Out CHOP.
- You should hear a rising and falling tone.
- Connect the LFO CHOP to a new Audio Oscillator CHOP and set the oscillator's Base Frequency to 330.
- Connect the two Oscillators to a Merge CHOP. Connect the Merge CHOP to the Audio Device Out CHOP. You should hear one oscillator in each left and right channels.
Next use an Audio File In CHOP as a sound source, connecting it to the Audio Device Out CHOP.
Audio File In CHOP - loads audio from a file as it plays. This method of streaming uses very little memory as it only loads the samples of audio it needs at the time, ideal for large audio files. The CHOP channels created are time-sliced.
File In CHOP - loads the entire audio file into CHOPs. The audio is loaded into CHOPs at the sample rate of the audio file. The higher the sample rate, the more memory CHOPs will use to load the audio. The channels created are not time-sliced. When completely loaded into CHOPs, it is easy to manipulate the audio downstream with additional Filter CHOPs; stretch, splice, pitch, volume, etc. Care must be taken running real-time systems with large audio files and high sample rates, as CPU usage for these operations is very high.
Audio Play CHOP - plays back a sound file directly to the audio output device. Great for simple triggering of sounds. Plays back just a single file or selects from a list of files stored in a DAT list. Can also be triggered using the Tscript
audioplay Command. Audio is not passed further down the CHOP network.
When using a Audio File In CHOP, audio can be cued or scrubbed at least 3 ways:
- Audio File In's parameter Play Mode must first be set to Sequential. Select a Cue Point and press Cue Pulse.
- Audio File In's parameter Play Mode must first be set to Specify Index. using the Index parameter. Turn off the Repeat parameter to stop audio buzzing when not scrubbing.
- When using the Audio Movie CHOP, scrubbing the audio can be done through the Movie File In TOP which is referenced. As the movie playback is scrubbed, the audio will follow.
Using a File In CHOP, audio can be scrubbed by scrubbing TouchDesigner's main Timeline throughout the frame range of the File In CHOP.
When using an Audio File In CHOP, set the Repeat parameter to On.
Using a File In CHOP, which statically loads the entire audio file, you can set the Extend Left and Extend Right parameters to Cycle.
Audio Play CHOPs need to be repeatedly triggered to repeat the audio.
TouchDesigner Audio Output Volume
The Audio Device Out CHOP sets the overall output level to the speakers. This is sent to the volume controls in Windows.
Outputting Audio to a File
You can output the audio in any CHOP using the RMB menu on the CHOP. Select Save Data Channels in the menu and hit the arrow button to see the file format suffixes that can be used on your output files, such as
.aif. You can check the file by playing it with VLC or QuickTime or another audio player.
- Math CHOP - Increase/decrease volume, mix sounds, stereo to mono, perform functions of a level mixer.
- Audio Oscillator CHOP - Make audible tones & LFO (low frequency oscillator).
- Constant CHOP - Provide constant-pitch control for oscillator.
- LFO CHOP - Add vibrato or LFO.
- Noise CHOP - Generate white noise.
- Audio Band EQ CHOP - Graphic equalizer.
- Audio Para EQ CHOP - Filter, echo, pitch shift.
- Audio Filter CHOP - Low pass, high pass, band pass filter.
- Resample CHOP - Change the sample rate of a sound.
- Trigger CHOP - Make volume envelope with delay, attack, decay, sustain, release.
- Timer CHOP - Cross-dissolve one sound to another.
- Lag CHOP - Make glissando pitch sweeps.
- Envelope CHOP - Follow the loudness of a sound.
When you are processing an audio clip by reading the whole file into an File In CHOP:
- Trim CHOP - Shorten the audio.
- Cycle CHOP - Make it repeat.
- Wave CHOP - Add vibrato or LFO.
- Shift CHOP - Re-time the sounds, simple echo, delay.
- Stretch CHOP - Make a sound slower or faster, but shifting pitch too.
- Copy CHOP - Use triggers to copy sounds along a timeline.
- Pulse CHOP - Time pulses to produce rhythms as a sequencer.
- Composite CHOP - Layer one sound over a longer sound.
- Lookup CHOP - Soft limit amplitudes etc.
An object, particle, or point position in 3D space can be used to set the left-right ear separation, or used as reverb controls which add a cue that simulates proximity of the sound.
Audio can be generated for offscreen objects, adding more 3D cues and realism.