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
push!(LOAD_PATH, ".") | |
using BNMF | |
using PyCall | |
# bp_nmf のコードと比較するために、librosaを使う | |
@pyimport librosa | |
function spectrogram() | |
x, ss = librosa.load("test.wav", sr=16000) | |
X = abs(librosa.stft(x, n_fft=1024, hop_length=256)) |
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
;; User behaviors | |
;; ----------------------------- | |
;; Behaviors are stored as a set of diffs that are merged together | |
;; to create the final set of functionality that makes up Light Table. You can | |
;; modify these diffs to either add or subtract functionality. | |
;; | |
;; Behaviors are added to tags, objects with those tags then automatically gain | |
;; whatever logic the behavior imparts. To see a list of user-level behaviors, | |
;; start typing a word related to the functionality you want in between the square | |
;; brackets (e.g. "theme"). |
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
#!/bin/bash | |
function install_libsndfile() { | |
name=libsndfile-1.0.25.tar.gz | |
wget -O $name http://www.mega-nerd.com/libsndfile/files/$name | |
tar xzvf $name | |
cd `basename $name ".tar.gz"` | |
./configure --prefix=$PWD/.. |
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
function updateE!(hmm::HMM, | |
Y::AbstractMatrix, # shape: (D, T) | |
α::Matrix{Float64}, # shape: (K, T) | |
β::Matrix{Float64}, # shape: (K, T) | |
γ::Matrix{Float64}, # shape: (K, T) | |
ξ::Array{Float64, 3}, # shape: (K, K, T-1) | |
B::Matrix{Float64}) # shape: (K, T) | |
const D, T = size(Y) | |
# Gaussian prob. |
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
# Hidden Markov Models | |
using Distributions | |
type HMM | |
K::Int # number of possible states | |
μ::Array{Float64, 2} # shape (D, K) | |
π::Array{Float64, 1} # shape (K) | |
A::Array{Float64, 2} # shape (K, K) | |
Σ::Array{Float64, 3} # shape (D, D, K) |
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
#!/bin/bash | |
# This is a yet another download script for the cmu arctic speech corpus. | |
# The corpus will be downloaded in $HOME/data/cmu_arctic/ | |
location=$HOME/data/cmu_arctic/ | |
if [ ! -e $location ] | |
then | |
echo "Create " $location |
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
backward_plan2{T<:Union(Float32, Float64)}(X::AbstractArray{Complex{T}}, Y::AbstractArray{T}) = | |
FFTW.Plan(X, Y, 1, FFTW.ESTIMATE | FFTW.PRESERVE_INPUT, FFTW.NO_TIMELIMIT).plan | |
function istft2{T<:Union(Float32, Float64)}(S::AbstractMatrix{Complex{T}}, wlen::Int, overlap::Int; nfft=nextfastfft(wlen), window::Union(Function,AbstractVector,Nothing)=nothing) | |
winc = wlen-overlap | |
win, norm2 = compute_window(window, wlen) | |
if win != nothing | |
win² = win.^2 | |
end | |
nframes = size(S,2)-1 |
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
""" | |
こんな感じでVCできたらいいなぁという設計の例 | |
""" | |
class Analyizer(object): | |
""" | |
音声分析のインタフェース | |
""" |
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
function dft{T}(x::Vector{T}) | |
N = length(x) | |
X = Array(Complex{T}, N) | |
for k = 1:N | |
s = 0.0 + 0.0im | |
for n = 1:N | |
s += x[n] * exp(2π * (-im) * k * n / N) | |
end | |
X[k] = s | |
end |
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
#/bin/bash | |
# requirement: curl | |
base=http://hts.sp.nitech.ac.jp/archives/2.3beta/ | |
for name in \ | |
HTS-demo_NIT-ATR503-M001.tar.bz2 \ | |
HTS-demo_CMU-ARCTIC-ADAPT.tar.bz2 \ |