Examples of AudioFormat


Examples of javax.media.format.AudioFormat

            if ( getMute() || buf.isDiscard() || (buf.getLength() <= 0) )
            {
                return;
            }
           
            AudioFormat af = (AudioFormat) buf.getFormat();
           
            byte [] data = (byte[]) buf.getData();
           
            if ( af.getEncoding().equalsIgnoreCase("LINEAR") )
            {
                if ( af.getSampleSizeInBits() == 16 )
                {
                    int msb = 0;
                    int lsb = 1;
                   
                    if ( af.getEndian() == AudioFormat.LITTLE_ENDIAN )
                    {
                        msb = 1;
                        lsb = 0;
                    }
                   
                    if ( af.getSigned() == AudioFormat.SIGNED )
                    {
                        int peak = 0;
                        int samples = data.length / 2;
                        for (int i=0; i<samples; i++)
                        {
View Full Code Here

Examples of javax.media.format.AudioFormat

   
   
    public static AudioFormat convertCodecAudioFormat(vorbis_info vi)
    {
    return new AudioFormat(AudioFormat.LINEAR, vi.rate.floatValue(), 16, vi.channels, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
    }
View Full Code Here

Examples of javax.media.format.AudioFormat

   
    }
    catch (NumberFormatException e)
    {  throw new JavaSoundUrlParserException("Invalid number", e);
    }
    return new AudioFormat(AudioFormat.LINEAR, rate, bits, channels, endian, signed);
   
  }
View Full Code Here

Examples of javax.media.format.AudioFormat

        throw new RuntimeException();
     
      final int signed = checkBoxAudioSigned.isSelected() ? AudioFormat.SIGNED : AudioFormat.UNSIGNED;

     
      return new AudioFormat(encoding, sampleRate, sampleSizeInBits, channels, endian, signed);

    }
View Full Code Here

Examples of javax.media.format.AudioFormat

    private byte[] pktHdr;


    public PcmPacketizer() {
         supportedInputFormats = new AudioFormat[] {
          new AudioFormat(
        AudioFormat.LINEAR
                )
        };
        supportedOutputFormats  = new AudioFormat[] {
          new AudioFormat(
                    CUSTOM_PCM
                )
        };
    }
View Full Code Here

Examples of javax.media.format.AudioFormat

  // Recompute the output format if the input format has changed.
  // The crucial info is the frame rate and size.  These are used
  // to compute the actual rate the data being sent.
  if (rate != (int)outFormat.getFrameRate() ||
      frameSize != outFormat.getFrameSizeInBits()) {
    outFormat = new AudioFormat(CUSTOM_PCM,
        AudioFormat.NOT_SPECIFIED,  // rate
        AudioFormat.NOT_SPECIFIED,  // size
        AudioFormat.NOT_SPECIFIED,  // channel
        AudioFormat.NOT_SPECIFIED,  // endian
        AudioFormat.NOT_SPECIFIED,  // signed
View Full Code Here

Examples of javax.media.format.AudioFormat

    public PowerMeter(int nPowersPerSec) {
  this.nPowersPerSec = nPowersPerSec;
  timeStamps = new long[nPowersPerSec * NUM_SECONDS];
  powers = new float[nPowersPerSec * NUM_SECONDS];
  inputFormats = new Format[] {new AudioFormat(AudioFormat.LINEAR,
                 Format.NOT_SPECIFIED,
                 16,
                 Format.NOT_SPECIFIED,
                 Format.NOT_SPECIFIED,
                 Format.NOT_SPECIFIED,
                 Format.NOT_SPECIFIED,
                 Format.NOT_SPECIFIED,
                 Format.byteArray)};

  outputFormats = new Format[] {new AudioFormat(AudioFormat.LINEAR,
                  Format.NOT_SPECIFIED,
                  16,
                  Format.NOT_SPECIFIED,
                  Format.NOT_SPECIFIED,
                  Format.NOT_SPECIFIED,
View Full Code Here

Examples of javax.media.format.AudioFormat

  byte [] inBuffer       = (byte[])inputBuffer.getData();
  int     inLength       = inputBuffer.getLength();
  int     inOffset       = inputBuffer.getOffset();
  int     samplesNumber  = inLength;
  AudioFormat af = (AudioFormat) inputBuffer.getFormat();


  if (enabled) {
      int shiftZero = 0;
      int shiftOne = 8;
      if (af.getEndian() == AudioFormat.BIG_ENDIAN) {
    shiftZero = 8;
    shiftOne = 0;
      }
 
      // == main
      int spa = ((int) af.getSampleRate() * af.getChannels()) / nPowersPerSec;
      long npa = 1000000000L / nPowersPerSec;
      long timeStamp = inputBuffer.getTimeStamp(); // in nanos
      float average = 0;
      long cspa = 0;
      for (int i = 0; i < inLength; i += 2) {
View Full Code Here

Examples of javax.media.format.AudioFormat

  public static void main(String[] args)
  {
    final String urlStr = URLUtils.createUrlStr(new File("samplemedia/gulp2.wav"));//"file://samplemedia/gulp2.wav";
    Format format;
    // TODO: if receiver has JMF in classpath after FMJ, and JMF defaults for PIM set to true, no audio is heard.
    format = new AudioFormat(AudioFormat.ULAW_RTP, 8000, 8, 1);
    //format = new AudioFormat(AudioFormat.ULAW_RTP, 8000.0, 8, 1, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
    //format = new AudioFormat(BonusAudioFormatEncodings.ALAW_RTP, 8000, 8, 1);
    //format = new AudioFormat(BonusAudioFormatEncodings.SPEEX_RTP, 8000, 8, 1, -1, AudioFormat.SIGNED);
    //format = new AudioFormat(BonusAudioFormatEncodings.ILBC_RTP, 8000.0, 16, 1, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
   
   
    if (false)
    {
      // First find a capture device that will capture linear audio
      // data at 8bit 8Khz
      AudioFormat captureFormat = new AudioFormat(AudioFormat.LINEAR, 8000, 8, 1);
 
      Vector devices = CaptureDeviceManager.getDeviceList(captureFormat);
 
      CaptureDeviceInfo di = null;
 
View Full Code Here

Examples of javax.media.format.AudioFormat

      outFormat.getChannels() != channels ||
      outFormat.getEndian() != endian ||
      outFormat.getSigned() != signed) {
      // There's either a format change or the initially
      // assumed format has been updated to the correct one.
      outFormat = new AudioFormat(AudioFormat.LINEAR,
          rate,
          sizeInBits,
          channels,
          endian,
          signed);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.