public static int writeSpeexHeader(byte[] buf,int offset,int sampleRate,int mode,int channels,boolean vbr,int nframes,int packetlength){
  writeString(buf,offset,"Speex   ");
  writeString(buf,offset + 8,"speex-1.2rc");
  System.arraycopy(new byte[11],0,buf,offset + 17,11);
  writeInt(buf,offset + 28,1);
  writeInt(buf,offset + 32,80);
  writeInt(buf,offset + 36,sampleRate);
  writeInt(buf,offset + 40,mode);
  writeInt(buf,offset + 44,4);
  writeInt(buf,offset + 48,channels);
  writeInt(buf,offset + 52,-1);
  writeInt(buf,offset + 56,160 << mode);
  writeInt(buf,offset + 60,vbr ? 1 : 0);
  writeInt(buf,offset + 64,nframes);
  writeInt(buf,offset + 68,0);
  writeInt(buf,offset + 72,packetlength);
  writeInt(buf,offset + 76,0);
  return 80;
}

public static int writeSpeexHeader ( byte [ ] buf , int offset , int sampleRate , int mode , int channels , boolean vbr , int nframes , int packetlength ) { writeString ( buf , offset , "Speex   " ) ; writeString ( buf , offset + 8 , "speex-1.2rc" ) ; System . arraycopy ( new byte [ 11 ] , 0 , buf , offset + 17 , 11 ) ; writeInt ( buf , offset + 28 , 1 ) ; writeInt ( buf , offset + 32 , 80 ) ; writeInt ( buf , offset + 36 , sampleRate ) ; writeInt ( buf , offset + 40 , mode ) ; writeInt ( buf , offset + 44 , 4 ) ; writeInt ( buf , offset + 48 , channels ) ; writeInt ( buf , offset + 52 , - 1 ) ; writeInt ( buf , offset + 56 , 160 << mode ) ; writeInt ( buf , offset + 60 , vbr ? 1 : 0 ) ; writeInt ( buf , offset + 64 , nframes ) ; writeInt ( buf , offset + 68 , 0 ) ; writeInt ( buf , offset + 72 , packetlength ) ; writeInt ( buf , offset + 76 , 0 ) ; return 80 ; }
writes a speex header to the given byte array .
