For this piece I really wanted a very sweet sounding flute pipe:
I found the sound I wanted in the strangest place. Sawtooth waves sound harsh; they can be tamed, but they are never sweet in the way I imagined the flutes to be. Nevertheless, by adding an extra parameter to a simple additive sawtooth generator flutes and strings suddenly appeared!
In a sawtooth each overtone (harmonic) is scaled down as 1/n where n is the frequency ratio of the overtone. So, the 1st harmonic at 2 times the frequency has 1/2 the volume; the second harmonic at 3 times the frequency is 1/3 the volume. Now, raise that ratio of a power, say 0.5 or 2.0 and so forth. Low powers increase the harmonic content and a string sound appears, how powers decrease it and bright or sweet (even lower content) flutes appear. Here is the code:
def makeSimpleBase(length,frequency,z):
p=random.random()
if frequency>4000:
sig=sf.Mix(
sf.PhasedSineWave(length,frequency,p),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*2.0,p),(1.0/2.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*3.0,p),(1.0/3.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*4.0,p),(1.0/4.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*5.0,p),(1.0/5.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*6.0,p),(1.0/6.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*7.0,p),(1.0/7.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*8.0,p),(1.0/8.0)**z)
)
else:
sig=sf.Mix(
sf.PhasedSineWave(length,frequency,p),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*2.0,p),(1.0/2.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*3.0,p),(1.0/3.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*4.0,p),(1.0/4.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*5.0,p),(1.0/5.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*6.0,p),(1.0/6.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*7.0,p),(1.0/7.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*8.0,p),(1.0/8.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*9.0,p),(1.0/9.0)**z),
sf.NumericVolume(sf.PhasedSineWave(length,frequency*10.0,p),(1.0/10.0)**z)
)
return sf.FixSize(sig)
def niceSaw(length,frequency):
return makeSimpleBase(length,frequency,1.0)
def violaBase(length,frequency):
return makeSimpleBase(length,frequency,0.5)
def sweetFluteBase(length,frequency):
return makeSimpleBase(length,frequency,8.0)
def brightFluteBase(length,frequency):
return makeSimpleBase(length,frequency,3.5)
def celestFlute(length,freq):
sig=sf.Mix(
sf.Pcnt50(sweetFluteBase(length,freq)),
sf.Pcnt50(sweetFluteBase(length,freq+1.0)),
sf.Multiply(
cleanNoise(length,freq*0.5),
sf.SimpleShape((0,-60),(64,-28),(128,-40),(length,-40))
)
)
return pitchMove(sig)
def sweetFlute(length,freq):
sig=sf.Mix(
sweetFluteBase(length,freq),
sf.Multiply(
cleanNoise(length,freq*0.5),
sf.SimpleShape((0,-60),(64,-30),(128,-40),(length,-40))
)
)
sig=sf.FixSize(polish(sig,freq))
return pitchMove(sig)
def brightFlute(length,freq):
sig=sf.Mix(
brightFluteBase(length,freq),
sf.Multiply(
cleanNoise(length,freq*0.5),
sf.SimpleShape((0,-60),(64,-28),(128,-40),(length,-40))
)
)
sig=sf.FixSize(polish(sig,freq))
return pitchMove(sig)
No comments:
Post a Comment