SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Michael M. <mic...@gm...> - 2014年04月19日 04:56:45
I'm creating a simple little sound file editor, which includes the ability
to play a sound file as a vertical line (a "cursor") moves across the plot
of the waveform in sync with the sound. So the trick is, how to create this
moving line. First I tried FuncAnimation, but I had problems with the
synchronization with the sound. I'm guessing that the animation
capabilities of matplotlib weren't really designed to be synchronized with
outside activities. So then I tried using QTimer's and modifying the Line2D
instance that is the vertical bar. This didn't work unless I called draw()
on the figure canvas every time I modified the Line2D, which caused
slowdown (probably because my audio data consists of 1000's of points).
So is there a way to animate a vertical line moving across the plot with
good control over exact timing, in the presence of other plots with
thousands of points?
Mike
From: Raymond S. <sm...@mi...> - 2014年04月19日 22:52:36
Hi Mike,
Have you tried blitting? That prevents the draw from redrawing everything
on the plot, allowing it to only redraw the single line that's moving,
which should help any issues with speed. See some of the
examples<http://matplotlib.org/examples/animation/index.html>with
FuncAnimation and also a Q&A using the draw method
here<https://stackoverflow.com/questions/8955869/why-is-plotting-with-matplotlib-so-slow/8956211#8956211>,
which might work more smoothly with QTimer.
Ray
On Sat, Apr 19, 2014 at 12:56 AM, Michael Mossey <mic...@gm...>wrote:
> I'm creating a simple little sound file editor, which includes the ability
> to play a sound file as a vertical line (a "cursor") moves across the plot
> of the waveform in sync with the sound. So the trick is, how to create this
> moving line. First I tried FuncAnimation, but I had problems with the
> synchronization with the sound. I'm guessing that the animation
> capabilities of matplotlib weren't really designed to be synchronized with
> outside activities. So then I tried using QTimer's and modifying the Line2D
> instance that is the vertical bar. This didn't work unless I called draw()
> on the figure canvas every time I modified the Line2D, which caused
> slowdown (probably because my audio data consists of 1000's of points).
>
> So is there a way to animate a vertical line moving across the plot with
> good control over exact timing, in the presence of other plots with
> thousands of points?
>
> Mike
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Michael M. <mic...@gm...> - 2014年04月20日 00:08:01
On 4/19/2014 3:51 PM, Raymond Smith wrote:
> Hi Mike,
>
> Have you tried blitting? That prevents the draw from redrawing 
> everything on the plot, allowing it to only redraw the single line 
> that's moving, which should help any issues with speed. See some of 
> the examples <http://matplotlib.org/examples/animation/index.html> 
> with FuncAnimation and also a Q&A using the draw method here 
> <https://stackoverflow.com/questions/8955869/why-is-plotting-with-matplotlib-so-slow/8956211#8956211>, 
> which might work more smoothly with QTimer.
>
> Ray
>
Thanks, I'll check it out. Note that I did get FuncAnimation to work 
perfectly well except I have little control over the timing so I had a 
hard time synchronizing it with the sound. The FuncAnimation example I 
looked at wasn't very helpful if the question is how to blit or other 
details, because that's all going on behind the scenes. I will study the 
Stack Overflow Q&A and see if there is something I can directly use.
Mike
From: esr <en...@bl...> - 2014年07月26日 11:51:09
Hi Mike,
I have the same problem and I am interested how dou you solve it.
Regards 
Enzo
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/moving-line-tp43249p43686.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /