Skip to content

Instantly share code, notes, and snippets.

View hiromorozumi's full-sized avatar

Hiro Morozumi hiromorozumi

View GitHub Profile
@hiromorozumi
hiromorozumi / spokes.jsx
Last active May 11, 2020 14:37
A Photoshop script to automate drawing evenly-spaced spokes. Written in JavaScript.
// 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));
@hiromorozumi
hiromorozumi / easyExponentialDecay.cpp
Last active May 8, 2020 06:21
An easy, silly way to create a lookup table for an exponential decay curve - useful for ADSR envelope curves
#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
@hiromorozumi
hiromorozumi / quinnsecond.cpp
Last active October 11, 2023 02:21
FFT Frequency Estimation Using Barry Quinn's Second Estimator (C++)
//
// 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