import numpy as np from scipy import signal import matplotlib.pyplot as plt import os # importing local packages import preprocessing as pp # reading all the audio data into a dictionary audioPath = os.path.join(os.getcwd(), "..", "..", "rawAudio") filenames, audioDict = pp.readWAV(audioPath) filenames, audioDict = pp.readWAV(audioPath) # extracting the filenames of interest keys = pp.getKeys(filenames, (["B1"], None, ["15"])) # subsetting the data subset = pp.loadSubset(audioDict, keys) # Note: for now we design sync_envelope to work with two signals # However, there may be several time processing steps which could be applied to all of the signals at the same time: instead of two by two. # it is possible that even the cross-correlation can be spead up by doing it in ND # add test using a specific sine wave or something # add test for shifting the same signal # we assume the signals are 1D signal1 = subset.values()[0][:, 0] signal2 = subset.values()[1][:, 0]
# TEST THE FUNCTIONS import preprocessing as pp rawDataPath = os.path.join("..","rawData"); # directory where the audio fles reside files = glob.glob(os.path.join(rawDataPath,"*.wav")) names = []; for name in files: fileName = os.path.basename(name).split(".")[0] names.append(fileName) filt = (None,None,['17']) # audioFiles = pp.getKeys(names,filt); (names,cDataset) = pp.readWAV(rawDataPath,audioFiles); # opens files and writes to a dictionary #cDataset = loadSubset(data,audioFiles); plt.figure(figsize=(50,20)) for ii in range(len(cDataset)): plt.subplot(len(cDataset)/2,2,ii+1) (Pxx,freqs,bins,im) = plt.specgram(cDataset[audioFiles[ii]][:,0],NFFT=2048,Fs=48000,noverlap=900,cmap=plt.cm.gist_heat) #plt.plot(cDataset[audioFiles[ii]][:,0]-cDataset[audioFiles[ii]][:,1],'b') #plt.ylim([3000,3800]) plt.draw()
import numpy as np from scipy import signal import matplotlib.pyplot as plt import os # importing local packages import preprocessing as pp # reading all the audio data into a dictionary audioPath = os.path.join(os.getcwd(), '..', '..', 'rawAudio') filenames, audioDict = pp.readWAV(audioPath) filenames, audioDict = pp.readWAV(audioPath) # extracting the filenames of interest keys = pp.getKeys(filenames, (['B1'], None, ['15'])) # subsetting the data subset = pp.loadSubset(audioDict, keys) # Note: for now we design sync_envelope to work with two signals # However, there may be several time processing steps which could be applied to all of the signals at the same time: instead of two by two. # it is possible that even the cross-correlation can be spead up by doing it in ND # add test using a specific sine wave or something # add test for shifting the same signal # we assume the signals are 1D signal1 = subset.values()[0][:, 0] signal2 = subset.values()[1][:, 0]