Skip to content

Instantly share code, notes, and snippets.

View craffel's full-sized avatar

Colin Raffel craffel

View GitHub Profile
@craffel
craffel / gist:a90a8baff0377e7f9542
Created June 8, 2015 20:54
Dynamic time warping in Theano
'''
Dynamic time warping implementation in Theano
See also
https://github.com/astanway/theano-dtw
https://github.com/danielrenshaw/TheanoBatchDTW
'''
import theano
import theano.tensor as T
@craffel
craffel / gist:50a422f431350f0b3b09
Last active May 28, 2018 23:40
Faster pretty_midi Fluidsynth method
import tempfile
import subprocess
import os
import pretty_midi
import librosa
def fast_fluidsynth(m, fs):
'''
Faster fluidsynth synthesis using the command-line program
instead of pyfluidsynth.
@craffel
craffel / draw_neural_net.py
Created January 10, 2015 04:59
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
@craffel
craffel / pretty_midi chiptunes.ipynb
Last active October 24, 2015 00:45
Functions for drum synthesis, arpeggiation and chiptunes synthesis in pretty_midi. View here: http://nbviewer.ipython.org/gist/craffel/3eb7513d4540f4acee93
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.