Skip to content

Instantly share code, notes, and snippets.

View rygrob's full-sized avatar

Ryan Robinson rygrob

View GitHub Profile
@rygrob
rygrob / Parameters.swift
Created February 6, 2025 23:38
Type-erased Parameter System
//
// Parameters.swift
// ---
//
// Created by Ryan Robinson on 2/5/25.
//
import CoreGraphics
import Foundation
@rygrob
rygrob / BezierGridView.swift
Created February 5, 2025 17:36
Bézier Grid View
import SwiftUI
struct BezierGridView: View {
@State private var vertices: [[BezierVertex]]
let rows: Int
let cols: Int
init(rows: Int, cols: Int) {
self.rows = rows
@rygrob
rygrob / tpt_filters.h
Last active October 15, 2024 18:44
TPT Filters
#ifndef tpt_filters_h
#define tpt_filters_h
#include <cmath>
#include <numbers>
// MARK: - One-pole Filter
template<typename X>
@rygrob
rygrob / diode_ladder.h
Created October 13, 2024 17:55
TPT diode ladder
#include <cmath>
#include <numbers>
// See: https://www.discodsp.net/VAFilterDesign_2.1.2.pdf (p. 170)
template<typename X>
struct Diode_ladder {
struct Params {
X fc = 1000;
PGraphics pg;
PImage icon;
color clear;
// 1. put the icon you want to squirclize the working directory
// 2. provide the name of the icon you want to squirclize
String inputFileName = "cool_icon.png";
String outputFileName = "squircle_icon.png";
@rygrob
rygrob / cvx_log2.py
Last active May 2, 2023 16:03
CVX Log2 Approximation
import matplotlib.pyplot as plt
import numpy as np
import cvxpy as cp
# broke the degree parameter for the time being.
def get_cvx(fn, deg, lo, hi, rel=True, m=500):
# create an array of x-values
x = np.linspace(lo, hi, m)
# compute the true y-values