Skip to content

Instantly share code, notes, and snippets.

@naotokui
naotokui / midi_playback.py
Last active Jan 2, 2021
Play MIDI file in Python
View midi_playback.py
# see: https://www.daniweb.com/programming/software-development/code/216976/play-a-midi-music-file-using-pygame
# sudo pip install pygame
# on ubuntu
# sudo apt-get install python-pygame
import pygame
def play_music(music_file):
View conditional_vae_keras.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View audio_classification_spectrogram.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naotokui
naotokui / surfspots.json
Last active Aug 23, 2020
location info of 5980 surf spots around the world
View surfspots.json
[
{
"lng" : "4.1428327560425",
"lat" : "52.01150069904",
"country" : "Netherlands",
"name" : "'s-Gravenzande"
},
{
"lng" : "3.3628463745118",
"lat" : "51.370923071145",
@naotokui
naotokui / conv_autoencoder_keras.ipynb
Created Jan 10, 2017
Convolutional Autoencoder in Keras
View conv_autoencoder_keras.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naotokui
naotokui / GAN-808_keras.ipynb
Created Jul 14, 2017
GAN-based drumloop generation (work in progress)
View GAN-808_keras.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naotokui
naotokui / GAN-and-trainable.py
Last active Apr 30, 2020
How model.trainable = False works in keras (GAN model)
View GAN-and-trainable.py
# coding: utf8
## based on this article: http://qiita.com/mokemokechicken/items/937a82cfdc31e9a6ca12
import numpy as np
from keras.models import Sequential
from keras.engine.topology import Input, Container
from keras.engine.training import Model
from keras.layers.core import Dense
@naotokui
naotokui / vae_keras.ipynb
Created Jun 28, 2017
variational autoencoder in keras
View vae_keras.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naotokui
naotokui / General-MIDI-GM-drum-names.json
Created Jan 6, 2020
General MIDI Drum Names and MIDI Note mapping
View General-MIDI-GM-drum-names.json
{
35: "Acoustic Bass Drum",
36: "Bass Drum 1",
37: "Side Stick",
38: "Acoustic Snare",
39: "Hand Clap",
40: "Electric Snare",
41: "Low Floor Tom",
42: "Closed Hi Hat",
43: "High Floor Tom",
@naotokui
naotokui / emoji_regex.py
Created May 19, 2017
find unicode emoji in python regex
View emoji_regex.py
import re
emoji_pattern = re.compile(
u"(\ud83d[\ude00-\ude4f])|" # emoticons
u"(\ud83c[\udf00-\uffff])|" # symbols & pictographs (1 of 2)
u"(\ud83d[\u0000-\uddff])|" # symbols & pictographs (2 of 2)
u"(\ud83d[\ude80-\udeff])|" # transport & map symbols
u"(\ud83c[\udde0-\uddff])" # flags (iOS)
"+", flags=re.UNICODE)