Sonia getVolume () query
in
Contributed Library Questions
•
1 year ago
I am trying to modify a live input example so that volume of mySample is used to fill the rectangle. It doesn't seem to work though; does anyone know if the getVolume() is able to be used as i'm wanting? (have checked reference..)
- import pitaru.sonia_v2_9.*;
- Sample mySample;
- void setup() {
- size(400, 400);
- Sonia.start(this);
- mySample = new Sample("kruder.aif");
- background(255);
- }
- void draw() {
- strokeWeight(1);
- float vol = mySample.getVolume();
- fill(0);
- rect(0, 0, 20, height);
- fill(175);
- rect(0, height-vol*height, 20, vol*height);
- println("the sample's volume is:" + vol);
- }
- void mousePressed() {
- mySample.play();
- }
- void mouseReleased() {
- mySample.stop(1);
- }
- public void stop() {
- Sonia.stop();
- super.stop();
- }
1