Skip to content

Instantly share code, notes, and snippets.

@cjappl
cjappl / test_coefficients.py
Last active June 13, 2024 18:22
Comparing DAFX, JUCE and RBJ calculation of lowpass coefficients, confirming they are equal
import numpy as np
import pytest
# Juce implementation
# origin unknown
def make_lowpass_JUCE(*, sample_rate, frequency, Q):
n = 1 / np.tan(np.pi * frequency / sample_rate)
n_squared = n * n
inv_Q = 1 / Q
@cjappl
cjappl / radtrace.d
Created February 26, 2024 20:46
RADTrace - Dtrace script to capture realtime safety violations in "tagged" functions
dtrace:::BEGIN
{
printf("Starting trace\n");
errors = 0;
}
dtrace:::END
{
printf("Total errors: %d", errors);
exit(errors);
@cjappl
cjappl / .config
Last active May 5, 2023 22:56
Working OSX m1-> raspbery pi 3 crosstools recipe
#
# Automatically generated file; DO NOT EDIT.
# crosstool-NG 1.25.0 Configuration
#
CT_CONFIGURE_has_cxx11=y
CT_CONFIGURE_has_lzip=y
CT_CONFIGURE_has_curl=y
CT_CONFIGURE_has_ninja=y
CT_CONFIGURE_has_rsync=y
CT_CONFIGURE_has_make_3_81_or_newer=y
@cjappl
cjappl / QuotedStringsFSM.cpp
Created January 1, 2023 01:11
Output Quoted Strings Finite State Machine (FSM) in C++ - Topic 29 of Pragmatic Programmer
// Based on general design of this FSM: https://www.aleksandrhovhannisyan.com/blog/implementing-a-finite-state-machine-in-cpp/
/*
* stateDiagram
direction LR
LookForString --> LookForString: *
LookForString --> InString: ch == ", InitResult()
InString --> InString: ch == anything else, AddToResult()
InString --> LookForString: ch == ", OutputResult()
InString --> CopyNextChar: ch == \, AddToResult()
@cjappl
cjappl / OSAudioWorkgroup.cpp
Last active December 23, 2022 17:38
Working version of OS Audio Workgroup Join os_workgroup_join, AudioWorkIntervalCreate
#include <mach/mach_time.h>
#import <AudioToolbox/AudioToolbox.h>
#include <thread>
#include <chrono>
#include <mach/mach_init.h>
#include <mach/thread_policy.h>