Trying to make a guitar tuner

Hey guys,
I'm trying to make a simple guitar tuner/ pitch detector and thought about using the scriptable fft functions but I haven't found much documentation on the fft functions and this code below seems to return errors when trying to use it.
Was wondering if there's any update on these fft functions or if there's a better way to go about detecting pitch
// Create a dummy signal with two sine waves const var signal = Buffer.create(4096); reg uptime = 0.0; for(s in signal) { s = 0.3 * Math.sin(uptime); s += 0.7 * Math.sin(uptime * 2.0); uptime += 0.1; } // Create a FFT object. If you right click on it in the // script watch table and view the popup you'll see a spectrogram // for the data passed in const var fft = Engine.createFFT(); // creates a spectrogram image (required for // the debug popup but might be used later to draw // on a panel. */ fft.setEnableSpectrum2D(true); // Setup the processing specs (fft size and channel count) fft.prepare(1024, 1); // Set the window type for the processing fft.setWindowType(fft.BlackmanHarris); // Convert the FFT output to magnitudes fft.setDomain(fft.Magnitude); // Give the fft a function that will be called for // each signal chunk. `data` will contain either a // buffer or an array of buffers containing the transformed // FFT signal and offset will contain the index of the first // sample in the chunk (here it will be 0, 1024, 2048 and 3072 // because the processing size is 1024 fft.setProcessFunction(function(data, offset) { var max = 0.0; for(s in data) { max = Math.max(max, s); } Console.print("The max value at " + offset + " is " + Engine.getDecibelsForGainFactor(max)); }); // Process the buffer with the function above. fft.process(signal);

I found these functions not sure if they're related to detecting pitch from an audio signal. does anyone know more about these I just keep getting a returned value of 0.0
Buffer.detectPitch(double sampleRate, int startSample, int numSamples)
Engine.getGlobalPitchFactor()

@pluginboi yes I believe these are for sample files pitch detection. Not realtime...