-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio integration to front end #360
Audio integration to front end #360
Conversation
nickyfantasy
commented
Apr 4, 2018
- Add flask end point
- Read and decode audio data
* Add flask end point * Read and decode audio data
res = re.search(r".*/([0-9]+$)", tag) | ||
sample_index = 0 | ||
origin_tag = tag | ||
if res: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the regex search failed? Should we add an 'else' to deal with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case we just use default sample_index = 0
def get_individual_audio(storage, mode, tag, step_index, max_size=80): | ||
|
||
with storage.mode(mode) as reader: | ||
res = re.search(r".*/([0-9]+$)", tag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can abstract this " removing '/x' " logic into a method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
|
||
data = np.array(record.data(), dtype='uint8') | ||
|
||
tempfile = NamedTemporaryFile(mode='w+b', suffix='.wav') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know this method from tempfile 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@app.route('/data/plugin/audio/individualAudio') | ||
def individual_audio(): | ||
mode = request.args.get('run') | ||
print mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove test print