Skip to content

Instantly share code, notes, and snippets.

View mtmccrea's full-sized avatar
🦚
☁️_☁️

Mike McCrea mtmccrea

🦚
☁️_☁️
  • Helsinki, Finland
View GitHub Profile
@mtmccrea
mtmccrea / CtkScore_groupTogether.txt
Last active October 18, 2016 20:28
Temporary fix for CtkScore's groupTogether method
groupTogether {
var maxEventsAtOneTime = 30;
var masterScore_tmp = [];
masterScore = masterGroups ++ masterNotes ++ masterMessages;
// sort all events by start time
masterScore.sort({arg a, b;
a.starttime < b.starttime;
});
@mtmccrea
mtmccrea / phase_unwrapping.scd
Last active January 14, 2017 01:26
Phase unwrapping alternatives

( // Josh's version in the current ATK UGens // "UNWRAPANGLE" ~uwr ={|next,prev| [next,prev].postln; if (abs(mod(next, 2pi) - mod(prev, 2pi)) <= pi) { next = prev + mod(next, 2pi) - mod(prev, 2pi); }{ if ((mod(next, 2pi) - mod(prev, 2pi)) < 0)

@mtmccrea
mtmccrea / ATK-headtracker-demo.scd
Created May 8, 2017 18:51
Use yaw, pitch, roll readings from headtracker (ArduinoQuaternion quark) to create opposing ambisonic transforms for head-tracked soundfields.
SerialPort.listDevices
// a = ArduinoQuaternion( "/dev/tty.AdafruitEZ-Link3e2f-SPP", 38400)
a = ArduinoQuaternion( "/dev/tty.AdafruitEZ-Link416c-SPP", 38400)
// set the action to be performed with every new
// reading of the sensor. yaw, pitch, and roll are
// passed into your action function
a.action = { |y,p,r|
[ y,p,r ].raddeg.postln
// Frequency shifter (SSB) with no carrier present in output
// Modification of Jo Anderson's SSB, using a Hilbert FIR transform
(
x = { |shiftFreq=200|
var ssb, src, phase=0, kernelSize=2048;
// signal to shift
src = SinOsc.ar([500,2000], mul:0.5).sum;
ssb = Mix.ar(
// An ad hoc decoder builder using mode matching (pseudo-inverse)
// FuMa, MaxN normalized
(
var azims_sat, inclins_sat, directions_sat, distances_sat;
var azims_sub, directions_sub, distances_sub;
var maxDist, delayTimes_sat, delayTimes_sub;
var foaEncoderMatrix_sat, decoderMatrix_sat;
var foaEncoderMatrix_sub, decoderMatrix_sub;
@mtmccrea
mtmccrea / HOA-signal-unit-test-prototype.scd
Last active December 22, 2018 03:55
HOA signal unit test prototype
/*
Prototype for potential ATK-HOA unit test for HOA signals/filters
*/
// Test NFE filters (or other HOA UGens) with an Impulse
// write the result to file for later comparison (unit tests, etc.)
// analysis buffer initialisation, boots the server
@mtmccrea
mtmccrea / git-mv-with-history
Created January 9, 2019 20:56 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@mtmccrea
mtmccrea / PartConv-impulse-signal-test
Last active February 13, 2019 00:37
Testing PartConv, PartConv2 at specific locations against expected output position, amp and delay
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* PartConv, PartConv2: Test signal - Impulse or DC */
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Testing the kernel at specific locations against expected
// output position, amp and delay
// SOME RESULTS:
// DonConv has errors in certain impulse positions once the 'ksize' gets to 2**19 (~12s @ 44.1k) at 44100
@mtmccrea
mtmccrea / terminal_stylesheet.txt
Created July 5, 2019 20:12
terminal prompt and output styling. copy into to .bash_profile
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
@mtmccrea
mtmccrea / swap_sc_class_lib.scd
Last active July 9, 2019 19:48
Swap SuperCollider's class library with one from another location (e.g. SC repo fork)

( // enable repo class lib LanguageConfig.addExcludePath(Platform.resourceDir +/+ "SCClassLibrary"); LanguageConfig.addIncludePath("/Users/admin/src/supercollider-mtmccrea/SCClassLibrary"); LanguageConfig.store; thisProcess.recompile )

( // restore default class lib LanguageConfig.removeExcludePath(Platform.resourceDir +/+ "SCClassLibrary");