Package javax.sound.sampled

Examples of javax.sound.sampled.AudioFormat


    float sampleRate = 8000.0F;
    int sampleSizeInBits = 16;
    int channels = 1;
    boolean signed = true;
    boolean bigEndian = false;
    return new AudioFormat(sampleRate, sampleSizeInBits, channels, signed, bigEndian);
  }
View Full Code Here


     */
    public void play() {
        AudioInputStream audioInputStream = null;
        try {
            audioInputStream = AudioSystem.getAudioInputStream(resourceURL);
            AudioFormat audioFormat = audioInputStream.getFormat();
            DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, audioFormat);
            Clip clip = getClip(dataLineInfo);
            clip.open(audioInputStream);
            FloatControl volctrl=(FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN);
            volctrl.setValue(volume);
View Full Code Here

        } catch (final IOException e1) {
            e1.printStackTrace();
            return;
        }

        final AudioFormat format = audioInputStream.getFormat();
        SourceDataLine auline = null;
        final DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);

        try {
            auline = (SourceDataLine) AudioSystem.getLine(info);
View Full Code Here

    {
      e1.printStackTrace();
      return;
    }

    AudioFormat format = audioInputStream.getFormat();
   
    DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);

    try
    {
View Full Code Here

            if (props.containsKey("date")) date = (Date) props.get("date");
            if (props.containsKey("comment")) comment = (String) props.get("comment");
            if (props.containsKey("album")) album = (String) props.get("album");
            if (props.containsKey("track")) track = (String) props.get("track");
            if (props.containsKey("genre")) genre = (String) props.get("genre");
            AudioFormat af = aff.getFormat();
            channels = af.getChannels();
            samplerate = (int) af.getSampleRate();
            bitspersample = af.getSampleSizeInBits();
            if (af instanceof TAudioFormat)
            {
                props = ((TAudioFormat) af).properties();
                if (props.containsKey("bitrate")) bitrate = ((Integer) props.get("bitrate")).intValue();
                if (props.containsKey("ape.version")) version = ((Integer) props.get("ape.version")).intValue();
View Full Code Here

     * @param aff
     */
    protected void loadInfo(AudioFileFormat aff) throws UnsupportedAudioFileException {
        String type = aff.getType().toString();
        if (!type.equalsIgnoreCase("flac")) throw new UnsupportedAudioFileException("Not Flac audio format");
        AudioFormat af = aff.getFormat();
        channels = af.getChannels();
        samplerate = (int) af.getSampleRate();
        bitspersample = af.getSampleSizeInBits();
    }
View Full Code Here

        streamConfiguration.setChannelCount(1);


        try {
            AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(inputFile);
            AudioFormat format = audioInputStream.getFormat();

            int frameSize = format.getFrameSize();

            FLACEncoder flacEncoder = new FLACEncoder();
            FLACFileOutputStream flacOutputStream = new FLACFileOutputStream(outputFile);

            flacEncoder.setStreamConfiguration(streamConfiguration);
View Full Code Here

   * @throws LineUnavailableException If cannot open or stream the TargetDataLine.
   */
  private void upChannel(String urlStr, TargetDataLine tl, AudioFormat af) throws LineUnavailableException{
    final String murl = urlStr;
    final TargetDataLine mtl = tl;
    final AudioFormat maf = af;
    if(!mtl.isOpen()){
      mtl.open(maf);
      mtl.start();
    }
    new Thread ("Upstream Thread") {
View Full Code Here

        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        if (audioInputStream != null) {
            AudioFormat format = audioInputStream.getFormat();
            DataLine.Info   info = new DataLine.Info(Clip.class, format,
                                             AudioSystem.NOT_SPECIFIED);
            try {
                audioClip = (Clip) AudioSystem.getLine(info);
                audioClip.addLineListener(this);
View Full Code Here

    float sampleRate = 44100;
    int sampleSizeInBits = 8;
    int channels = 1; // mono
    boolean signed = true;
    boolean bigEndian = true;
    return new AudioFormat(sampleRate, sampleSizeInBits, channels, signed,
        bigEndian);
  }
View Full Code Here

TOP

Related Classes of javax.sound.sampled.AudioFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.