Examples of Wave


Examples of edu.purdue.wind.Wave

  if (args.length != 2) {
      System.err.println("usage: WaveCrackDetector <file.wav> <probingFreq");
      System.exit(1);
  }

  Wave wave;
  try {
      wave = Wave.readFile(args[0]);
  } catch (IOException e) {
      throw new RuntimeException(e);
  }

  if (wave.channels() != 2) {
      System.err.println("Stereo input data required");
      System.exit(1);
  }

  int nSamples = 0;
  for (int i = 0; i < 32; i++) {
      if ((1 << i) > wave.samples()) {
    break;
      }
      nSamples = 1 << i;
  }

  double[][] data = new double[2][nSamples];
  for (short c = 0; c < 2; c++) {
      int[] samples = wave.sampleData(c);
      for (int i = 0; i < nSamples; i++) {
    data[c][i] = (double)samples[i];
      }
  }

  CrackDetector detector = new CrackDetector(wave.sampleRate(), nSamples);
  Turbine t = new Turbine();

  double probingFreq = Double.parseDouble(args[1]);
  detector.processAudio(t.blade(0), data[0], probingFreq);
  detector.processAudio(t.blade(1), data[1], probingFreq);
View Full Code Here

Examples of edu.purdue.wind.Wave

  if (args.length != 1) {
      System.err.println("usage: WaveParser <file.wav>");
      System.exit(1);
  }

  Wave wave;
  try {
      wave = Wave.readFile(args[0]);
  } catch (IOException e) {
      throw new RuntimeException(e);
  }

  System.out.println("Bits per sample:   " + wave.sampleBits());
  System.out.println("Sample rate (Hz):  " + wave.sampleRate());
  System.out.println("Channels:          " + wave.channels());
  System.out.println("Number of samples: " + wave.samples());
    }
View Full Code Here

Examples of edu.purdue.wind.Wave

  double duration = 30.0d;
  if (args.length == 3) {
      duration = Double.parseDouble(args[2]);
  }

  Wave wave = new Wave((short)1, SAMPLE_BITS, SAMPLE_RATE);
  int[][] samples = new int[1][(int)(SAMPLE_RATE * duration)];

  SineGenerator generator = new SineGenerator(SAMPLE_RATE,
                (int)SAMPLE_BITS,
                1, freq);
  generator.generate(samples);

  wave.setSampleData(samples);

  FileOutputStream fos = new FileOutputStream(file);
  wave.writeFile(fos);
  fos.close();
    }
View Full Code Here

Examples of edu.purdue.wind.Wave

  if (args.length != 1) {
      System.err.println("usage: PlotWave <file.wav>");
      System.exit(1);
  }

  Wave wave;
  try {
      wave = Wave.readFile(args[0]);
  } catch (IOException e) {
      throw new RuntimeException(e);
  }

  final int[] samples = wave.sampleData((short)0);
  final int nSamples = wave.samples();

  for (int i = 0; i < nSamples; i++) {
      System.out.println("" + i + " " + samples[i]);
  }
    }
View Full Code Here

Examples of edu.purdue.wind.Wave

    System.err.println("Invalid window function.  I know: hanning");
    System.exit(1);
      }
  }

  Wave wave;
  try {
      wave = Wave.readFile(args[0]);
  } catch (IOException e) {
      throw new RuntimeException(e);
  }

  short channel = Short.parseShort(args[1]);
  if (channel >= wave.channels()) {
      System.err.println("Cannot request channel not present in file");
      System.exit(1);
  }

  // Find the highest power of two smaller than wave.samples(),
  // the stupid way.  Assumes that there *are* samples.
  int bits = 0;
  for (bits = 0; bits < 32; bits++) {
      if (1 << (bits + 1) > wave.samples()) {
    break;
      }
  }

  int nSamples = 1 << bits;
  double[] samples = new double[nSamples];
  int data[] = wave.sampleData(channel);
  for (int i = 0; i < nSamples; i++) {
      samples[i] = (double)data[i];
  }

  FFT fft = new FFT(nSamples, window);
  fft.transform(samples);

  // Output the spectrum
  double[] magnitude = fft.magnitudes();
  final double stepHz = 2.0d * nSamples / (double)wave.sampleRate();

  for (int i = 0; i < nSamples / 2; i++) {
      System.out.println("" + (stepHz * i) + " " + magnitude[i]);
  }
    }
View Full Code Here

Examples of net.itscrafted.entity.Wave

  public static void createWave(double x, double y, int width) {
    createWave(x, y, width, Color.WHITE);
  }
 
  public static void createWave(double x, double y, int width, Color c) {
    particles.add(new Wave(x, y, width, c));
    checkLimit();
  }
View Full Code Here

Examples of net.itscrafted.entity.Wave

  public static void createSmallWave(double x, double y, int width) {
    createSmallWave(x, y, width, Color.WHITE);
  }
 
  public static void createSmallWave(double x, double y, int width, Color c) {
    Wave w = new Wave(x, y, width, c);
    w.setTickDelay(30);
    particles.add(w);
    checkLimit();
  }
View Full Code Here

Examples of org.jrebirth.af.core.wave.Wave

    public void runCommand(Class<? extends Command> commandClass) {

        wait = true;

        Wave wave = globalFacade.getCommandFacade().retrieve(commandClass).run();

        wave.addWaveListener(new DefaultWaveListener() {

            /**
             * {@inheritDoc}
             */
            @Override
View Full Code Here

Examples of org.jrebirth.af.core.wave.Wave

    @Test
    public void openDefaultStage() {

        final String stageKey = "defaultStage";
        final Wave wave = StageWaveBuilder.create()
                .action(StageAction.show)
                .key(stageKey)
                .build();

        wave.addWaveListener(new WaveListener() {

            @Override
            public void waveSent(final Wave wave) {
                // Nothing to do yet

            }

            @Override
            public void waveProcessed(final Wave wave) {
                // Nothing to do yet

            }

            @Override
            public void waveFailed(final Wave wave) {
                // Nothing to do yet

            }

            @Override
            public void waveDestroyed(final Wave wave) {
                // Nothing to do yet

            }

            @Override
            public void waveCreated(final Wave wave) {
                // Nothing to do yet

            }

            @Override
            public void waveConsumed(final Wave wave) {
                final Stage stage = StageTest.globalFacade.getServiceFacade().retrieve(StageService.class).getStage(stageKey);
                Assert.assertNotNull(stage);
                System.out.println("dddd");
            }

            @Override
            public void waveCancelled(final Wave wave) {
                // Nothing to do yet

            }
        });

        JRebirth.runIntoJIT(new AbstractJrbRunnable("Send Wave " + wave.toString()) {
            @Override
            public void runInto() throws JRebirthThreadException {
                StageTest.globalFacade.getNotifier().sendWave(wave);
            }
        });
View Full Code Here

Examples of org.jrebirth.af.core.wave.Wave

     * Recursive call.
     */
    private void unqueueWaves() {

        // Extract the next wave to run
        final Wave waveToRun = this.waveList.get(this.index);

        // The wave is null skip it and launch the next one
        if (waveToRun == null) {

            this.index++;
            // Run next command if any
            if (this.waveList.size() > this.index) {
                unqueueWaves();
            }
        } else {

            LOGGER.trace("Unqueue wave N° " + this.index + " >> " + waveToRun.toString());

            // Attach a listener to be informed when the wave will be consumed
            waveToRun.addWaveListener(this);
            // Send it to the queue in order to perform it
            sendWave(waveToRun);
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.