Skip to content

Instantly share code, notes, and snippets.

View davidavdav's full-sized avatar

David van Leeuwen davidavdav

  • @SpraakLab
  • Nijmegen
View GitHub Profile
@davidavdav
davidavdav / noise.jl
Created April 25, 2020 13:31
Some routines for computing energy levels in speech
#!/usr/bin/env julia
## (c) David A. van Leeuwen
## routines for adding noise at the right level
import MFCC
import WAV
import ProgressMeter
import StatsBase
import LinearAlgebra
import DelimitedFiles
@davidavdav
davidavdav / external-in-loop
Last active August 29, 2015 14:08
internal or external sumsq() in inner loop ~ factor ~ 10 execution time
## weirdness in innerloop optimization
## similar to sumabs2()
function mydot{T}(x::Array{T})
s = zero(T)
for xx in x
s += xx*xx
end
s
end
## make matrix symmetric by copying the upper triangle into the lower
## this should exist somewhere...
function symm!(m::Matrix)
for i=1:size(m,1)
for j=i+1:size(m,2)
m[j,i] = m[i,j]
end
end
m
end