One of the the easiest ways to play a sound file in Csound is to use the diskin2 opcode. With it, you can loop samples, modulate the pitch, apply filtering and ring modulation, etc. You go really far with just this mini-sampler. It does have its limitations. The approach of the Beat Mangler X example overcomes them, but requires a more advanced design, which we’ll cover at some later point. Though for many situations, you’ll find that diskin2 is the perfect solution.
The listening example uses the amen loop used in the Beat Mangler X example, though you can easily use your own mono files by making changes to the score. Diskin2 supports stereo files, though this example only works with mono samples.
There are few resources that approach introductory Csound compostion as elegantly as Cascone’s chapter from The Csound Book. In it, Cascone provides a bit of history and personal background, techniques for composing in a computer music environment, and six instrument designs. There is one particualr passage that I want to emphasize, as I think it can be of great use:
“I started studying instrument design by taking other composers’ instruments and drawing them out on paper in flowchart form. I took the scores and isolated a particular instrument by commenting out all other instruments except the one I wanted to listen to. I would then start to modify that instrument in various ways so I could hear the effect my code was having.”
After two weeks of synthesizer fundamentals, now is a good time to do a quick review of what has been covered so far by putting these techniques into an actual working instrument. I designed Flat Drum for just this purpose. With the Flat Drum block diagram and code handy, go back and look through the material from the last couple of weeks. Which concepts are used in this instrument? Which are not? Are there any new opcodes? Do you see any familiar synthesizer design patterns? Is there anything in the code that you haven’t seen or don’t understand? etc.
Perhaps the most important thing you can do is to make a copy of the file, make changes to the values in the code, and listen to the results. Theory is useless without practice and hands-on experience.