Skip to content

Instantly share code, notes, and snippets.

@wcalvert
wcalvert / envlut.cpp
Created March 1, 2021 02:05
Mutable Instruments envelopes adapted to Audio library
#include <Arduino.h>
#include "envlut.h"
#include "arm_math.h"
// Todo: handle noteOff occurring before reaching SUSTAIN.
void AudioEffectEnvelopeLUT::noteOn(void) {
__disable_irq();
sample = 0;
count = 0;
@wcalvert
wcalvert / StateMachineDemo.java
Last active August 29, 2015 16:35
Finite State Machine (FSM) in Java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class StateMachineDemo {
public static void main(String[] args) {
FiniteStateMachine.state old_state = FiniteStateMachine.state.IDLE;
# ------------------------------------------
# Instructions
# ------------------------------------------
# 0. As of 26 Feb 2015, I recommend installing the xmpppy module located here: https://github.com/ArchipelProject/xmpppy
# It seems to actively maintained and some bugs have been fixed.
# 1. Create a "dummy" or "automation" Gmail account.
# 2. Fill in the user and password variables below with the credentials from step 1.
# 3. Run this script in a terminal and leave it running until step 6 is completed.
# 3A. You will probably get a SASL error (or similar) the first time you try to run this script. If so:
# Log into your dummy GMail account, and an email should show up letting you "enable less-secure apps" in your preferences.