示例#1
0
文件: app.py 项目: csukuangfj/Project
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
示例#2
0
文件: vem_server.py 项目: graemen/vox
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)
示例#3
0
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
示例#4
0
def test(audio_1, audio_2):
    seqx = get_seq(audio_1)
    seqy = get_seq(audio_2)
    return dynamic.dynamicTimeWarp(seqx,seqy)