Skip to content

Instantly share code, notes, and snippets.

@naotokui
naotokui / vscode_audio.py
Last active August 22, 2022 21:46
play audio on Visual Studio Code
# from vscode_audio import *
# Audio(audio_numpy_array, sr=SR)
import IPython.display
import numpy as np
import json
def Audio(audio: np.ndarray, sr: int):
"""
Use instead of IPython.display.Audio as a workaround for VS Code.
@naotokui
naotokui / General-MIDI-GM-drum-names.json
Created January 6, 2020 01:29
General MIDI Drum Names and MIDI Note mapping
{
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 / clarinet.wav
Last active June 20, 2019 07:54
Instruments Recognition
@naotokui
naotokui / phase_reconstruction_test.ipynb
Created November 1, 2018 09:04
Spectrogram Phase Reconstruction Test - Comparison between LWS and GriffinLim
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naotokui
naotokui / export_mp3.py
Created January 14, 2018 05:54
export mp3 in python using ffmpeg
from subprocess import call
import shutil
def export_as_mp3(export_path, y, sr, bitrate='192k'):
tmp_input_path = "/tmp/___mp3___.wav"
tmp_output_path = "/tmp/___mp3___.mp3"
librosa.output.write_wav(tmp_input_path, y, sr)
call(["ffmpeg", "-i", tmp_input_path, "-b:a", str(bitrate), tmp_output_path])
shutil.move(tmp_output_path, export_path)
@naotokui
naotokui / face_emotion_keras2.ipynb
Last active December 10, 2018 11:59
Face -> Emotion recognition
Loading
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 October 4, 2024 18:08
location info of 5980 surf spots around the world
[
{
"lng" : "4.1428327560425",
"lat" : "52.01150069904",
"country" : "Netherlands",
"name" : "'s-Gravenzande"
},
{
"lng" : "3.3628463745118",
"lat" : "51.370923071145",
@naotokui
naotokui / GAN-and-trainable.py
Last active October 14, 2021 19:46
How model.trainable = False works in keras (GAN model)
# 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 / GAN-808_keras.ipynb
Created July 14, 2017 10:17
GAN-based drumloop generation (work in progress)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.