def authorization(): audio_data_base64 = request.form.get("audio", "not found") with open('test.raw', 'wb+') as f: f.write(audio_data_base64) # Strip out header crap until the comma audio_data_base64 = audio_data_base64[audio_data_base64.index(',')+1:] audio_data = base64.b64decode(audio_data_base64) with open('test.wav', 'wb+') as f: f.write(audio_data) seqx = analysis_2.master(os.path.abspath("audios/open_pod.wav")) seqy = analysis_2.master('test.wav') cost = dynamic.dynamicTimeWarp(seqx, seqy) match = dynamic.match_test(cost) if match: return "match" else: return "nope %r" % cost
def internal_auth_handler(unused_addr, args, filename): # pyvox internal API comparison template = "/home/graeme/Research/voxexmachina/sc/never.wav" seqx = analysis_2.master(template) seqy = analysis_2.master(filename) cost = dynamic.dynamicTimeWarp(seqx, seqy) match = dynamic.match_test(cost) fileinfo = os.path.split(filename) if match: vox_msg = "".join(["int> SUC ", fileinfo[1], " ", str(cost)]) else: vox_msg = "".join(["int> ", fileinfo[1], " Failed ", str(cost)]) msg = osc_message_builder.OscMessageBuilder(address = '/vox/server') msg.add_arg(vox_msg) msg = msg.build() vox_udp.send(msg)
def authorization(): audio_data_base64 = request.form.get("audio", "not found") with open('test.raw', 'wb+') as f: f.write(audio_data_base64) # Strip out header crap until the comma audio_data_base64 = audio_data_base64[audio_data_base64.index(',') + 1:] audio_data = base64.b64decode(audio_data_base64) with open('test.wav', 'wb+') as f: f.write(audio_data) seqx = analysis_2.master(os.path.abspath("audios/open_pod.wav")) seqy = analysis_2.master('test.wav') cost = dynamic.dynamicTimeWarp(seqx, seqy) match = dynamic.match_test(cost) if match: return "match" else: return "nope %r" % cost
def get_seq(audio): return analysis_2.master(os.path.abspath(audio))