类 AudioUtils


  • public class AudioUtils
    extends Object
    音频工具类
    作者:
    dwj
    • 构造器详细资料

      • AudioUtils

        public AudioUtils()
    • 方法详细资料

      • getAudioFormatConversionBytes

        public static byte[] getAudioFormatConversionBytes​(String sourceFilePath,
                                                           String targetFilePath,
                                                           String format)
        音频格式转换
        参数:
        sourceFilePath -
        targetFilePath -
        format - wav/mp3/amr
        返回:
      • getAudioFormatConversionIns

        public static InputStream getAudioFormatConversionIns​(String sourceFilePath,
                                                              String targetFilePath,
                                                              String format)
                                                       throws ws.schild.jave.EncoderException,
                                                              FileNotFoundException
        音频格式转换
        参数:
        sourceFilePath -
        targetFilePath -
        format - wav/mp3/amr
        返回:
        抛出:
        ws.schild.jave.EncoderException
        FileNotFoundException
      • audioFormatConversion

        public static void audioFormatConversion​(File source,
                                                 File target,
                                                 String format)
                                          throws ws.schild.jave.EncoderException
        音频格式转换
        参数:
        source - 源音频文件
        target - 输出的音频文件
        format - wav/mp3/amr
        抛出:
        ws.schild.jave.EncoderException
      • audioFormatConversion

        public static File audioFormatConversion​(InputStream sourceStream,
                                                 String format)
                                          throws ws.schild.jave.EncoderException,
                                                 IOException
        音频格式转换
        参数:
        sourceStream - 源音频流
        format - wav/mp3/amr
        返回:
        抛出:
        ws.schild.jave.EncoderException
        IOException
      • getAudioInfo

        public static ws.schild.jave.info.MultimediaInfo getAudioInfo​(File source)
                                                               throws ws.schild.jave.EncoderException
        获取音频信息
        参数:
        source -
        返回:
        抛出:
        ws.schild.jave.EncoderException
      • getAudioInfo

        public static ws.schild.jave.info.MultimediaInfo getAudioInfo​(AudioInputStream ais)
                                                               throws ws.schild.jave.EncoderException,
                                                                      IOException
        获取音频信息
        参数:
        ais -
        返回:
        抛出:
        ws.schild.jave.EncoderException
        IOException
      • saveToWav

        public static void saveToWav​(float[] floats,
                                     String savePath)
                              throws IOException
        将 float[] 音频数据保存为 WAV 文件
        抛出:
        IOException
      • getDefaultAudioFormat

        public static AudioFormat getDefaultAudioFormat()