Konvertierung des Audioformats
Ich habe Probleme beim Konvertieren des Audioformats einer WAV-Datei.
Ich nehme Ton von meinem Mikrofon auf und der Ton wird im folgenden Format aufgezeichnet: PCM_SIGNED 44100.0 Hz, 16 Bit, Mono, 2 Bytes / Frame
Ich möchte das obige Format in ULAW 8000.0 Hz, 8 Bit, Mono, 1 Byte / Frame konvertieren
Ich benutze den folgenden Code,
<code>InputStream is = request.getInputStream(); AudioInputStream ais = AudioSystem.getAudioInputStream(is); AudioFormat oldFormat = ais.getFormat(); AudioFormat newFormat = new AudioFormat(AudioFormat.Encoding.ULAW, 8000, 8, 1, 1, 8000, false) ; AudioInputStream lowResAIS = AudioSystem.getAudioInputStream(newFormat, ais); //Getting the below Exception on this line </code>
Und ich erhalte den folgenden Fehler:
java.lang.IllegalArgumentException: Nicht unterstützte Konvertierung: ULAW 8000.0 Hz, 8 Bit, Mono, 1 Byte / Frame, von PCM_SIGNED 44100.0 Hz, 16 Bit, Mono, 2 Byte / Frame, Little-Endian
Kann mir bitte jemand helfen dieses Problem zu lösen !!!
Danke vielmals!!!