Skip to content

Instantly share code, notes, and snippets.

View sotelo's full-sized avatar

Jose sotelo

  • Montréal
View GitHub Profile
@sotelo
sotelo / server.py
Created March 17, 2017 19:03
Small flask example
from flask import Flask
from flask import request
from flask import jsonify
app = Flask(__name__)
@app.route("/")
def index():
return "Welcome"
@sotelo
sotelo / librispeech.py
Created January 18, 2017 01:54
librispeech initial processing
import os
import glob
from shutil import copyfile
from subprocess import Popen
base_dir = '/Tmp/sotelo/data/librispeech/'
raw_dir = os.path.join(
base_dir, 'downloads/LibriSpeech/train-clean-100')
wav_dir = os.path.join(base_dir, 'wav')
@sotelo
sotelo / remove_silence.py
Created January 17, 2017 05:08
Remove silences
# From https://stackoverflow.com/questions/29547218/
# remove-silence-at-the-beginning-and-at-the-end-of-wave-files-with-pydub
from pydub import AudioSegment
def detect_leading_silence(sound, silence_threshold=-50.0, chunk_size=10):
'''
sound is a pydub.AudioSegment
silence_threshold in dB
chunk_size in ms
@sotelo
sotelo / pavoque.py
Created January 12, 2017 20:23
pavoque to hdf5
from run_merlin import prepare_file_path_list, read_file_list
from io_funcs.binary_io import BinaryIOCollection
import numpy
import h5py
import pickle
from fuel.datasets.hdf5 import H5PYDataset
io_fun = BinaryIOCollection()
n_outs = 63 # 187
@sotelo
sotelo / pavoque_data.txt
Created January 12, 2017 19:58
Pavoque data processing.
All the traces of the processing are in leto11.
1. Extract data with pavoque-repo
1.5 Convert wav to 16k. I use ch_wave -otype riff -F 16000 -o wav/${X} wav48/${X}
2. Copy data in /Tmp/sotelo/data/german/raw
3. cd /Tmp/sotelo/results/merlin/egs/build_your_own_voice/s1
@sotelo
sotelo / pavoque.py
Created January 12, 2017 18:16
process pavoque labels
import os
import glob
from shutil import copyfile
base_dir = '/Tmp/sotelo/data/german/raw'
text_dir = os.path.join(base_dir, 'text')
wav_dir = os.path.join(base_dir, 'wav/')
audio_files = [
@sotelo
sotelo / temp.py
Last active March 3, 2016 22:34
test simple model file
from blocks.main_loop import MainLoop
from blocks.model import Model
from blocks.utils import shared_floatx_zeros, shared_floatx
from theano import tensor, config, function
from play.bricks.custom import (DeepTransitionFeedback, GMMEmitter,
SPF0Emitter)
from blocks.extensions.monitoring import TrainingDataMonitoring
@sotelo
sotelo / arbol.R
Created May 19, 2015 04:21
grafica arbol
library("igraph")
num_layer = 7
num_nodes = (num_layer+1)*num_layer/2
M <-matrix(rep(0,num_nodes*num_nodes),nrow=num_nodes,ncol=num_nodes)
layout <- matrix(rep(0, 2*num_nodes), nrow=num_nodes)
node = 0
for(layer in 1:num_layer){
@sotelo
sotelo / variance_aggregation.py
Created May 18, 2015 17:18
Mean and Variance aggregation scheme.
from theano import tensor
from theano.ifelse import ifelse
from blocks.utils import shared_like
from blocks.monitoring.aggregation import AggregationScheme, Aggregator
class MeanAndVariance(AggregationScheme):
"""Aggregation scheme which computes the mean.
Parameters
----------
numerator : :class:`~tensor.TensorVariable`
@sotelo
sotelo / simpler.py
Created May 18, 2015 15:45
Different behaviour in gpu and cpu.
import theano
import numpy
from collections import OrderedDict
from fuel.datasets import IndexableDataset
from fuel.streams import DataStream
from fuel.schemes import SequentialScheme
from theano import tensor