I am trying to inset a table and use the data to adjust the volume in gains
But I don’t know how to do it since they are in different methods but if i put them together, there will be an error
also, i’m using the library, beads
import beads.*;
import java.util.Arrays;
Table windDirection;
Table windSpeed;
int index = 0;
float y;
float speed_y;
int speedIndex = 0;
AudioContext ac;
void setup(){
size(800, 800);
smooth();
windSpeed = loadTable(“https://eif-research.feit.uts.edu.au/api/csv/?rFromDate=2020-09-19T17%3A33%3A38&rToDate=2020-09-21T17%3A33%3A38&rFamily=weather&rSensor=IWS”, “csv”);
ac = new AudioContext();
selectInput(“Select an audio file:”, “fileSelected”);
frameRate(5);
}
//===========================================================================================================================
void getSpeedData() {
if (speedIndex < windSpeed.getRowCount()) {
// read the 2nd column (the 1), and read the row based on index which increments each draw()
speed_y = windSpeed.getInt(speedIndex, 1); // index is the row, 1 is the column with the data.
speedIndex++;
}
else {
speedIndex = 0;
}
}
//wind sound setting
void fileSelected(File selection) {
//Choose audio file
String audioFileName = selection.getAbsolutePath();
//Creates a sample player and loads in the Sample.
SamplePlayer player = new SamplePlayer(ac, SampleManager.sample(audioFileName));
//Modify the gain of a multi-channel audio signal
//Parameters: AudioContext, #inputs = #outputs, gain level( 0: silence)
Gain g = new Gain(ac, 2, );
g.addInput(player);
ac.out.addInput(g);
ac.start();
}
void draw(){
}