[cairo] Drawing a sound wave

Gerdus van Zyl gerdusvanzyl at gmail.com
Tue Nov 4 09:57:24 PST 2008


You could move the graph along by copying the existing image to a
temporary surface, clear the primary surface and draw the old image
using cairo_set_source_surface with an x-offset. Then you can draw the
new data into the space created. Depends on your algorithm. Also
depending on your update rate, algorithm and other factors cairo might
indeed be fast enough to draw the graph without tricks, test it and
see.

~Gerdus van Zyl

On Tue, Nov 4, 2008 at 3:29 PM, Joseph Bain <mrjoebain at gmail.com> wrote:
> Hi,
>
> I want to use Cairo to draw a live sound wave. I'm writing some
> beat/tempo detection software and want to include a graph of the sound
> wave as a visual representation of the process. The drawing should show
> the last 10 seconds of sound and it is real time so there is no
> opportunity to process the whole thing first. As the graph is constantly
> updating (I found 10 times a second reasonable) it's not really
> practical to redraw the new graph every time. I'm not very experienced
> with Cairo and I would appreciate any thoughts on how best to do this.
>
> Regards,
>
> Joe
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list