Check out example codes for "processing sound library". It will help you in understanding the concepts better.

Code Example 1

import processing.sound.*;

SoundFile sound;

void setup()
{
  sound = new SoundFile(this, "sound.wav"); //add audio files
}

void draw()
{
  if(playSound)
  {
    sound.Play(); //play audio
  }
}

Learn ReactJs, React Native from akashmittal.com