def ReadWavFile(filename): ''' Read wav data from the file at filename. ''' return M.wavread(filename)
import os import numpy as np import marlib.matlab as M import mirlib.feature_extraction.eventDetect as ed import mirlib.FFTParams as fftparams from matplotlib.pylab import * #inputfile = '../audio_files/GV02_A_Format4min.wav' inputfile = '../audio_files/wburgShort.wav' if not os.path.exists(inputfile): raise Exception("FILE DOES NOT EXIST, TRY AGAIN") [x, fs] = M.wavread(inputfile) # FFT Parameters N = 2048 hopDenom = 2 zp = 0 winfunc=np.hamming fftParams = fftparams.FFTParams(fs, N, hopDenom, zp, winfunc) #peaks = z.envelopeFollowEnergy(winLen,hopSize) # the old way z = ed.onsetDetect(fftParams) events = z.findEventLocations(x) xConcat = x[(events)]
from numpy import * from matplotlib.pyplot import * import marlib.matlab as M import scipy as sp import math import mirlib.FFTParams as fftparams import mirlib.feature_extraction.calcLoudness as cl [x,fs] = M.wavread('../audio_files/WB_12-15_342pm10mins.wav') winLen = 4096*8 hopSize = winLen # FFT Parameters N = 4096*8 hopDenom = 1. hopSize = N/float(hopDenom) zp = 0 winfunc=np.hamming fftParams = fftparams.FFTParams(fs, N, hopDenom, zp, winfunc) #[x,fs] = M.wavread('RZABR40.wav') #[x,fs] = M.wavread('RZABR40pad.wav') z = cl.SoneCalculator(x, fftParams) sonVec = z.calcSoneLoudness() close()
import os import numpy as np import marlib.matlab as M import mirlib.feature_extraction.eventDetect as ed import mirlib.FFTParams as fftparams from matplotlib.pylab import * #inputfile = '../audio_files/GV02_A_Format4min.wav' inputfile = '../audio_files/wburgShort.wav' if not os.path.exists(inputfile): raise Exception("FILE DOES NOT EXIST, TRY AGAIN") [x, fs] = M.wavread(inputfile) # FFT Parameters N = 2048 hopDenom = 2 zp = 0 winfunc = np.hamming fftParams = fftparams.FFTParams(fs, N, hopDenom, zp, winfunc) #peaks = z.envelopeFollowEnergy(winLen,hopSize) # the old way z = ed.onsetDetect(fftParams) events = z.findEventLocations(x) xConcat = x[(events)] M.wavwrite(xConcat, "segs.wav", fs)
from numpy import * from matplotlib.pyplot import * import marlib.matlab as M import scipy as sp import math import mirlib.FFTParams as fftparams import mirlib.feature_extraction.calcLoudness as cl [x, fs] = M.wavread('../audio_files/WB_12-15_342pm10mins.wav') winLen = 4096 * 8 hopSize = winLen # FFT Parameters N = 4096 * 8 hopDenom = 1. hopSize = N / float(hopDenom) zp = 0 winfunc = np.hamming fftParams = fftparams.FFTParams(fs, N, hopDenom, zp, winfunc) #[x,fs] = M.wavread('RZABR40.wav') #[x,fs] = M.wavread('RZABR40pad.wav') z = cl.SoneCalculator(x, fftParams) sonVec = z.calcSoneLoudness() close() fig = figure() ax1 = fig.add_subplot(111) signalTime = arange(z.y.size)