Пример #1
0
def write_to_csv(location):

    print "omer"
    os.chdir(location)
    for file in glob.glob("*.wav"):
        print "omer"
        mfcc = MFCC.extract_mfcc(file)
        mfcc = np.hstack([np.ones((mfcc.shape[0], 1)), mfcc])

        print mfcc.shape
        with open("/home/omer/Desktop/Echo/Machine_Learning/Data_Gunshot.csv",
                  'a') as f_handle:
            np.savetxt(f_handle, mfcc, delimiter=",")
Пример #2
0
def write_to_csv(fold0, fold_n, location):
    count = 0
    for i in range(fold0, fold_n):
        path = location + st(
            i)  #"/home/Desktop/UrbanSound8K/UrbanSound8K/audio/fold"  +str(i)
        os.chdir(path)

        print path
        for file in glob.glob("*.wav"):
            if (file.split('-')[1] == '6'):
                mfcc = MFCC.extract_mfcc(file)
                mfcc = np.hstack([np.ones((mfcc.shape[0], 1)), mfcc])

                with open(
                        "/home/omer/Desktop/UrbanSound8K/UrbanSound8K/audio/Data_Gunskhdot.csv",
                        'a') as f_handle:
                    np.savetxt(f_handle, mfcc, delimiter=",")
Пример #3
0
	def test_mfcc(self):
		List=[[ -1.58999199e+02  , 8.34436590e+00,  -4.44382643e+01,  -1.05713490e+01,
   -4.14216808e+00  , 5.43735320e+00  ,-6.23641973e+00,   1.13643816e+01,
    1.11168843e+01   ,2.09593413e+01  , 2.08886976e+01 ,  1.78893376e+01,
   -1.85126261e+00   ,1.98630431e+00  ,-3.58780406e+00  , 1.07466142e+01,
    4.06712767e+00 , -3.77452706e+00  ,-9.57172794e+00   ,2.71010408e+00,
    2.28370949e-01  ,-1.67914367e+00  ,-2.70335598e+00   ,9.36659239e+00,
   -1.06643306e+00 , -4.19447993e+00  ,-1.55310523e+00   ,9.63509903e+00,
   -2.36770851e+00  , 1.16768921e+00   ,1.74342284e+00 , -6.92783306e-01,
   -2.74215299e+00  , 7.46808225e+00  ,-3.92998483e+00  ,-1.10826282e+00,
    2.49712828e+00,  -1.59097153e+00 , -5.17096235e+00  , 3.18161592e+00,
   -4.68084505e+00 ,  4.28643721e+00,  -3.98783991e-01  ,-4.31620744e+00,
    1.85530792e+00  , 1.94520311e+00  ,-3.32610635e+00  , 5.60897361e+00,
   -1.59248264e+00   ,3.31523211e+00  , 3.20098072e-01  , 3.58511203e-01,
    3.37264297e+00,  -1.70320401e+00 , -1.18435935e-01  , 1.40946029e+00,
   -4.82136239e+00 ,  3.66574126e+00,  -1.98897953e+00   ,1.42700455e+00]]
		self.assertListEqual(List,list( MFCC.extract_mfcc("/home/omer/Desktop/UrbanSound8K/UrbanSound8K/audio/fold1/7061-6-0-0.wav")))