title: Function to play two sounds at the same time (C)
body: <pre><code>void layer1and2 (NoteData input)
  {
      while(!feof(textFilePointer2))
      {
  
          float frequency[2];
          float amplitude[2];
  
          amplitude[0] = input.velocity/127.0;
          amplitude[1] = input.velocity/127.0;
  
          frequency[0] = 440 * pow(2, (input.notes-69) /12.0);
          fscanf(textFilePointer, " %d %d\n", &amp;input.notes, &amp;input.velocity);
          frequency[1] = 440 * pow(2, (input.notes-69) /12.0);
          fscanf(textFilePointer2, " %d %d\n", &amp;input.notes, &amp;input.velocity);
          printf(" %d %d\n\n", input.notes, input.velocity);
          aserveOscillator(1, frequency[0], amplitude[0], 0);
          aserveOscillator(0, frequency[1], amplitude[1], 2);
          aserveSleep(500);
          aserveOscillator(1, 0, 0, 0);
          aserveOscillator(0, 0, 0, 0);
  
  
      }
  
  }
  </code></pre>
  
  <p>Hi, I'm new to programming so please go easy on me.
  This part of my program is a function to playback two sequences at the same time using different oscillators. I'm not sure that I'm going the right way about it? 
  At the moment the note information is gathered from 'textFilePointer2', but I need to get note data from 'textFilePointer &amp; textFilePointer2' at the same time!
  Any help would be much appreciated, thanks in advance. </p>