I would like to realize this.
I have this problem and it takes me 2 days for finding the solution :)) . In flask server you can use request.files['audio_data']
to get wav audio file. You can pass and use it as an audio variable too. Hope this can help you
For those who are still unable to figure it out after this. Just change the
main.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask import request
from flask import render_template
import os
app = Flask(__name__)
@app.route("/", methods=['POST', 'GET'])
def index():
if request.method == "POST":
f = request.files['audio_data']
with open('audio.wav', 'wb') as audio:
f.save(audio)
print('file uploaded successfully')
return render_template('index.html', request="POST")
else:
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
Note:
Using ":" in the filename confuses ffmpeg/ffprobe (and it does not matter whether you use "" or ' to surround the file name, and backslash escaping does not work for ":"). The only possible solution is to [temporarily] remove ":" from the filename.