XIII
YaBB Newbies
Offline
Posts: 10
Re: Sonia in new version (0.85 Beta)
Reply #5 - Apr 20th , 2005, 1:08pm
I tried out this example (from the archives of Sonia): import pitaru.sonia_v2_9.*; void setup(){ size(512,200); Sonia.start(this); // Start Sonia engine. LiveInput.start(256); // Start LiveInput and return 256 FFT frequency bands. } void loop(){ background(0,30,0); getMeterLevel(); // Show meter-level reading for Left/Right channels. getSpectrum(); // Show FFT reading } void getSpectrum(){ strokeWeight(0); stroke(0,230,0); // populate the spectrum array with FFT values. LiveInput.getSpectrum(); // draw a bar for each of the elements in the spectrum array. // Note - the current FFT math is done in Java and is very raw. expect optimized alternative soon. for ( int i = 0; i < LiveInput.spectrum.length; i++){ line(i*2, height, i*2, height - LiveInput.spectrum[i]/10); } } void getMeterLevel(){ // get Peak level for each channel (0 -> Left , 1 -> Right) // Value Range: float from 0.0 to 1.0 // Note: use inputMeter.getLevel() to combine both channels (L+R) into one value. float meterDataLeft = LiveInput.getLevel(Sonia.LEFT); float meterDataRight = LiveInput.getLevel(Sonia.RIGHT); // draw a volume-meter for each channel. strokeWeight(100); stroke(0,100,0); float left = meterDataLeft*height; float right = meterDataRight*height; line(width/2 - 120, height, width/2 - 120 , height - left); line(width/2 + 120, height, width/2 + 120, height - right); } // Safely close the sound engine upon Browser shutdown. public void stop(){ Sonia.stop(); super.stop(); } ____________________________________________________ And get these errors when I try to run it: C:/Documents and Settings/rc01200/Application Data/Processing/build/Temporary_187_6044.java:32:51:32:54: Semantic Error: The field "LEFT" in type "pitaru.sonia_v2_9.Sonia" has default access and is not accessible here. C:/Documents and Settings/rc01200/Application Data/Processing/build/Temporary_187_6044.java:33:52:33:56: Semantic Error: The field "RIGHT" in type "pitaru.sonia_v2_9.Sonia" has default access and is not accessible here. Grz, Kris.