Csound Basics: Acoustic Modeling

Csound also has a large family of analysis/resynthesis opcodes and utilities. Here we will focus on the convolve opcode as it will provide a world of filtering, reverberation, room simulations and sound-morphing effects to explore. Convolution is a generalized filtering algorithm that essentially performs a "dynamic spectral intersection" between two soundfiles - a "sourcefile" and the impulse response of the filter - a "filterfile." What is unique about convolution, is that there is no restriction on how the user "defines" the impulse response of the filter. Thus any soundfile can be "filtered" by the frequency characteristics of any other. This is done by first converting both files into the frequency domain and then multiplying them. Any frequency components they have in common will be emphasized, any that they do not will be attenuated or zeroed. If the frequency characteristics of either file change in time (as most sounds do) then the result will be a time-varying filter or a dynamic spectral intersection (DSI) between the two.

In Csound, we use the cvanal utility, shown in figure 12, to turn any soundfile into a filter.

[index] [prev] [next]

[+] Home
[+] Tutorials
mastering.zip contains the accompanying Csound .orcs and samples discussed in this tutorial

[+] download (3.8M)
Figure 12: The cvanal utility dialog box.

Convolving my speaking voice with the cvanal-converted recording of me slamming the door to my bathroom will result in the illusion that I am speaking in the bathroom rather than in the studio where the recording was made. Figure 13 is a generic convolution orchestra with a variety of audio sources and audio filters.

Figure 13: Orchestra file for a soundfile-convolution instrument.

In this instrument, we use the diskin opcode to read a soundfile into the orchestra from disk. In addition to offering parameters that allow us to transpose and reverse the direction of the file, the diskin opcode, which is disk-based rather than ram-based, makes it easy to use any Csound instrument to process or transform soundfiles of any length. Csound's strset opcode is used to list the sourcefiles and filterfiles by name, and associate them with a f-table numbers so that we can refer to them from p-fields in the score and interchange them on a note-by-note basis. Thus in the score, each note event, separated by a section command (s), convolves my speaking voice (strset 10), with the door (strset 12), a crash cymbal (strset 13), exponentially decaying white-noise (strset 14), and a drumloop (strset 15) as shown in figure 14. This is followed by the same set of "filters" applied to a different source file (strset 12).

Figure 14: Soundfile-Convolution score file featuring the section statement.

With Csound's convolve opcode and cvanal utility you can create the most wonderful reverbs, the most complex resonators, and some incredible filtering effects. In fact, in Csound any sound can be used to filter to radically transform any other. Literally, the sky is the limit!

  [next] Beyond the Basics: New Levels of Awareness and Understanding