Help - push an array into array simple question

Is it your intent to push a reference or a copy here?:

      sampleBuffer.push(bandsEnergy);

The above will push a reference to bandsEnergy onto sampleBuffer.

For a copy of it instead, there are various possible solutions. One of them is to do this:

      sampleBuffer.push(bandsEnergy.slice(0, 3));

Try that, then check the contents of sampleBuffer.

1 Like