Package com.talixa.audio.riff.chunk

Examples of com.talixa.audio.riff.chunk.FormatChunk


      is.close();
      throw new WaveFormatException("WAVE header missing");
    }   
   
    // now, read in each chunk 
    FormatChunk formatChunk = null;
    AudioDataChunk audioChunk = null;
   
    byte[] chunkId   = new byte[4];
    byte[] chunkSize = new byte[4];
    byte[] chunkData;
   
    while (is.read(chunkId) == 4) {
      is.read(chunkSize);
      int size = (int)EndianConverter.littleEndianIntToJavaLong(chunkSize);
      if (Arrays.equals(chunkId, FormatChunk.FORMAT_CHUNK_HEADER)) {     
        chunkData = new byte[size];
        is.read(chunkData);
        formatChunk = new FormatChunk();
        try {
          formatChunk.setChunkData(chunkData);
        } catch (ChunkFormatException e) {   
          is.close();
          throw new WaveFormatException("Bad Format Header");
        }         
      } else if (Arrays.equals(chunkId,AudioDataChunk.AUDIO_DATA_CHUNK_HEADER)) {           
View Full Code Here


    chunk.setChunkData(audioData);
    return chunk;
  }
 
  private static FormatChunk createMulawFormatChunk() {
    FormatChunk chunk = new FormatChunk();
    chunk.setAudioFormat(FormatChunk.AUDIO_FORMAT_MU_LAW);
    chunk.setBitsPerSample(FormatChunk.BITS_PER_SAMPLE_8);
    chunk.setNumChannels(FormatChunk.NUM_CHANNELS_1);
    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
View Full Code Here

    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
 
  private static FormatChunk createAlawFormatChunk() {
    FormatChunk chunk = new FormatChunk();
    chunk.setAudioFormat(FormatChunk.AUDIO_FORMAT_A_LAW);
    chunk.setBitsPerSample(FormatChunk.BITS_PER_SAMPLE_8);
    chunk.setNumChannels(FormatChunk.NUM_CHANNELS_1);
    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
View Full Code Here

    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
 
  private static FormatChunk create16bitPcmFormatChunk() {
    FormatChunk chunk = new FormatChunk();
    chunk.setAudioFormat(FormatChunk.AUDIO_FORMAT_PCM);
    chunk.setBitsPerSample(FormatChunk.BITS_PER_SAMPLE_16);
    chunk.setNumChannels(FormatChunk.NUM_CHANNELS_1);
    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
View Full Code Here

    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }
 
  private static FormatChunk create8bitPcmFormatChunk() {
    FormatChunk chunk = new FormatChunk();
    chunk.setAudioFormat(FormatChunk.AUDIO_FORMAT_PCM);
    chunk.setBitsPerSample(FormatChunk.BITS_PER_SAMPLE_8);
    chunk.setNumChannels(FormatChunk.NUM_CHANNELS_1);
    chunk.setSampleRate(FormatChunk.SAMPLE_RATE_8K);
    return chunk;
  }       
View Full Code Here

TOP

Related Classes of com.talixa.audio.riff.chunk.FormatChunk

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.