Sick to death of telephones yet? Don't worry you will be. In this last exercise of part 1 we are going to take a look at one more "telephone bell" and introduce a more advanced form of synthesis.
Aww but... aww but...No buts! We'll be there soon. The reason for this last section is to take a review of what is wrong with our previous two examples and see how to improve things. I think it was fairly obvious what was the weakness with brute force additive synthesis. In case you didn't notice your CPU load meter creeping steadily upwards when running example 2 let us spell it out now.... its inefficient. We want nice realistic sounds for our game or application, but we don't want the whole processor grinding to a halt just to make them. Also there were a lot of parameters to fiddle with. In theory we could change all those ratios and envelopes to get almost any sound, trumpets, pianos or whatever. Additive synthesis is very nice for pitched noises and musical sounds. It isn't so good for very complex natural sounds because we would need far too many partials to make a good job of emulating the sound. On the other hand AM synthesis seemed extremely efficient right....?
The first example gave us some basic AM synthesis, great for relatively simple sounds and yes, very efficient too. The problem with it is the way harmonics are formed. The placement of harmonics from sum and difference modulation isn't particularly useful for anything but a few applications. Remember how we slyly skipped over the issue of phase? Well in reality AM produces sidebands that may fall too low, in fact for low frequency sounds we easily end up with harmonics that are negative in frequency. "Negative! That's impossible!" I hear you say. Exactly. What happens is that they get reflected around zero and come back changed, a bit like the cat in Pet Cemetery, reflected frequencies can get their phase flipped over. What happens when one of these "negative" frequencies meets a normal harmonic of the same frequency? Just like matter meeting anti-matter they anihilate each other and BOOM! Well not exactly , they just both vanish in a puff of logic leaving you, the synthesist, scratching your head as to why there is now a hole in your sound where there used to be a noise. For inharmonic bell sounds that doesn't bother us an awful lot, but it's worth pointing out here while we are considering the general limitations of AM synthesis.
Yes, and there's not much we can do about it. Welcome to the mean dog-eat-dog streets of digital synthesis. Dealing with the limitations and strengths of different methods occupies us a lot in synthesis. Optimally choosing the best method relies on picking things that do just as much as we want and no more. A knowledge of maths helps make sense of many of those boundaries, but you can pick them up from experience and observation with time. The above phenomena is explained by Nyquist, and AM isn't the only form of modulation that can produce negative artifacts that get flipped, later we will see the same problem come up in FM. We can do some clever trickery to make harmonics we don't like cancel themselves out, by deliberately flipping the phase of some others, but this quickly becomes complicated and messy to manage. We end up with sounds that work at one frequency but can't be easily shifted about the keyboard for musical uses.
What we need is a method that gives us a compromise, being both relatively powerful and also quite efficient. There are a number of them, waveshaping and FM are two closely related cases of "non-linear" synthesis. They are a little too complicated to deal with at in depth this stage, but our new bell uses a very simple form of FM. Let's look also at another way of creating a series of harmonics from quite simple arrangements of atoms with trigonometric synthesis. There are actually a whole bunch of methods based around trigonometric identities. Later we explore these in full, there are essential papers by Moorer, Wessel, Chowning and others to read, although Dodge and Jerse, Roads, and Puckette give us much more accesible explanations. In fact these methods are based on age old wisdom of Euler and Newton amongst others. We will use the cosine function along with a few other tricks to get interesting and useful spectra very cheaply. Now, I know I promised all students that there would be no math, and it's tempting to say, like Darth Vader, "I am altering the bargain" - but I am going to stick to promise for now, at least avoiding any equations or scary looking graphs and simply state what we are doing in plain words. Consequently you are going to miss out on some of the essential magic, if you don't fully understand why some things are happening I hope it helps when I say "that's normal", we will fill in gaps later on. The essential point of this exercise is not to produce a better bell. In fact this one sucks the most in terms of quality or realism. The point is to demonstrate that we can make efficiencies in our model and in our method of implementation.
Look at the diagram below. The output of the oscillator is added to a constant value in the range 0 to 2.5. When the slider is fully up the signal dips into the part of the cosine function that gives us only odd harmonics, and when fully down it only gives us even harmonics. For a value of about 0.1 we get a mixture of both evens and odds. In the second part we add a fader to change the level of the driving sinewave. We choose an index range so that when it is loud there are more harmonics, but as it fades away only the even ones remain.

Have a play with the various stages of developing the alarm bell sound here, Puredata file .pd
In the next stage we add a phasor, which is just a sawtooth oscillator. Don't worry about the harmonics in this now, we are actually using it as a low frequency oscillator to modulate the level of the driving oscillator. Also we have added another oscillator in place of the slider that was controlling the odd/even mix, this gives us sidebands in the same way that the AM modulation did, but in addition the sidebands are multiplied by the mix of odd and even harmonics in the signal. When the cosine function is applied we get a form of phase modulation that moves the sound from a very rich mixture of harmonics to an almost pure sine wave.

Notice the subtle addition in step 5. Allowing the phasor to also modulate the "carrier" level is what suddenly transforms the sound into a clangy metal bell noise. When the signal is loud it is also bright and rich in harmonics, but as it fades the odd harmonics dissappear and the spectrum rapidly becomes pure again.
The last step is easy to understand. We have simply duplicated most of the circuit to give us another bunch of metalic sounding harmonics and added these to the others, but look closely, we have squared the phasor value to make it decay more quickly and naturally for the first tone source, and for the second tome source which is higher in frequencies we have taken the 4th power (squared and squared again) so that it just produces a little clonk sound.

Finally we put it together with another bell unit very much like we did for the additive bell. This time a second phasor running on the oposite phase (0.5) to the first one makes the two bell notes alternate. Instead of nearly 30 expensive unit generators we have used only 10. (additions and multiplications aren't counted, just the expensive ones like table lookups, delays and oscillators count when guestimating the cost of a patch)

Hear the result here, Audio .mp3 and grab the full .pd patch here Puredata file .pd