public CrazySoundReactor(AudioContext context) {
   super(context, 2);
   clock = new Clock(context);
   clock.setIntervalEnvelope(new Envelope(context, 500.0f));
   clock.start();
   clock.addMessageListener(this);
 }
    public void message(Bead message) {
      // muck around with the clock
      clock.setIntervalEnvelope(new Envelope(context, Math.random() < 0.5 ? 500.0f : 1000.0f));

      BeadArray stopTrigger = new BeadArray();
      WavePlayer sinePlayer =
          WavePlayer.newSinePlayer(context, (float) Math.random() * scale + 100.0f);
      sinePlayer.start();
      Gain gain = new Gain(context, 1);

      stopTrigger.add(sinePlayer);
      ((Envelope) gain.getGainEnvelope()).addSegment(0.1f, 200, 1, null);
      ((Envelope) gain.getGainEnvelope()).addSegment(0.01f, 500, 1, null);
      ((Envelope) gain.getGainEnvelope()).addSegment(0.1f, 500, 1, null);
      ((Envelope) gain.getGainEnvelope()).addSegment(0, 3000, 1, stopTrigger);
      gain.addInput(sinePlayer);
      gain.start();
      stopTrigger.add(gain);
      addInput(gain);
    }