Storing data into an array (processing.sound)

Sorry for not quite getting the output you are after but I was trying to understand if the issue was solely with your array or the way you were trying to draw the data or both. I would also suggest using an ArrayList for storing data. This is very similar to the List mentioned by @GoToLoop just initialized a bit different. You can find documentation in the Processing Reference:

If you really want to only display your curve after all of the data has been collected you can use the sample.isPlaying() method to wrap your code that displays an output. This will delay the drawing until all the sound file data has been collected.

Finally, something I find useful when collecting sound data and trying to use it throughout my code is the map function in processing. I saw you were using some scaling to adjust the amplitude values. You can also do this by mapping a value from one range to another. This is especially useful with .analyze() since you know it will return a value between 0 and 1.

I hope that is useful. Please post if the ArrayList was helpful or if you have any other questions.