TimeLineAnnotator / desktop

A GUI for graphical analysis and annotation of video and audio files.
https://tilia-app.com
Creative Commons Attribution Share Alike 4.0 International
10 stars 3 forks source link

Add audio wave graph to slider timelines #77

Closed FelipeDefensor closed 7 months ago

FelipeDefensor commented 1 year ago

Lenz, I was able to fix the zoom rounding. We need to keep the floats stored in self.timeline_width fro the operations to act like inverses and only convert with int() when using the values. I generated some graphs of different lengths to check if the sizes were correct. The generation is taking a long time, though, probably because the audio is being processed anew every time.

FelipeDefensor commented 1 year ago

I commited the changes to LenzDev.

FelipeDefensor commented 1 year ago

@LenzGit, what I found out is that the matplotlib FigureCanvasTkAgg contains a tkinter.Canvas, which can be accessed via the get_tk_widget() method, so it should not be inserted into an already existing canvas. That raises two issues: (1) a TimelineCanvas instance ais created for each timeline, and there is no convenient way to substitute its creation for the creation of the FigureCanvasTkAgg canvas; (2) I haven't been able to control the margin on that canvas, and that is necessary to make it align with other timelines.

More importantly, there is a noticeable delay whenever the canvas is resized (as when zooming) so the figure is almost certainly being regenerated. Delay when zooming is already an issue, so I would not like to add the extra overhead to the process.

At this point, I think we are better off sticking with the old plan of pre-generating the images. I'm gonna give it a shot to see how long it takes.

FelipeDefensor commented 1 year ago

Note to self - this might be useful: https://www.youtube.com/watch?v=RHmTgapLu4s

It uses pyqtgraph, which appears to be more optimized, instead of matplotlib.