code: @Override
      public void update(Sensor source, SensorData sd) {
          if (socket == null || oos == null) {
              return;
          }
          if (sd instanceof MicrophoneData) {
              MicrophoneData microphoneData = (MicrophoneData) sd;
              if (socket != null && socket.isConnected() && oos != null) {
                  try {
                      int totalSize = microphoneData.getData().length;
                      int frameSize = microphoneData.getAudioFormat().getFrameSize();
                      byte[] data = new byte[totalSize];
                      System.arraycopy(microphoneData.getData(), 0, data, 0, totalSize);
  
                      //int i = 0, j = 0, c = 0;
                      for (int i = 0, j = 0, c = 0; i < newRated.length - 1 && j < data.length - 1; i += 2, j += 6/*10*/) {
                          newRated[i] = data[j];
                          newRated[i + 1] = data[j + 1];
                          if (c > 2) {
                              //j += 2;
                              j -= 2;
                              c = 0;
                          } else {
                              c++;
                          }
                      }
  
                      //new AudioFormat(8000, 16, 1, true, false);
                      //System.out.println(microphoneData.getAudioFormat());
                      for (int i = 1; i < newRated.length; i += 2) {
                          if (random.nextBoolean()) {
                              newRated[i]++;
                          }
                      }
                      //System.out.println(totalSize+":"+newRated.length+":"+microphoneData.getAudioFormat().getSampleRate());
                      AudioStreamDataPacket asdp = new AudioStreamDataPacket(newRated, newRated.length / frameSize, frameSize);
                      oos.writeObject(asdp);
                      oos.flush();
                      oos.reset();
                  } catch (IOException e1) {
                      Logger.getLogger(getClass().getSimpleName()).log(Level.SEVERE, null, e1);
                      socket = null;
                      oos = null;
                      return;
                  }
              }
          }
      }
docs: 16000 Hz