This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Frequency estimation using Barry Quinn's Second Estimator | |
// Adapted from following links: | |
// DSP Guru site: | |
// http://dspguru.com/dsp/howtos/how-to-interpolate-fft-peak | |
// Vadym Markov's adaptation: | |
// https://github.com/vadymmarkov/Beethoven/blob/master/Source/Estimation/Strategies/QuinnsSecondEstimator.swift | |
// | |
// sampleRate ... your audio sample rate | |
// k ... bin index that shows biggest FFT output magnitude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iomanip> | |
#include <iostream> | |
#define EXP_TABLE_LEN 100 | |
using namespace std; | |
// | |
// populates an array of doubles with values ranging from 1.0 to 0 | |
// derived from an exponential decay curve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use pixels for ruler units | |
var defaultRulerUnits = preferences.rulerUnits | |
preferences.rulerUnits = Units.PIXELS; | |
// get desired inputs from user | |
var spokeRadius = Number(prompt("Spoke radius (in pixels)?", 100)); | |
var colorCode = parseInt("0x" + prompt("Stroke color (in hex, rrggbb)?", "a0a0a0")); | |
var strokeWidth = Number(prompt("Stroke width?", 2)); | |
var nPoints = Number(prompt("How many spokes to draw?", 20)); |