streson — A string resonator with variable fundamental frequency.
ifdbgain -- feedback gain, between 0 and 1, of the internal delay line. A value close to 1 creates a slower decay and a more pronounced resonance. Small values may leave the input signal unaffected. Depending on the filter frequency, typical values are > .9.
asig -- the input audio signal.
kfr -- the fundamental frequency of the string.
streson passes the input asig through a network composed of comb, low-pass and all-pass filters, similar to the one used in some versions of the Karplus-Strong algorithm, creating a string resonator effect. The fundamental frequency of the “string” is controlled by the k-rate variable kfr.This opcode can be used to simulate sympathetic resonances to an input signal.
See Modal Frequency Ratios for frequency ratios of real intruments which can be used to determine the values of kfrq.
streson is an adaptation of the StringFlt object of the SndObj Sound Object Library developed by the author.
Here is an example of the streson opcode. It uses the file streson.csd.
Example 438. Example of the streson opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o streson.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; Initialize the global variables. sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; Instrument #1. instr 1 ; Generate a normal sine wave. asig oscils 8000, 440, 1 ; Vary the fundamental frequency of the string ; resonator linearly from 220 to 880 Hertz. kfr line 220, p3, 880 ifdbgain = 0.95 ; Run our sine wave through the string resonator. astres streson asig, kfr, ifdbgain ; The resonance can get quite loud. ; So we'll clip the signal at 30,000. a1 clip astres, 1, 30000 out a1 endin </CsInstruments> <CsScore> ; Play Instrument #1 for five seconds. i 1 0 5 e </CsScore> </CsoundSynthesizer>