ddf / Minim

A Java audio library, designed to be used with Processing.
http://code.compartmental.net/tools/minim
GNU Lesser General Public License v3.0
668 stars 136 forks source link

does setSampleRate() work? #84

Closed jeppius closed 5 years ago

jeppius commented 5 years ago

Hi there, apparently the method setSampleRate() from the Sampler class does not seem to have any effect at all in the sampling rate of the file being played. I call it right after instantiating a new sample from a sound file, which is triggered later on. No matter what sample rate is set, the file is always played at the same speed. Am I missing something? Any working example?

ddf commented 5 years ago

setSampleRate is usually called automatically when you patch the Sampler to an output or another UGen. It lets the Sampler know the sample rate of the signal chain it is a part of. If you want to change the playback rate of the Sampler, you can use the rate UGenInput, which is a playback speed. So if you want the audio to play back twice as fast, you use sampler.rate.setLastValue(2) for half as fast you'd use sampler.rate.setLastValue(0.5).