ls /home/andres/Documents/src/marsyas/build/bin import sys sys.path.append('/home/andres/Documents/src/marsyas/build/bin') !onsets -h !onsets 'sources/Dire Straits - Walk of life.wav' > wof_onsets.txt f = open('wof_onsets.txt') lines = f.readlines() print lines[:5] print lines[-5:] onsets = [float(val) for val in lines[3:-1]] onsets[0], onsets[-1] plot(diff(onsets)) plot(diff(onsets)[:-1]) plot(diff(onsets)[:-1]) hlines(diff(onsets)[:-1].mean(), 300, 500) hlines(diff(onsets)[:-1].mean()* 2, 300, 500) hlines(diff(onsets)[:-1].mean()/ 2, 300, 500) xlim(300, 500) !mkcollection -c sources.mf -l sources "/home/andres/Documents/01 Documentos/06 Santa Barbara/Lectures/240E/ipython/sources/" !bextract -h !bextract -fe -mfcc -w mfcc.arff sources.mf ls import arff mfccs = arff.load('MARSYAS_EMPTYmfcc.arff') mfccs mfccs = list(mfccs) len(mfccs) mfccs[0] mfccs = [] for row in arff.load('MARSYAS_EMPTYmfcc.arff'): mfccs.append(list(row)[1:14]) imshow(array(mfccs).T, aspect='auto', interpolation='nearest') !bextract sources.mf -w ms.arff -p ms.mpl -cl GS ls !sfplugin -h !sfplugin -pl ms.mpl sources/superstition.wav !mkcollection -c sources2.mf -l sources2 "/home/andres/Documents/01 Documentos/06 Santa Barbara/Lectures/240E/ipython/sources2/" !bextract sources.mf sources2.mf -p ms.mpl -cl GS !sfplugin -pl ms.mpl sources2/turangalila_excerpt.wav !sfplugin -pl ms.mpl sources/passport.wav import marsyas mng = marsyas.MarSystemManager() fnet = mng.create("Series", "featureNetwork") # functional short cuts to speed up typing create = mng.create add = fnet.addMarSystem link = fnet.linkControl upd = fnet.updControl get = fnet.getControl # Add the MarSystems add(create("SoundFileSource", "src")) add(create("TimbreFeatures", "featExtractor")) add(create("TextureStats", "tStats")) add(create("Annotator", "annotator")) add(create("WekaSink", "wsink")) # link the controls to coordinate things link("mrs_string/filename", "SoundFileSource/src/mrs_string/filename") link("mrs_bool/hasData", "SoundFileSource/src/mrs_bool/hasData") link("WekaSink/wsink/mrs_string/currentlyPlaying","SoundFileSource/src/mrs_string/currentlyPlaying") link("Annotator/annotator/mrs_natural/label", "SoundFileSource/src/mrs_natural/currentLabel") link("SoundFileSource/src/mrs_natural/nLabels", "WekaSink/wsink/mrs_natural/nLabels") # update controls to setup things upd("TimbreFeatures/featExtractor/mrs_string/disableTDChild", marsyas.MarControlPtr.from_string("all")) upd("TimbreFeatures/featExtractor/mrs_string/disableLPCChild", marsyas.MarControlPtr.from_string("all")) upd("TimbreFeatures/featExtractor/mrs_string/disableSPChild", marsyas.MarControlPtr.from_string("all")) upd("TimbreFeatures/featExtractor/mrs_string/enableSPChild", marsyas.MarControlPtr.from_string("MFCC/mfcc")) upd("mrs_string/filename", marsyas.MarControlPtr.from_string("sources.mf")) upd("WekaSink/wsink/mrs_string/labelNames", get("SoundFileSource/src/mrs_string/labelNames")) upd("WekaSink/wsink/mrs_string/filename", marsyas.MarControlPtr.from_string("mfcc_python.arff")) # do the processing extracting MFCC features and writing to weka file previouslyPlaying = "" while get("SoundFileSource/src/mrs_bool/hasData").to_bool(): currentlyPlaying = get("SoundFileSource/src/mrs_string/currentlyPlaying").to_string() if (currentlyPlaying != previouslyPlaying): print "Processing: " + get("SoundFileSource/src/mrs_string/currentlyPlaying").to_string() fnet.tick() previouslyPlaying = currentlyPlaying mfccs = [] for row in arff.load('mfcc_python.arff'): mfccs.append(list(row)[1:14]) imshow(array(mfccs).T, interpolation='nearest', aspect='auto') colorbar()