Skip to content

Instantly share code, notes, and snippets.

View milesegan's full-sized avatar
💭
/╲/\╭(ఠఠ益ఠఠ)╮/\╱\

Miles Egan milesegan

💭
/╲/\╭(ఠఠ益ఠఠ)╮/\╱\
View GitHub Profile
@milesegan
milesegan / gist:9479254
Created March 11, 2014 03:56
vst startup hook
VST_EXPORT AEffect* VSTPluginMain (audioMasterCallback audioMaster)
{
if (!audioMaster(0, audioMasterVersion, 0, 0, 0, 0)) return 0;
AudioEffect* effect = new MyVST(audioMaster);
effect->init(); // <--- implement your own init() method that configures the vst
return effect->getAeffect ();
}
@milesegan
milesegan / 2013_top_ten
Last active December 31, 2015 16:58
top albums of 2013
In no particular order:
* Toro Y Moi - Anything In Return
Brilliant electronic pop/soul record with some very strong songwriting.
* Humble Bee - Henrietta
Sublime ambient hypnosis, for once not only availble in ultra-limited CD run.
* Autechre - Exai
Autechre finally makes the masterpiece they've been orbiting for the last half-decade.
@milesegan
milesegan / make_resources.py
Created March 22, 2012 01:13
python retina display resources helper script
#!/usr/bin/env python
#
# Simple script that uses PIL to automatically generate both 1x and 2x resolution
# PNGs from a source directory of 2x files. Handy for iPhone/iPad retina assets.
#
import glob
i
@milesegan
milesegan / ExportUI.jsf
Created August 20, 2011 06:22
fireworks scripts for VST development
// -*- javascript -*-
// Install this in your FireWorks extensions directory.
// It exports all elements with a targetText attribute. It also expects that the elements to
// export are instances of a symbol type.
//
// For instance, create a symbol of type "knob", and place several instances of it on your
// UI with targetText attributes pointing to the string name of the parameter that knob controls.
//
var outURL = "/Users/miles/tmp/layout.txt";
@milesegan
milesegan / EmbedYouTubeTag.rb
Created June 27, 2011 08:02
embed_youtube tag plugin for Jekyll
# Provides an "embed_youtube" tag for Jekyll's Liquid templates.
# Much cleaner than pasting in <object> tags.
require 'uri'
module Jekyll
class EmbedYouTubeTag < Liquid::Tag
def initialize(tag_name, text, tokens)
@milesegan
milesegan / gist:877906
Created March 19, 2011 23:30
c99 fft example
float imag[size_2];
float real[size_2];
DSPSplitComplex comp = (DSPSplitComplex) { .imagp = imag, .realp = real };
vDSP_ctoz((DSPComplex *)windowedSamples, 2, &comp, 1, size_2);
vDSP_fft_zrip(self.fftSetup, &comp, 1, logSize, kFFTDirection_Forward);
@milesegan
milesegan / gist:877903
Created March 19, 2011 23:26
c99 designated initializer example
AudioStreamBasicDescription fmt = (AudioStreamBasicDescription) {
.mChannelsPerFrame = 1,
.mBytesPerFrame = sizeof(int16_t),
.mBytesPerPacket = sizeof(int16_t),
.mFramesPerPacket = 1,
.mBitsPerChannel = sizeof(int16_t) * 8,
.mFormatID = kAudioFormatLinearPCM,
.mSampleRate = 44100.0,
.mFormatFlags = kAudioFormatFlagIsBigEndian |
kAudioFormatFlagIsPacked |
@milesegan
milesegan / gist:877898
Created March 19, 2011 23:20
c99 variable-length array example
// the old way:
int calculate_z(int a, int b)
{
int *buffer = malloc(a * sizeof(int));
// ...
free(buffer);
}
// the new way:
int calculate_z(int a, int b)
@milesegan
milesegan / Make Knob.js
Created January 21, 2011 19:23
knob rotation image sequence generator script for photoshop
// photoshop knob generation script
// This script assumes your source document contains a layer group
// called "indicator" that can be successively rotated around its
// center to generate a series of rotation state images.
// - Miles Egan January 2011
// change this to the number of discrete rotations you want
var numRotations = 65;
var rotAngle = 270;
var step = rotAngle / (numRotations - 1);
@milesegan
milesegan / parse_layout
Created January 17, 2011 22:29
photoshop slice export parser
#!/usr/bin/env python
import os, re, sys
from xml.etree.ElementTree import ElementTree
def hash_style(s):
s = re.split(r";\s+", s)
s = [re.split(r":", x) for x in s]
s = [(x[0], re.sub(r"[^0-9]", "", x[1])) for x in s if re.match(r"^\d", x[1])]
return dict(s)