[cairo] Drawing a sound wave

Markus Schumann go4shoe at hotmail.com
Tue Nov 4 10:02:07 PST 2008


1.) Do you want to draw the sound wave from left to right or do you want to
draw on the left while scrolling to the right?

2.) Let's assume your sound is sampled with 48kHz and your screen is 1920
pixels wide. Now you want to display 10 seconds.
That means 480,000 samples divided by 1920 pixels which comes out to a time
scale of 250.
That means you'll need some sort of peak detection ... otherwise what would
you draw?


-----Original Message-----
From: cairo-bounces at cairographics.org
[mailto:cairo-bounces at cairographics.org] On Behalf Of Joseph Bain
Sent: Tuesday, November 04, 2008 07:29
To: cairo at cairographics.org
Subject: [cairo] Drawing a sound wave


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.



cairo mailing list
cairo at cairographics.org

More information about the cairo mailing list