I'm trying to make a simple drum machine module. Does anyone know how to pitch a sample down? I don't need time-stretching, just a simple "play it slower or faster to change the pitch" thing would work. If I had to change the entire playback at once, that would be fine as well. Any thoughts?
Announcement
Collapse
No announcement yet.
Pitching down samples?
Collapse
X
-
Have a look at the Granular Effect and the example code from the Teensy Audio Library. I'm not sure if it's usable for drums due to latency
At the moment I'm putting together a Granular Sampler for the Euroshield. I hope I can upload the code later today or tomorrow.
-
-
well.. you were right twice... The Granular effect did allow me to pitch and the latency was wide enough to throw a cat through. Is there any other way to drop the pitch? like, change the bitrate on the fly or something? drop the clockspeed? Totally spitballing here...
edit: also, would a faster teensy help? like a 3.6 instead of a 3.2?
Comment
-
It's not about the speed, it's how it is implemented in the library. Before the grain is played back it is going to be sampled, which causes the latency. The solution would be to sample the audio stream continuously and just trigger the playback. Haven't read it all in detail, but maybe this helps? https://forum.pjrc.com/threads/50251...ck-application
Comment
-
Originally posted by Triscus View PostIt's not about the speed, it's how it is implemented in the library. Before the grain is played back it is going to be sampled, which causes the latency. The solution would be to sample the audio stream continuously and just trigger the playback. Haven't read it all in detail, but maybe this helps? https://forum.pjrc.com/threads/50251...ck-application
Unless I'm misunderstanding what you're proposing (which is not only possible, but highly likely), I don't know if triggering playback would work.This is for a hi-hat module, so I'll need to be able to handle (via Gate in on CV1 or CV2) either a OHH or a CHH instantly. If I'm sampling the audio stream continuously, how would I keep from making the same amount of latency?
Comment
-
No Problem, it's highly likely I haven't thought through the whole thing
The Idea is, the sampling is done in the background, so you have the last second (or so) of the audio stream available in a buffer and ready to be played back. Another way would be to use one trigger to start the sampling and another trigger to start playback. The actual implementation does one thing after another with only one trigger.
Comment
-
I was able to edit the library, so sampling starts by the push of the button and playback starts with the trigger:
https://github.com/Triscus/Euroshiel...e/experimental
But it's quite hard to sync and it sounds clicky / noisy sometimes. The possibility to choose the begin of the sample and the playback length is needed.
Comment
-
Originally posted by Triscus View PostI was able to edit the library, so sampling starts by the push of the button and playback starts with the trigger:
https://github.com/Triscus/Euroshiel...e/experimental
But it's quite hard to sync and it sounds clicky / noisy sometimes. The possibility to choose the begin of the sample and the playback length is needed.
However, I DID find this: https://forum.pjrc.com/threads/53213...862#post183862 apparently this guy's got it sorted. I'll let you guys know if I get it working.
Comment
-
http://little-scale.blogspot.com/201...nd-rhythm.html I found this link earlier... I feel like I might have been trying to hard... Is there any reason why this approach wouldn't work?
Comment
-
Changing the pitch really is just changing the sample rate. In the example you posted, the Teensy is outputting the samples one by one and the code changes the rate. This is a viable approach for the built in DAC and low data rate material. I don't think it will work on Euroshield where you set up a data stream and a fixed sample rate and audio plays continuously.
I think you will need to modify the Teensy Audio Library to speed up or slow down the audio from the file to create a pitch change. You may also want to look up Linear Interpolation as this is a good starting technique for the conversion and sounds OK for small adjustments.
Comment
Comment