0

I am looking to create a visual effect in python which will relate the output of an audio file (WAV) to the size of an object, similar to how many chat platforms will show a ring around a profile pic of the person you are chatting with which will fluctuate when they talk or are silent.

Currently i am using moviepy to do video editing, and would prefer to do as much through this library as possible unless there is an obviously better option elsewhere. I can obtain the array of output magnitude of the sound wave and sample rate by using scipy.io and the following code:

from scipy.io import wavfile

output = wavfile.read("audiofile.wav")
samplerate = output[0]
output_array = output[1]

I understand i need to implement the output array to a function of time which relates to the size of a certain object at the specified time of the function. I could create a separate video clip of just this object and use the CompositeVideoClip class to append my background video and this fluctuating object together. I have to be weary of the relation of the fpos(60) in relation to the sample rate of initial audio(24000).

I have read into the documentation of moviepy in terms of creating lambda functions that relate time to certain events occurring, and maybe i am just dense but i am completely lost when attempting to navigate into this territory myself. https://zulko.github.io/moviepy/examples/the_end.html

Working on macOS, python3.10.

ANY pointers to move forward would be appreciated.

0 Answers0