Announcement

Collapse
No announcement yet.

Pitching down samples?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pitching down samples?

    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?


  • #2
    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.

    Comment


    • #3
      Originally posted by Triscus View Post
      I hope I can upload the code later today or tomorrow.
      I've managed the upload: https://github.com/Triscus/EuroshieldGranular

      Have Fun!

      Comment


      • #4
        Originally posted by Triscus View Post

        I've managed the upload: https://github.com/Triscus/EuroshieldGranular

        Have Fun!
        I don't know how I missed this one. THANK YOU!

        Comment


        • #5
          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


          • #6
            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


            • #7
              Originally posted by Triscus View Post
              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



              lol I actually posted on that thread before I saw this! At least I know I'm on the right track...

              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


              • #8
                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


                • #9
                  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


                  • #10
                    Originally posted by Triscus View Post
                    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.
                    Thanks for your help on this. However as the final product needs to react instantly, there's not going to be any way to play it in advance... (there no way for my sequencer to send a high hat before it's supposed to sound.... well, there IS but... yeah...)

                    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


                    • #11
                      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


                      • #12
                        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

                        Working...
                        X