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 & HelpSound,  Music Libraries › Simply repositioning a waveform
Page Index Toggle Pages: 1
Simply repositioning a waveform (Read 1928 times)
Simply repositioning a waveform
Jun 5th, 2010, 6:08am
I am trying to move the waveform to another location on screen. It seems simple however i've tried and failed. Please help me  Embarrassed

void draw()
 // draw the waveforms
 // the values returned by left.get() and right.get() will be between -1 and 1,
 // so we need to scale them up to see the waveform
 // note that if the file is MONO, left.get() and right.get() will return the same value
 for(int i = 0; i < bgmusic.left.size()-1; i++)
  line(i, 50+ bgmusic.left.get(i)*50, i+1, 50 + bgmusic.left.get(i+1)*50);
   line(i, 150 + bgmusic.right.get(i)*50, i+1, 150 + bgmusic.right.get(i+1)*50);
Re: Simply repositioning a waveform
Reply #1 - Jun 5th, 2010, 6:38am
you can use translate
http://processing.org/reference/translate_.html to move it arround. be sure to use pushMatrix() and popMatrix() if you draw other stuff that shouldnt be translated
Re: Simply repositioning a waveform
Reply #2 - Jun 5th, 2010, 6:55am
Thank you Cedric, i'll try that Smiley
Page Index Toggle Pages: 1