@Override public AudioInputStream synthesize(int backchannelNumber,AudioFileFormat aft) throws SynthesisException {
  int numberOfBackChannels=unitFileReader.getNumberOfUnits();
  if (backchannelNumber >= numberOfBackChannels) {
    throw new IllegalArgumentException("This voice has " + numberOfBackChannels + " backchannels only. so it doesn't support unit number "+ backchannelNumber);
  }
  VocalizationUnit bUnit=unitFileReader.getUnit(backchannelNumber);
  long start=bUnit.startTime;
  int duration=bUnit.duration;
  Datagram[] frames=null;
  try {
    frames=audioTimeline.getDatagrams(start,duration);
  }
 catch (  IOException e) {
    throw new SynthesisException("Can not read data from timeline file " + e);
  }
  LinkedList<Datagram> datagrams=new LinkedList<Datagram>();
  datagrams.addAll(Arrays.asList(frames));
  DoubleDataSource audioSource=new DatagramDoubleDataSource(datagrams);
  return (new DDSAudioInputStream(new BufferedDoubleDataSource(audioSource),aft.getFormat()));
}

@ Override public AudioInputStream synthesize ( int backchannelNumber , AudioFileFormat aft ) throws SynthesisException { int numberOfBackChannels = unitFileReader . getNumberOfUnits ( ) ; if ( backchannelNumber >= numberOfBackChannels ) { throw new IllegalArgumentException ( "This voice has " + numberOfBackChannels + " backchannels only. so it doesn't support unit number " + backchannelNumber ) ; } VocalizationUnit bUnit = unitFileReader . getUnit ( backchannelNumber ) ; long start = bUnit . startTime ; int duration = bUnit . duration ; Datagram [ ] frames = null ; try { frames = audioTimeline . getDatagrams ( start , duration ) ; } catch ( IOException e ) { throw new SynthesisException ( "Can not read data from timeline file " + e ) ; } LinkedList < Datagram > datagrams = new LinkedList < Datagram > ( ) ; datagrams . addAll ( Arrays . asList ( frames ) ) ; DoubleDataSource audioSource = new DatagramDoubleDataSource ( datagrams ) ; return ( new DDSAudioInputStream ( new BufferedDoubleDataSource ( audioSource ) , aft . getFormat ( ) ) ) ; }
synthesize given vocalization ( i . e . unit - selection )
