Skip to content

Instantly share code, notes, and snippets.

BEGIN_OPERATOR(delay)
LOWERCASE_REQUIRES_BANG;
PORT(0, -1, IN | PARAM);
PORT(0, 1, IN);
Usz rate = index_of(PEEK(0, -1));
Usz mod_num = index_of(PEEK(0, 1));
if (rate == 0)
rate = 1;
if (mod_num == 0)
mod_num = 8;
@npisanti
npisanti / logscaling.cpp
Created June 16, 2019 11:49
pitch to frequency and frequency to pitch conversions
#define TUNINGFREQ 440.0
float p2f( float pitch ){
return pow( 2.0, (pitch-69.0)/12.0 ) * TUNINGFREQ;
}
float f2p( float freq ){
return (log2( freq / TUNINGFREQ ) * 12.0f ) + 69.0f;
}
@npisanti
npisanti / u.js
Last active May 11, 2019 22:05
euclid
'use strict'
import Operator from '../operator.js'
export default function OperatorU (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'u', passive)
this.name = 'Uclid'
this.info = 'Bangs based on the Euclidean pattern.'
@npisanti
npisanti / main.cpp
Last active September 21, 2017 13:43
#include "ofMain.h"
#include "ofAppNoWindow.h"
#include "ofxGPIO.h"
// most of this code is copied and pasted from the adafruit mpr121 arduino library
// The default I2C address
#define MPR121_I2CADDR_DEFAULT 0x5A
#define MPR121_TOUCHSTATUS_L 0x00