You declare your array here
SoundSample[] ssarrFS = new SoundSample[(int)finalLen];
But then you never populate it's values, and you try to use it here:
ssarrFS[(int)((index1+(samples*(noteIndex))))].setValue(value1);
When you try to use it though, your array looks like this:
ssarrFS = [0] = null
[1] = null
[2] = null
...
[finalLen] = null
You attempt to call setValue
on an element inside of it. Because you've not populated ssarrFS
, this amounts to:
null.setValue(value1);
And because null
does not refer to an object in memory, this will throw your NullPointerException
.