Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds
audio_async_render
. It works the same way asclip_aync_render
, requesting frames asynchronously usingget_frame_async
.I had to modify a part of the code to make it work like renaming RenderContext and finish_frame.
I tried to add a lot of comments to better understand the code since I had to document myself to write the function.
I think adding the URLs I used in the code wouldn't be best idea so here are them:
https://web.archive.org/web/20051028052230/http://media.vcs.de/Downloads/Sony_Wave64.pdf
https://github.com/vapoursynth/vapoursynth/blob/master/src/common/wave.cpp
https://github.com/xiph/flac/blob/27c615706cedd252a206dd77e3910dfa395dcc49/src/flac/encode.c
https://github.com/tpn/winsdk-10/blob/master/Include/10.0.14393.0/shared/mmreg.h#L2107
https://docs.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible
scipy/scipy#6852
https://gist.github.com/josephernest/3f22c5ed5dabf1815f16efa8fa53d476
https://stackoverflow.com/questions/31739143/when-to-use-wave-extensible-format
Why in lvsfunc?
Well there is already clip_async_render and there is relatively duplicated code. I didn't change anything inside
clip_aync_render
but changes could be made now that audio is a thing in Vapoursynth.Why numpy?
A vapoursynth.RawFrame is a Sequence like of memoryviews. We need to stack them to perform computations. I don't know if a solution without numpy exists but it would probably be slower.
Numpy is used quite enough in python environment and some vapoursynth *funcs need it. Plus it's a pretty solid package highly maintained.
Performance
I still need to do proper performance comparisons but it's ~40 % slower than vspipe. Makes sense since it's done in python and not in C.
24:28 minutes 24 bit wave file:
audio_async_render
Duration: 16.13 secondsvspipe
Duration 11.20 seconds