Objective

To create a richly textured, bell- or chime-like sound using additive synthesis.

Strategy

The opcode I chose for this experiment was `adsynt`.

First, some old business: as of this writing (7-March-2009), the `adsyn` opcode is still broken (note this is 'adsyn', without the 't'). I first brought this up 11 months ago. Even on a brand new 5.10.1 build and install, `adsyn` still produces only noise, exactly as I described in that earlier article.

Sort of makes the `hetro` utility useless, for now.

Anyway, my experiment focused on the broken opcode's next door neighbor, `adsynt`. My idea was to generate a sound using (almost) inharmonic partials -- actually, based on the perfect fifth (3/2) octave ratio, according to the following formula:

partial freq = (3/2)^(n/2)

That is, for each partial n (starting at zero), the even overtones will be related to the 3:2 harmonic. The odd will be related as well, but in a more-or-less inharmonic way.

The trick is to get the sound to change as it moves through time. This is done by rolling down the level of the higher partials according to a formula. Originally, the higher partials fall off at a rate of 1/(n+1); in the final stages of the decay, they are falling off by 1/(n+1)^5.

I also added a bit of exponential decay, modeling the physics of a bell or chime. Overall, the higher frequencies fall off quickly, while the lower ones resonate longer. Just for that extra bit of texture, I put a slight vibrato on the individual partials (all of them go at different vibrato rates and phases -- the higher, the faster the vibrato).

Result

Part of the trick here is to 'play' the instrument in the Csound score file by altering 1.) how hard the chime is hit (I used dBfs) and 2.) how many partials are included in the instrument. As a general rule, I made it so that harder hits correspond to more partials.

Conclusion

There is a lot of possibility in this instrument, and instruments like it. For one, instead of manually programming in the relation between number of partials and strength of the hit, it seems logical there could be a way to implement it as

n = g(s,f)

where n is the number partials, s is the strength of the hit, and f is the frequency of the note (presumably higher notes would have less of the higher partials as well). The function 'g' would also have to return an integer (n is the index for a table, so decimal values make no sense).

*EDIT* Not quite sure how, but the attached file got lost somewhere between 'submit' and now. I've replaced it.

AttachmentSize

I see now I replied to your original post about adsyn, but I'd forgotten that, so I went to try 'adsyn.csd' myself. (As I reported on my blog, I now have 5.10.1 on my Ubuntu system too.)

I had to remove the "*32768" scaling of the output, but then it worked fine! Then I went back and saw my original reply -- where I found it didn't work on (the Ubuntu supplied) 5.08 -- and realized there is one difference aside from the version number: I built my 5.10 with single-precision floats!

I tried once again with the Ubuntu repository's (double) 5.08 and sure enough, I get noise. So, as you still experience it in your 5.10.1, I suspect some mixup in the precisions somewhere (a bit like the metric/imperial confusion in that Mars probe...!)

Thanks for posting your code -- I was just about to ask for it, as I always like to play with your experiments, too!