0

Currently trying to use JAAD library within Processing to load a file, read it and output the Sample Rate, Bit Rate & Bit Depth. I've been using the example below as a guide but currently when I run the application, it doesn't run past "cont = new MP4Container". I can't work out where I've gone wrong, any help would be greatly appreciated!

Original Example --> Java play AAC encoded audio ( JAAD decoder )

import net.sourceforge.jaad.aac.Decoder;
import net.sourceforge.jaad.aac.SampleBuffer;
import net.sourceforge.jaad.mp4.MP4Container;
import net.sourceforge.jaad.mp4.api.*;
import java.io.*;
import java.util.*;

void audioProp2(String file) {

  MP4Container cont;
  Movie movie;
  AudioTrack track;

  File tAudio = new File(dataPath(file));

  try { 
    println("Works up to here");
    cont = new MP4Container(new RandomAccessFile(tAudio, "r") );
    println("Won't run anything else");

    //Eventually was going to include the lines below to get the sample rate
    //movie = cont.getMovie();
    //List<Track> content = movie.getTracks();

    //if (content.isEmpty())
      //throw new Exception ("No Content");
    //track = (AudioTrack) movie.getTracks().get(0);
    //println("Sample Rate is " + track.getSampleRate());
  }

  catch(Exception e) {
    println("Catch");
  }
}

0 Answers0