Hi !
I’ve been playing around with the Sound library for a bit to make a simple music visualizer, but I can’t seem to get the amp values for specific points in the music to make a nice timeline.
Here’s how I defined all the stuff I believe to be necessary for this:
SoundFile music;
Amplitude amp;
float[] ampValues;
void setup()
{
size(512, 512);
music = new SoundFile(this, "gohma-forward.mp3");
amp = new Amplitude(this);
ampValues = new float[width];
setAmpValues();
music.play();
}
And here’s the setAmpValues() function supposed to put all the amp values taken at regular intervals into the ampValues[] array which doesn’t seem to work:
P.S: does anyone know why processing is kinda weird with how it handles code highlighting ? In music.play() the play() isn’t highlighted, but in music.stop() the stop() is highlighted…
-a- the editor can highlight lots of words from the basic processing language,
and add also some JAVA defaults.
-b- and sometimes there is a bug because one is forgotten…
but what you talk here is the highlighting of methods of a external library…
no, as far i know there is no way that a added library can modify the
highlighting of the editor ( load add words to the word list / even make it depending on if a external lib is imported … )
so if that is not the case, what is it here?
stop() is a known method of a other tool or JAVA
( i think here the internal serial library ( also clear() works ))
processing-3.5.3\modes\java\keywords.txt line 288
play() is no known default command.
so when you make libraries or just own classes
you write methods ( functions ) for it,
and there might be a naming convention?? Java Naming Conventions - HowToDoInJava ?not too detailed?
so you can avoid or choose known words…
in a class
MyCircle{} you can make a void draw(){}
function. ( and it will be BLUE when you call onecircle.draw(); )
if you choose to call that void show(){}
( onecircle.show(); it will be black )
besides that sound lib is not loaded by default ( i call it external ),
but when it is loaded ( by contribution manager )
it appears in the internal libraries list. also confusing.