public boolean keyDown (Event event, int key) {
    if (wave == null) return false;
    if (key >= 'a' && key <= 'z') key += 'A' - 'a';
    if (key < '0' || key > 'Z')
      return false;
    int f = keyFrequencies [key-'0'];
    if (f == 0) return false;
    byte[] s = wave.getUlaw();
    byte[] d = new byte [s.length * 8000 / f];
    double inc = f / 8000.0;
    double pos = 0;
    for (int i = 0; i < d.length; i++) {
      d[i] = s[(int)pos];
      pos += inc;
    }
    AudioPlayer.player.start (new AudioDataStream (new AudioData (d)));
    return true;
  }