static public AudioInputStream convertToPCM(AudioInputStream in) throws IllegalArgumentException
  {
    AudioFormat targetFormat = null;
    AudioInputStream pcm = in;
    AudioFormat sourceFormat = in.getFormat();
    int sampleSizeInBits;

    //check for not null
    if(in == null)
      throw new IllegalArgumentException("the inputstream must not be null values");

    //set appropriate sample size
    sampleSizeInBits = sourceFormat.getSampleSizeInBits();
    if(sampleSizeInBits == -1)
      sampleSizeInBits = 16;
    if(sampleSizeInBits != 8 && sampleSizeInBits != 16 && sampleSizeInBits != 24 && sampleSizeInBits != 32)
      sampleSizeInBits = 16;

    //get source format
    sourceFormat = in.getFormat();

    //convert to pcm
    if (sourceFormat.getEncoding() != AudioFormat.Encoding.PCM_SIGNED)
    {


      targetFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
                                         sourceFormat.getSampleRate(),
                                         sampleSizeInBits,
                                         sourceFormat.getChannels(),
                                         sourceFormat.getChannels() * (sampleSizeInBits/8),
                                         sourceFormat.getSampleRate(),
                                         false);

        //convert to pcm
        if (AudioSystem.isConversionSupported(targetFormat, sourceFormat))
          pcm = AudioSystem.getAudioInputStream(targetFormat, pcm);
        else
          throw new IllegalArgumentException("conversion to PCM_SIGNED not supported for this input stream");
    }
    return pcm;
  }