Spatial provides the ability to randomize sound selection, start times, loop counts, or even the ability to have multiple sounds play within a single Object. Knowing this reveals an important and powerful set of features to consider when designing a Space.
Working within a Single Soundset
It’s possible for a single Soundset to reference multiple files. While a Soundset can only play a single file at one time, Soundsets that reference multiple files can control when then sound files play, or even random choices about when a sound file plays. In the previous lessons, you've worked with chirping birds. The files referenced in each of the bird Objects was a longer file that had the sound of the bird chirps “baked” into the sound file. Any variation on the bird chirp over time, would ultimately repeat when the sound file is repeated.
To provide more variety, you can subdivide sounds into smaller pieces and then let Spatial re-assemble these smaller pieces on the fly as the Scene plays. This creates a less predictable and more realistic feel to the environment you're creating. You’ll use this approach to create more variety with the Scene you’ve been developing.
- Open a new Scene.
You’re going to create a realistic bird using three individual chirp sounds, with each chirp at a different pitch.
- From the Lesson 7 folder, import the Chirp Low.wav audio file as a new Object.
The Chirp Low Object is imported and in the Canvas is positioned at the Scene’s origin point. In the lower timeline, you see the audio file represented as a waveform.
- Rename the new Object Chirping Bird, then play the Scene.
You hear the single bird chirp as the playhead moves across the waveform in the lower timeline.
To add more audio files to the Soundset, you need to add two more file positions that you can import the sound files into.
- At the bottom of the Soundset properties in the Inspector, click the [+] button twice.
Two new file positions appear. You can see by the Drop Audio here designation that you’re able to drag files directly to these positions.
- In the Finder, navigate to the Lesson 7 folder and drag the Chirp Med.wav and Chirp High.wav to the new file positions.
Notice the lower timeline now shows all three of the audio files you’ve imported in sequential order in the timeline.
- Play the Scene.
As the playhead moves across the lower timeline, you hear the audio files play in order as expected. Because the lower timeline presents itself like the audio editor of a conventional DAW, it’s understandable to think that it will behave the same way. It’s very important to understand that this will not always be the case, as you’ll soon learn. Also note that the lower timeline is not an editor, so you can’t grab and move what you see. You should think of the timeline as a way to visually verify the audio files contained within the Soundset.
While you can’t change the order of the files displayed in the lower timeline, from the timeline itself, you can drag their order in the Sounds area of the Inspector and this will update their order in playback.
- Drag the Chirp Hi to the top of the list and Play.
You hear the bird chirp sounds now begin with the highest pitch.
Besides changing the order in the list, there is an Order parameter that provides more functions.
- Change Order to Pick One and play the Scene multiple times.
The timeline visual stays the same, but when playing you only hear one of the sounds that has been randomly selected.
- Change the Order parameter to Random and play multiple times.
This time you hear that all three of the bird chirps are played through, but in a random order. This is a perfect way to get a chirpy bird with different combinations of pitch each time it plays.
To have the birdchirp for a longer amount of time, you can loop the Soundset.
- In the Soundset section of the Inspector click the Loop Checkbox and Play.
You hear the bird chirp continuously and because the Infinite checkbox is selected by default, the bird will continue to chirp until you stop the Scene. Something to take note of is that even though the bird continues to chirp, the lower timeline will show the playhead over a part of the timeline with no audio waveforms. Again, this is because the timeline is intended to overview what’s available within the Soundset, and does not behave in the same “what you see is what you hear” way that a conventional DAW’s timeline behaves.
Instead of playing infinitely, you can have the Chirping Bird loop a defined amount of times.
- Stop the Scene, deselect the Infinite checkbox and set the Iterations value to 5, then Play the Scene again.
The Chirping Bird reiterates 5 sets of 3 chirps. Notice the Loop Duration and Total Duration values that are calculated at the bottom of the Loop Timing area. Knowing the total time a Soundset will play can be helpful when setting the Loop parameters.
Currently, the bird is constantly chirping. You may prefer that some time passes between each iteration of the bird chirps. This is easily achieved using the Loop Delay parameter.
- Change Loop Delay min value to 1 second and play the Scene.
Now you hear a 1 second gap between each repeat, but this feels a bit too predictable. To vary the amount of delay between each loop, add a Max value to the loop Delay. Set the number to a value higher than the minimum to have an effect. A random number that’s between the min and max value will be selected for the delay time each time the bird chirps.
- Change Loop Delay max value to 3 seconds and Play.
Now each time the chirps loop there is a 1 to 3 second delay, which feels much more natural.
You can also choose to delay when a Soundset starts playing in relation to anytime its parent Object is scheduled to play. Just as with the Loop Delay, there is a min and max value for the Start Delay. In the next exercise, you’re going to add a sound to play before the bird chirps. To leave room for that sound to play before the first bird chirps, you'll set these parameters so that the bird won’t start chirping for 1 to 3 seconds.
- Adjust Start Delay min parameter to 1 second and the max to 3 seconds and Play.
Now when you hear Play the Scene, the Chirping Bird Objects waits 1 to 3 seconds before having the bird chirping 5 times, with a random amount of time between each set of chirps.
Working with Multiple Soundsets in a Single Object
All of the Objects you’ve worked with so far have contained a single Soundset. While you learned in the last exercise that multiple sounds can be contained within a single Soundset, only one of those sounds can be heard at any given time. In some situations you may want different sounds to play simultaneously. For this, it’s possible to have multiple Soundsets play within a single Object.
Imagine that the Chirping Bird you just created is sitting in a tree. If it moves, it would likely rustle the leaves and branches around it. You can imagine that the bird might chirp as it moves, so you’d want to hear both of those sounds at the same time. Since the bird is creating both the rustling and chirping sounds, it makes sense that both sounds would be part of the same Object, so this is a perfect scenario for placing multiple Soundsets within a single Object, as all Soundsets within that Object will be played from that parent Object’s position.
- Click on the Chirping Bird Object and play the Scene.
You see the playhead in the lower timeline move and the bird chirps multiple times.
Notice that in the timeline you see the waveforms of the soundset, but also see an orange clip that extends significantly longer than the audio waveforms of the contained Soundset. The orange region represents an estimation of how long the Object will play. The reason it's much longer than the waveforms is because you configured the contained soundset to loop 5 times.
You’re going to add the rustling sound to the Bird Chirping Object. By adding it as a separate Soundset, it can play simultaneously with the chirping sounds.
- Right-click the Chirping Bird Object and choose Add Audio > As Soundsets, then select the Rustling.wav audio file from the Lesson 7 tutorial folder.
In the lower timeline, you see the Rustling audio file appear below the chirping bird. Notice that the Rustling sound appears on a separate track and the timing overlaps the beginning of the bird chirps, indicating that they can play simultaneously.
TIP: When importing audio files as Soundsets, you can select multiple files in one import step. This will result in a separate Soundset being created for each audio file. This is useful when importing multitrack content into a single Object.
- Play the Scene.
You hear the rustling sound play momentarily by itself, and then it's joined by the sound of bird’s chirping.
The rustling sound is a bit loud in relation to the bird chirps. You can adjust the volume of the Rustling Soundset.
- Click the Rustling Soundset and in the Inspector’s Volume area, set the volume to -6dB.
When you click on the Rustling Soundset, you’ll see that the lower timeline now focuses exclusively on the Rustling sound, so the waveform of the chirping sounds is no longer displayed.
NOTE: As you change the volume, you’ll see a Scene Output value displayed. This value shows the cumulative volume that results when calculating all of the other volume values for all parent Objects within the Scene’s hierarchy.