How to automatically detect SR of an audio file loaded into Sample Lookup?

pauljberlovitch
pauljberlovitch Member Posts: 1 Newcomer
edited October 2024 in Reaktor

I am building a sample/loop player in Reaktor using the Sample Lookup module, with panel controls + modulation inputs to:

  • Play/Pause/Stop/Reset audio playback
  • Continuously adjust playback speed up to double or down to half speed
  • Loop the sample or not
  • Reverse the sample playback
  • If looping, add a delay of up to 60s at the end of the loop before starting again
  • Shorten the length of the loop down to 0.001 times the Sample Lookup's len output

Playback works using an accumulator I've built in Core that starts at zero when the "play" button is clicked and moves the playhead along by increments calculated at 1000/SR, until the output reaches the value at the Sample Lookup's len(ms) output.

The problem I am having is that using the current SR to calculate a fixed increment does not accommodate for audio files using other sample rates (44.1kHz is obviously most common, whereas I'm in the habit of working at 48).

I have thought about creating a macro in the circuit that calculates how many sample ticks are expected in a very short length of the audio (around 0.01 or 0.001 of the len output) then 'plays' the file for that duration. If the actual number of ticks doesn't match, then the difference is calculated and used to adjust the size of the increment (speed of playback).

With the lack of an output on the Sample Lookup for the current playhead position however, it seems that this unfortunately isn't feasible as a solution.

Before I go any further with this, I just want a quick sanity check - am I going the right way about figuring this out? Is there a more practical/efficient solution to adjusting the play speed for sample rate? Or am I totally unaware of a far less labour-intense solution that exists in Reaktor? It is very easy to waste an entire weekend exploring ideas that may or may not work :-)

I know that there are other sampling modules in Reaktor that already automatically adjust playback speed to accommodate for a file's sample rate, such as the Tape Deck, but this lacks the functionality to reverse the sample, so would need to question whether this functionality I wanted is a must-have or not...

Thanks in advance!

Answers

  • colB
    colB Member Posts: 994 Guru

    Don't know about the 'sample lookup module'

    One option for getting the SR of some imported sample is the table framework 'Table Info' module. You can look up all sorts of different metadata assuming it exists in the sample. I've used this for extracting and using loop points...


    You need to be using table framework references though... Probably can use it with sample maps the via table framework's 'sample map' module, although I've not experimented with that one so can't vouch for it's functionality.

This discussion has been closed.
Back To Top