Tuesday, 23 September 2014

Making A Clarion Pipe

For Bach's Passacaglia and Fugue in C Minor I wanted another pipe sound to help differentiate the music. The midi I have of this (sorry – I cannot find who encoded it) has 4 manuals and the pedals. I have allocated a new sound to the 4th manual. The sound is one I call a 'clarion pipe'. It is brighter and brassier than the others. This was done by mixing a a very high frequency sawtooth with the original ( so far so normal ) but then passing the resulting mixture through substantial distortion.

def vocalRaw5(length,freq):
    s1=sf.MakeTriangle(sf.PhasedSineWave(length,freq,random.random()))
    s2=sf.MakeTriangle(sf.PhasedSineWave(length,freq*2.001,random.random()))
    s3=sf.MakeSawTooth(sf.PhasedSineWave(length,freq*4.002,random.random()))

    sig=sf.Mix(
        sf.Pcnt70(s1),
        sf.Pcnt20(s2),
        sf.Pcnt10(s3),
        sf.Multiply(
            cleanNoise(length,freq),
            sf.SimpleShape((0,-60),(64,-20),(128,-36),(length,-36))
        )
    )
    sig=sf.FixSize(sf.Power(sig,10.0))
    sig=sf.BesselLowPass(sig,freq*6.0,2)

Above we can see the three signal generators. The base note is just a triangle wave (or randomised phase). Then another triangle if placed one octave up and a sawtooth two octaves up. The upper waves are very slightly detune; this along with the random phases helps liven up the sound a great deal.

Nevertheless, it sounds very normal and quite like the other sounds but with an annoying sawtooth buzz until sf.Power(sig,10.0). This is a massive distortion. It is almost exactly the opposite of what we normally think of as distortion. 'Normal' distortion squashes the signal as it approaches maximum excursion. This adds an ordered set of diminishing harmonics. sf.Power does the opposite and stretches the signal. This adds a mass of higher harmonics which burst forth. If a sine wave is treated this way it starts to turn into a sound not unlike a Saxophone due to the build up of harmonics, both even and odd at similar intensities which only die away slowly.

The effect is far to strong and produces masses of harmonics up to and above the limit of human hearing. To get it back under control I use a Bessel filter. This has low phase distortion and a nice smooth rolloff. The combination makes the distinct clarion sound which can be heard in the piece.



To really accent the new pipe I added a 'stop' of a flute (almost diapason) pipe sound 2 octaves up. Due to the stereo positioning logic in the patch, this sound comes out in a different place to the clarion and so the two do not merge but rather follow one another much as a similar flute sound follows the pedals. Here is the patch for the flute pipe:

def vocalRaw4(length,freq):
    return sf.FixSize(sf.Power(sf.MakeTriangle(sf.SineWave(length,freq)),2.0))

Again, we can see that I have used a bit of sf.Power to brighten the sound. Here the amount is much less so I get something between a flute and a diapason.

No comments:

Post a Comment