code: private StreamConfiguration adjustConfigurations(AudioFormat format) {
      int sampleRate = (int) format.getSampleRate();
      int sampleSize = format.getSampleSizeInBits();
      int channels = format.getChannels();
  
      StreamConfiguration streamConfiguration = new StreamConfiguration();
      streamConfiguration.setSampleRate(sampleRate);
      streamConfiguration.setBitsPerSample(sampleSize);
      streamConfiguration.setChannelCount(channels);
  
      return streamConfiguration;
    }
docs: Method sets input stream configuration for encoder.
  
  @param format input format
  
  @return stream configuration for encoder.