Пример #1
0
  public static void main(String[] argv) {

    Apsynth.printInfo();
    Apsynth.initialize();

    WaveWriter mainSignal = new FilesystemStorage().readProject(argv[0]);

    long startTime = new Date().getTime();

    long tick = 0;

    do {
      // 10000 ticks granularity for end detection
      for (int i = 0; i < 10000; i++) {
        mainSignal.write(tick);
        tick++;

        if (tick % samplefreq == 0) {
          timestamp(tick);
        }
      }
    } while (!Pool.allTracksFinished());

    // wait for 0.5s pause
    SilenceDetector s = new SilenceDetector();
    while (!s.isSilent()) {
      s.monitor(mainSignal.write(tick), tick);

      if (tick % samplefreq == 0) {
        timestamp(tick);
      }
    }

    long endTime = new Date().getTime();

    mainSignal.close();

    long seconds = (endTime - startTime) / 1000;

    if (seconds == 0) {
      System.out.println("done (instant win)");
    } else {
      System.out.println(
          "done (" + tick + " ticks in " + seconds + " seconds = ~" + tick / seconds + "t/s)");
    }
  }
Пример #2
0
  static void initialize() {

    // Register Classes
    // TODO auto-register via inspection?
    Pool.registerSignalClass(new AmplifierClass());
    Pool.registerSignalClass(new ConstantSignalClass());
    Pool.registerSignalClass(new DelayEchoClass());
    Pool.registerSignalClass(new EndianChangerClass());
    Pool.registerSignalClass(new MixerClass());
    Pool.registerSignalClass(new WhiteNoiseClass());
    Pool.registerSignalClass(new PinkNoiseClass());
    Pool.registerSignalClass(new QuantizerClass());
    Pool.registerSignalClass(new SawtoothWaveClass());
    Pool.registerSignalClass(new SineWaveClass());
    Pool.registerSignalClass(new SquareWaveClass());
    Pool.registerSignalClass(new SquineWaveClass());
    Pool.registerSignalClass(new ClipperClass());
    Pool.registerSignalClass(new de.cgarbs.apsynth.signal.library.NullClass());
    Pool.registerSignalClass(new RegisterClass());
    Pool.registerSignalClass(new ArpeggioClass());
    Pool.registerSignalClass(new FiniteImpulseResponseClass());
    Pool.registerSignalClass(new DataBlockClass());
    Pool.registerSignalClass(new HighPassClass());
    Pool.registerSignalClass(new LowPassClass());
    Pool.registerSignalClass(new ADSREnvelopeClass());
    Pool.registerSignalClass(new de.cgarbs.apsynth.signal.library.SampleClass());
    Pool.registerSignalClass(new UndersampleClass());

    Pool.registerInstrumentClass(new SineClass());
    Pool.registerInstrumentClass(new SquareClass());
    Pool.registerInstrumentClass(new SquineClass());
    Pool.registerInstrumentClass(new SawtoothClass());
    Pool.registerInstrumentClass(new de.cgarbs.apsynth.instrument.library.NullClass());
    Pool.registerInstrumentClass(new HiHatClass());
  }