This file contains 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
""" | |
Find songs with keys that are reasonably in tune (less than 1 semitone apart) | |
with their tempo. Uses dataset from: | |
https://data.world/kcmillersean/billboard-hot-100-1958-2017 | |
""" | |
from math import sqrt | |
import numpy as np |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "hardware/gpio.h" | |
#include "hardware/uart.h" | |
#include "hardware/irq.h" | |
#include "../lib/lcd.hpp" | |
// globals |
This file contains 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
#include <SD.h> | |
File lg; | |
void setup() | |
{ | |
// Set MIDI baud rate | |
Serial1.begin(31250); | |
Serial.begin(9600); |
This file contains 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
Sequencer | Min (us) | Max (us) | Range (us) | Std. Dev (us) | |
---|---|---|---|---|---|
MC50 | 122192 | 128088 | 5896 | 941 | |
Ubuntu/Reaper | 123340 | 126302 | 2962 | 614 | |
E6400 Ultra | 123794 | 124972 | 1178 | 507 | |
MPC2500 | 122850 | 127018 | 4168 | 475 | |
Surface/Reaper | 123940 | 125984 | 2044 | 427 | |
BeatStep Pro | 119712 | 125002 | 5290 | 343 | |
DOS/Voyetra | 123800 | 125856 | 2056 | 279 | |
QY100 | 124572 | 125492 | 920 | 231 | |
macOS/Reaper | 124602 | 125106 | 504 | 205 |
This file contains 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 sys | |
import wave | |
import struct | |
THRESHOLD = 0.3 | |
DECAY = 0.100 | |
def getsamples(w): | |
assert(w.getnchannels() == 1) | |
assert(w.getsampwidth() == 3) |
This file contains 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 random | |
class hlist(list): | |
def __hash__(self): | |
return ','.join(self).__hash__() | |
def IPMotif(text): | |
d = {} | |
motif = hlist() |
This file contains 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 | |
from pylab import * | |
def f(t): | |
omega = 200.0 * 2 * math.pi | |
return math.fmod(omega*t, 2*math.pi)/(2*math.pi) | |
def g(t): | |
omega = 300.0 * 2 * math.pi | |
return math.fmod(omega*t, 2*math.pi)/(2*math.pi) |
This file contains 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 | |
from pylab import * | |
R = 44100 | |
f = 44000 | |
def y(t): | |
value = 0.0 | |
for n in range(1, 100): | |
# convert f*n to angular speed |
This file contains 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
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
const double semitone_ratio = pow(2.0, 1.0/12.0); | |
const double c5 = 220.0 * pow(semitone_ratio, 3); | |
const double c0 = c5 * pow(0.5, 5); | |
double frequency, fracmidi, difference; | |
int midinote; |