Exemple #1
0
 public void work() {
   /**
    * Structure is: "RIFF" file_length "WAVE" "fmt " chunk_length compression channels sample_rate
    * data_rate bytes_per_frame bits_per_sample "data" length
    */
   pass();
   pass(); // "RIFF"
   int file_length = nextInt();
   // file_length is data chunk + 36 bytes of header info
   file_length = (int) Math.round((file_length - 36) * speed) + 36;
   sendInt(file_length);
   pass();
   pass(); // "WAVE"
   pass();
   pass(); // "fmt "
   pass();
   pass(); // fmt chunk_length; must be 16
   pass(); // compression; must be 1
   pass(); // channels; for now, assuming 2 channels
   pass();
   pass(); // sample_rate; don't care about it
   pass();
   pass(); // data_rate; should be same
   pass();
   pass(); // same bytes_per_frame and bits_per_sample (16)
   pass();
   pass(); // "data"
   int samples = nextInt();
   samples = (int) Math.round(samples * speed);
   sendInt(samples);
 }
Exemple #2
0
 public void work() {
   output.pushFloat((float) Math.sin(theta * input.popFloat()));
 }
Exemple #3
0
 public void work() {
   prev = prev + theta;
   output.pushFloat((float) Math.sin(prev));
 }