This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In my humble village, | |
I have a bad reputation. | |
Whether I try to argue or remain silent, | |
I pass for a good-for-nothing. | |
Yet I'm not hurting anyone, | |
By following my own unpretentious path. | |
(Chorus) | |
But the good people don't like it, | |
When we follow a path different from theirs! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pylab | |
ratio = 0.333 | |
t = numpy.arange(1000.0) / 1000.0 | |
s = 0 | |
for n in xrange(1, 1000): | |
harmonic = numpy.cos(2 * numpy.pi * t * n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void VoiceController::Clock(bool midi_generated) { | |
voice_.set_lfo_pll_target_phase(lfo_sync_counter_); | |
if (!clock_counter_) { | |
if (!clock_out_counter_) { | |
clock_pulse_ = 8; | |
} | |
clock_out_counter_ = (clock_out_counter_ + 1) & 1; // Divide by 2. | |
ClockArpeggiator(); | |
ClockSequencer(); | |
ClockDrumMachine(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pylab | |
# coeff = numpy.exp(numpy.arange(65536) * numpy.log(1000) / 65536.0) * 32.768 | |
# coarse_table = numpy.round(coeff[::4096]) | |
# fine_table = numpy.round(coeff[:4096+256:256] / 32.768 * 32768) | |
coarse_table = [ 33, 50, 78, 120, 184, 284, 437, 673, 1036, 1596, 2457, 3784, 5827, 8973, 13818, 21279 ] | |
fine_table = [ 32768, 33664, 34585, 35531, 36503, 37501, 38527, 39580, 40663, 41775, 42918, 44092, 45298, 46536, 47809, 49117, 50460 ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def bin_string(n, size): | |
l = ['0'] * size | |
for i in xrange(size): | |
l[size - 1 - i] = '01'[n % 2] | |
n /= 2 | |
return ''.join(l) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pylab | |
def f(n, bit): | |
if bit == 0: | |
return n | |
else: | |
if n & (1 << bit): | |
return f(n % (1 << bit), bit - 1) + (n & (1 << (bit - 1))) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
global r, n | |
def run_mr(data, mapper, reducer): | |
"""Runs a map reduce locally.""" | |
shuffled = {} | |
for k, v in data: | |
for out_k, out_v in mapper(k, v): | |
shuffled.setdefault(out_k, []).append(out_v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
global r, n | |
def run_mr(data, mapper, reducer): | |
"""Runs a map reduce locally.""" | |
shuffled = {} | |
for k, v in data: | |
for out_k, out_v in mapper(k, v): | |
shuffled.setdefault(out_k, []).append(out_v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pylab | |
points = [ | |
(3, 3.0), | |
(3, 3.0), | |
(3, 3.0), | |
(2, 2.0), | |
(2, 2.0), | |
(2, 2.0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import pylab | |
delta = 0.01 | |
omega = 0.05 | |
omega_noise = 0.2 | |
A = 5 | |
A_noise = 0.2 | |
phi = 0.8 | |
N = 1000 |