Here is essentially what I want to do, which gives a "smooth" (stepped) progression from f1 to f2. stepsPerSecond sort of controls the "smoothness" of the progression.<br><br> f1 := 330.50.<br> f2 :=
440.90.<br> f := f1.<br> t := 0.<br> sec := 15.<br> stepsPerSecond := 10.0. <br> df := (f2-f1) / (sec*stepsPerSecond).<br> ss := SequentialSound new.<br> f := f-df.<br><br>" Sweep smoothly from f1 to just shy of f2 over the specified time, re-calculating the amount of time for each step
<br> based on the integral number of frequencies that can be completed within the estimated step size.<br> We should end up just shy of the target frequency, at the end of a complete cycle..."<br><br> 1 to: (sec*stepsPerSecond) do: [
<br> :i |<br> dt := (((i asFloat)/stepsPerSecond)-(t asFloat)).<br> f := (f + df).<br> cycles := (f*dt) roundTo: 1.0. <br> dt := cycles / f.<br> Transcript show: f; tab; show: dt; cr.
<br> ss add: (FMSound new setPitch: f dur: dt loudness: 0.5).<br> t := t + dt.<br> ]. <br><br>" Add the the final frequency and play it briefly..."<br> Transcript show: f2; cr.<br> ss add: (FMSound new setPitch: f2 dur:
1.0 loudness: 0.5).<br><br> ss storeWAVOnFileNamed: 'test.wav'. <br> ss play.<br><br>I would do something similar with the times if I wanted to "step" sharply from one frequency to another without the slide, but without introducing an audible "click." Basically I just need to make sure that the transition from one frequency to another happens on an integral number of wave cycles.
<br><br>However, this seems somewhat inelegant given the apparent richness of the sound classes. It *feels* like I am doing something "by hand" that is probably already built into the system. It seems like the PitchEnvelope class *should* work, if I understood it better! Furthermore, without understanding the VolumeEnvelope class, I would do something like the above to fade-in and fade-out, changing volume levels instead of frequencies.
<br><br>Thanks,<br>Rob<br><br><div><span class="gmail_quote">On 4/20/06, <b class="gmail_sendername">Hans-Martin Mosner</b> <<a href="mailto:hmm@heeg.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
hmm@heeg.de</a>> wrote:</span></div><br>>Have you looked at the PitchEnvelope class? It allows you to sweep a
<br>>sound between frequencies.<br>>You would need to take into account that it's working on a logarithmic<br>>scale, so it does not interpolate frequencies linearly, but musical<br>>notes. In many cases this would be the desired behaviour, I don't know
<br>>enough about your application to say whether it is acceptable here as well.<br>><br>>Cheers,<br>>Hans-Martin<br><br>