Csound Basics: Granular Processing

Instead of granular synthesis, we could use the sndwarp opcode to independently timescale and pitchshift a sample in real-time and realize a form of granular processing. This instrument will use GEN01 to store the samples from a pre-existing soundfile in the score. Controller 16 is used to timescale from .25 to 25 times the length of the original. Controller 17 will resample the frequency of the file and transpose it from .25 to 4 times the original pitch. The ctrlinit opcode, located in the orchestra header section, initialized the channel 1 controllers as follow: controller 16 is set to 40 and controller 17 is set to 10, allowing us to start the instrument from a "preset" condition as shown in figure 10.


[index] [prev] [next]


[+] Home
[+] Tutorials

Figure 10: Orchestra file for a MIDI-based granular processing instrument using sndwarp.

The sndwarp opcode's time-based algorithm essentially applies a moving window (with overlap) to the source file (f2) and interpolates or decimates the contents of the current window depending on the settings of ktwarp and kresamp, resulting in a wide range of clean, grungy, and magical transformations of the source. Notice how a sample is read into the GEN routine by placing the filename (hello.aif) in quote marks as seen in figure 11.

Figure 11: Score file to granularly process the soundfile "hello.aif".

  [next] Csound Basics: Acoustic Modeling