Skip to content

Instantly share code, notes, and snippets.

View mathigatti's full-sized avatar

Mathias Gatti mathigatti

View GitHub Profile
import time
from rtmidi.midiutil import open_midiinput
port = 0
midi_in, port_name = open_midiinput(port)
last_gestures = []
last_gesture = None
while True:
@mathigatti
mathigatti / filling_the_sample_gaps.py
Created October 14, 2020 19:32
Short script for creating missing note samples detuning the ones you have.
!pip install librosa
import glob
import os
import librosa
def closest_sample(note, notes):
absolute_difference_function = lambda list_value : abs(list_value - note)
return min(notes, key=absolute_difference_function)
def detune(audio_file, semitone_steps, output_file):
import sounddevice as sd
import soundfile as sf
import threading
import time
def find_source(source):
devices = sd.query_devices()
for i, v in enumerate(list(devices)):
if v["name"] == source:
return i
import curses, os
def main(stdscr):
# do not wait for input when calling getch
stdscr.nodelay(1)
while True:
# get keyboard input, returns -1 if none available
c = stdscr.getch()
if c != -1:
# print numeric value
import sys
import os
import argparse
import json
import re
import tensorflow.compat.v1 as tf
import numpy as np
from train.modeling import GroverModel, GroverConfig, sample
@mathigatti
mathigatti / code2sound.py
Last active August 18, 2020 22:12
Script for playing FoxDot code from a text file
import sys
import time
import multiprocessing
import os
def supercollider():
SC_CMD = "rm -f /tmp/foxdot.sc; echo FoxDot.start >> /tmp/foxdot.sc; sclang /tmp/foxdot.sc"
proc = multiprocessing.Process(target=lambda : os.system(SC_CMD), args=())
proc.start()
return proc
@mathigatti
mathigatti / code2wav.py
Last active August 18, 2020 22:11
Script for converting FoxDot code into wav audio file
import os
import sys
import time
import multiprocessing
def supercollider():
SC_CMD = "rm -f /tmp/foxdot.sc; echo FoxDot.start >> /tmp/foxdot.sc; sclang /tmp/foxdot.sc"
proc = multiprocessing.Process(target=lambda : os.system(SC_CMD), args=())
proc.start()
return proc
import os
import sys
def unir_txts(carpeta_con_los_txts):
lista_de_txts = os.listdir(carpeta_con_los_txts) # Esto arma la lista de todos los archivos que estan en ese directorio/carpeta
texto_final = "" # Variable donde voy a ir juntando el texto de todos los txts
for nombre_del_txt in lista_de_txts: # recorro los archivos uno por una
# uno el nombre de la carpeta con el nombre del archivo para armar la ruta exacta donde el txt se ubica
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.