We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Performance tips: Image / Audio visualization
Page Index Toggle Pages: 1
Performance tips: Image / Audio visualization (Read 1643 times)
Performance tips: Image / Audio visualization
Oct 22nd, 2009, 3:06pm
 
Hey everyone

I'd like to get some tips on a project I'm just starting. This is basically what I want:

I have 2 images. The first image is the New York City skyline at night, and the second image is the exactly same skyline where I removed all the lights in the windows in Photoshop.

I want to use the BeatDetect library and map different frequencies to different areas of the original image. So when I'm playing a song, the kick drum will control the lights in one building, the snare another and the claps a third.

To do this I need to be able to overlay the 2 images, and remove parts of the "no lights" image, so the original image appears.

My problem:

I need the fastest way to apply multiple masks on a single image. I need to be able to specify the masks either as shapes or by using PNGs for each building... but I tested the PNGs and it's really slow.

How can I do this so I can actually show the visualization real-time?

Thanks..
Re: Performance tips: Image / Audio visualization
Reply #1 - Oct 22nd, 2009, 11:30pm
 
If I understand correctly, you only have about 8 possible combinations of bass, snare and claps. So, maybe just make 8 images, load them at setup time and display the one which applies.
Re: Performance tips: Image / Audio visualization
Reply #2 - Oct 23rd, 2009, 12:37am
 
Maybe its better to load 2 fill images and use
http://processing.org/reference/set_.html
to replace different areas of the image...  just an idea
Re: Performance tips: Image / Audio visualization
Reply #3 - Oct 23rd, 2009, 12:41am
 
i like the idea btw., do you know this work : http://minivegas.co.uk/#/work/live-action/99/
impressive one.
Re: Performance tips: Image / Audio visualization
Reply #4 - Oct 23rd, 2009, 2:33pm
 
Okay, so I ended up using 2 images, and then masking the top image with a PGraphics object. Each draw loop I update the PGraphics with shapes depending on beats in the song.
Re: Performance tips: Image / Audio visualization
Reply #5 - Oct 23rd, 2009, 2:33pm
 
Check it out here:
http://runemadsen.com/itp/sourcecodes/citylights/

It may take a while to load but I really like it...
Re: Performance tips: Image / Audio visualization
Reply #6 - Oct 23rd, 2009, 2:57pm
 
turned out really nice!
Page Index Toggle Pages: 1