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
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 \ |
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
sigmoid(x) = 1.0 ./ (1.0 + exp(-x)) | |
dsigmoid(y) = y .* (1.0 - y) | |
type MLP3 | |
W¹::Matrix{Float64} | |
b¹::Vector{Float64} | |
W²::Matrix{Float64} | |
b²::Vector{Float64} | |
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 | |
# e.g. bash vim_benchmark.sh 10 | |
LOGFILE=$(mktemp) | |
ITER=$1 | |
function echo_mean_and_std() { | |
m=$(grep "editing files" $1 | awk 'BEGIN{m=0.0} {m+=$1} END{print m/NR}') |
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
const libapr = "./libapr-1.0" | |
@assert dlopen(libapr) != C_NULL | |
argc = Array(Cint, 1) | |
argv = Array(Ptr{Cchar}, 1) | |
env = Array(Ptr{Cchar}, 1) | |
# 引数なしの初期化 | |
# ccall((:apr_initialize, libapr), Void, ()) |
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
53c53 | |
< double *waveform) { | |
--- | |
> double *waveform, int waveform_length) { | |
66c66,68 | |
< for (int i = 0; i <= half_window_length * 2; ++i) | |
--- | |
> int upper_bound = half_window_length * 2 > waveform_length - 1 ? | |
> waveform_length - 1 : half_window_length * 2; | |
> for (int i = 0; i <= upper_bound; ++i) |