Skip to content

Instantly share code, notes, and snippets.

View edwardyoon's full-sized avatar

Edward J. Yoon edwardyoon

View GitHub Profile
@edwardyoon
edwardyoon / gist:0ac61cc393c50918474921b69629e668
Created November 21, 2018 07:29
Gets the duration time of wav file In Java
private static float getDuration(File file) throws Exception {
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file);
AudioFormat format = audioInputStream.getFormat();
long audioFileLength = file.length();
int frameSize = format.getFrameSize();
float frameRate = format.getFrameRate();
float durationInSeconds = (audioFileLength / (frameSize * frameRate));
return (durationInSeconds);
}
@edwardyoon
edwardyoon / mf.py
Created February 7, 2019 05:08
Matrix Factorization using Numpy
import numpy as np
class MF():
def __init__(self, R, K, alpha, beta, iterations):
"""
Perform matrix factorization to predict empty
entries in a matrix.
Arguments