Skip to content

Instantly share code, notes, and snippets.

Envelope envelope = new Envelope() {
Attack = 1000,
Sustain = 2500,
Release = 2000,
Start = -80,
Rise = 80
};
@kindohm
kindohm / slider.xaml
Created December 2, 2010 14:22
Simple Slider
<phone:PhoneApplicationPage
x:Class="WindowsPhoneApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
>
<Grid x:Name="LayoutRoot" Background="Transparent">
<Slider
Minimum="0"
Maximum="100"
<ControlTemplate x:Key="PhoneSimpleRepeatButton" TargetType="RepeatButton">
<Rectangle Fill="Transparent"/>
</ControlTemplate>
<ControlTemplate x:Key="PhoneSimpleThumb" TargetType="Thumb">
<Rectangle Fill="Transparent"/>
</ControlTemplate>
<ControlTemplate x:Key="VerticalThumb" TargetType="Thumb">
<Rectangle Fill="{StaticResource PhoneForegroundBrush}"/>
</ControlTemplate>
<Style x:Key="SynthSlider" TargetType="Slider">
@kindohm
kindohm / audioCallback.js
Created December 22, 2011 17:58
audiolib.js - two oscillators, two lfo's, one for each channel
function buildAudio() {
audioDevice = audioLib.AudioDevice(audioCallback, channelCount);
oscillator1 = audioLib.Oscillator(audioDevice.sampleRate, 440);
oscillator2 = audioLib.Oscillator(audioDevice.sampleRate, 441);
lfo1 = audioLib.Oscillator(audioDevice.sampleRate, 1);
lfo2 = audioLib.Oscillator(audioDevice.sampleRate, 2);
oscillator1.addAutomation('frequency', lfo1, .25, 'additiveModulation');
oscillator2.addAutomation('frequency', lfo2, .55, 'additiveModulation');
}
@kindohm
kindohm / fft.js
Created May 1, 2012 20:50
audiolib.js fft
/*
This code demonstrates how to use a Fast Fourier Transform
with audiolib.js. It pushes samples to an FFT and draws
the FFT spectrum on an HTML5 canvas.
Author: Mike Hodnick
MIT License
*/
@kindohm
kindohm / gist:4643056
Last active November 28, 2023 18:23
converts .wav files to base64 encoded text
//crude and incomplete but it works
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var constants = require('constants');
var size = 0;
var encoded = '';
var fileName = '';
var wavFileName = '';
var base64FileName = '';
@kindohm
kindohm / .hg-churn
Last active December 12, 2015 01:38
hg-churn in powershell
changeset = "{files}"
file = "{file}\n"
@kindohm
kindohm / tidal.emacs
Created March 6, 2014 12:55
tidal.emacs
(add-to-list 'load-path "~/code/Tidal")
(require 'tidal)
;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))
(set-frame-parameter (selected-frame) 'alpha '(65 40))
(add-to-list 'default-frame-alist '(alpha 65 40))
(eval-when-compile (require 'cl))
(defun toggle-transparency ()
(interactive)
@kindohm
kindohm / tccc16-live-coding-demo.tidal
Created April 7, 2014 18:44
tccc16-live-coding-demo.tidal
# hi.
d1 $ slowspread ($) [density 2, striate 3, slow 1, (|+| pan "[0 1 0 1 0 1]*2]")] $ every 3 (0.25 <~) $ jux (iter 8) $ sound "bd*4 [cp hh*2] [rm sn] [sn*4 bd*2]" |+| speed "[1 2 3 4]/4"
d2 $ jux (iter 8) $ striate' 128 (1/100) (sound "alone:7")
|+| speed "[1 0.8]/2"
d3 $ sound (samples "jvbass*4 ~ jvbass*4 jvbass*4" (slow 0.8 $ run 19))
|+| speed "[1 0.8 1.25]/4"
@kindohm
kindohm / play.hs
Created April 23, 2014 13:37
Python and Haskell code for recording a 1-min Tidal loop
{-# LANGUAGE OverloadedStrings #-}
module Play where
import Control.Applicative
import Control.Concurrent
import Control.Monad
import Data.List
import Data.Ratio
import Sound.Tidal.Dirt