search for: nbbyte

Displaying 20 results from an estimated 85 matches for "nbbyte".

Did you mean: nbbytes
2011 Nov 16
2
Just getting noise
...getting the same issue although I'm sure that would have bit me sooner or later. The new code is as follows. virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, size_t& outputSize) { short *in=(short*)inputBuffer; float *input = new float[(inputSize/2)](); int nbBytes; int i; for (i=0;i<(inputSize/2);i++) { input[i]=in[i]; } /*Flush all the bits in the struct so we can encode a new frame*/ speex_bits_reset(&mBits); /*Encode the frame*/ speex_encode(mState, input, &mBits); nbBytes = speex_bits_nbytes(&mBits);...
2011 Nov 16
2
Just getting noise
...may not be) that is 20ms. ? ? ? ? ? ? ? ?virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, size_t& outputSize) ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ? ? ?short *in=(short*)inputBuffer; ? ? ? ? ? ? ? ? ? ? ? ?float *input = new float[(inputSize/2)](); ? ? ? ? ? ? ? ? ? ? ? ?int nbBytes; ? ? ? ? ? ? ? ? ? ? ? ?/*Holds the state of the encoder*/ ? ? ? ? ? ? ? ? ? ? ? ?void *state; ? ? ? ? ? ? ? ? ? ? ? ?/*Holds bits so they can be read and written to by the Speex routines*/ ? ? ? ? ? ? ? ? ? ? ? ?SpeexBits bits; ? ? ? ? ? ? ? ? ? ? ? ?int i, tmp; ? ? ? ? ? ? ? ? ? ? ? ?const Spee...
2004 Aug 06
2
decode in ppc 2003
...char outfile[]="test.wav"; char *outFile; char *inFile; FILE *fout; // output file FILE *fin; // input file short out[FRAME_SIZE]; short output[FRAME_SIZE]; char cbits[200]; int nbBytes; void *state; SpeexBits bits; int i, tmp; state = speex_decoder_init(&speex_nb_mode); tmp=1; speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp); outFile = outfile; fout = fopen(outFile, &qu...
2008 Nov 13
2
decoded sample is completely differen from original one
...is my code wrong? If so what? Or is it a reasonable which depends of values that weren't correctly set? Thanks, Andre #include <stdio.h> #include <tchar.h> #include <speex/speex.h> #define FRAME_SIZE 160 #define QUALITY 8 #define ENHANCEMENT 1 int encode(int * nbBytes, char * encSamples) { void * state; SpeexBits bits; int quality = QUALITY; spx_int16_t input[] = {0x703B, 0x7361, 0x7567, 0x3969, 0x6874, 0x3B76, 0x3020, 0x3534, 0x3871, 0x7967, 0x3B75, 0x6C6F, 0x7261, 0x7965, 0x2038, 0x3B67,...
2004 Aug 06
2
Please 30 second to look a my code
...g::OnEncode() { Sleep(500); //Wait because drawing send window SpeexBits bits; void *state; short InBuffer[FRAME_SIZE]; char OutBuffer[200]; char waveheader[WAVEHEADER]; HANDLE WaveFile; HANDLE SpeexFile; DWORD NrOfBytesRead, NrOfBytesWritten; char nrBytes = 0; int nbBytes = 0; int bit_rate, frame_size, test=0; bool first=true; WaveFile = CreateFile(_T("\\Temp\\tempsound.wav"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); SpeexFile = CreateFile(_T("\\Temp\\tempsound.spx"), GENERIC_WRITE, 0, NULL,CREATE_ALWAYS, FIL...
2005 Oct 09
0
Fw: problem in encoder/decoder
...BOOL EncodeSpeex(CVoiceMsg *pMsg) { SpeexBits bits; void* enc_state; // Initialize. speex_bits_init(&bits); enc_state = speex_encoder_init(&speex_nb_mode); int frame_size = 0; // get frame size. speex_encoder_ctl(enc_state,SPEEX_GET_FRAME_SIZE,&frame_size); int nbBytes = 0; //unsigned char *input_frame,*encodedstr; unsigned char *encodedstr; float* input_frame;//approx of frame size input_frame = new float[frame_size]; encodedstr = new unsigned char[MAX_FRAME_BYTES]; ZeroMemory(input_frame,frame_size); ZeroMemory(encodedstr,MAX_FRAME_BYTES);...
2005 Oct 17
6
Error Executing sampledec in VC++
...cstate = speex_decoder_init (&speex_nb_mode); // Set default options for decoding: temp = 1; speex_decoder_ctl(decstate, SPEEX_SET_ENH, &temp); // Initialize spxbits (structure SpeexBits) speex_bits_init (&spxbits); while (!(feof(fo))) // this is where the problem starts { fread (&nbBytes, sizeof(int), 1, fo); fread (cbits, 1, nbBytes, fo); cout << "1"; // just to see whether the loop iterates speex_bits_read_from (&spxbits, cbits, nbBytes); speex_decode (decstate, &spxbits, pcm); // Copy 1 frame from float pcm to short spx for (n=0; n<FRAME_SIZE; n++...
2004 Aug 06
1
decode in ppc 2003
Hi, My problem is at the second fread function, fread(&nbBytes, sizeof(int), 1, fin); //the first fread fread(cbits,1, nbBytes, fin);// the second fread. When I'm debugging always nbytes is greater than cbits. This give me a execution error. Thanks. Rodrigo. <p><p><p>-----Mensaje original----- De: owner-speex-dev@xiph.org [mailto:own...
2011 Nov 17
1
Just getting noise
...gma::u8* Encode(Enigma::u8* inputBuffer,size_t >> inputSize, >> size_t& outputSize) >> ? ? ? ? ? ? ? ?{ >> ? ? ? ? ? ? ? ? ? ? ? ?short *in=(short*)inputBuffer; >> ? ? ? ? ? ? ? ? ? ? ? ?float *input = new float[(inputSize/2)](); >> ? ? ? ? ? ? ? ? ? ? ? ?int nbBytes; >> ? ? ? ? ? ? ? ? ? ? ? ?int i; >> >> ? ? ? ? ? ? ? ? ? ? ? ?for (i=0;i<(inputSize/2);i++) >> ? ? ? ? ? ? ? ? ? ? ? ?{ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? input[i]=in[i]; >> ? ? ? ? ? ? ? ? ? ? ? ?} >> >> ? ? ? ? ? ? ? ? ? ? ? ?/*Flush all the bi...
2006 Oct 12
1
Problem with encoding and decoding
...oundcard.h> /*The frame size in hardcoded for this sample code but it doesn't have to be*/ #define FRAME_SIZE 160 #define false -1 int card; int main(int argc, char **argv) { //char *inFile; FILE *fin; short in[FRAME_SIZE]; float input[FRAME_SIZE]; char cbits[200]; int nbBytes; /*Holds the state of the encoder*/ void *state; /*Holds bits so they can be read and written to by the Speex routines*/ SpeexBits bits; int i, tmp; char file[100]; int channels,format; while (argc>1){ argc--; argv++; if(!strncmp(argv[0],&quo...
2007 Feb 13
1
Hello Guys
...uot;speex.h" #include <stdio.h> /*The frame size in hardcoded for this sample code but it doesn't have to be*/ #define FRAME_SIZE 160 int main(int argc, char **argv) { char *inFile; FILE *fin; FILE *fout; short in[FRAME_SIZE]; float input[FRAME_SIZE]; char cbits[200]; int nbBytes; /*Holds the state of the encoder*/ void *state; /*Holds bits so they can be read and written to by the Speex routines*/ SpeexBits bits; int i, tmp; /*Create a new encoder state in narrowband mode*/ state = speex_encoder_init(&speex_nb_mode); /*Set the quality to 8 (15 kbps)*/ tmp=8;...
2012 Mar 10
3
problem: The decoded frame is not as the original one
...erent from the original frame(see output below).What is the possible reason for this?.thanks for any help #include<stdio.h> #include"intel16.h" #include <speex/speex.h> #define FRAME_SIZE 160 #define MAX_NB_BYTES 25 SpeexBits bits; void *enc_state; int quality=4;?????? int nbBytes; int byte_ptr; int frame_size; short frame[FRAME_SIZE];? char outBuffer[20]; SpeexBits decBits; void *dec_state; short decFrame[FRAME_SIZE]; /*===========END ===============================*/ int z=0; int frame_size; int main (int argc,char **argv) { for( z=0;z<160;z++) ??? { ??? frame[z]...
2004 Aug 06
1
About reducing noise..
...// read FRAME_SIZE bytes from buffer // convert to short for ( int i = 0; i < FRAME_SIZE; i++) in[i] = out_buffer[i]; speex_bits_reset(&bits); // encode speex_encode ( state, in, &bits); // copy bits to an array of chars nbBytes = speex_bits_write ( &bits, cbits, 200); // copy these cbits into a buffer CopyBuffer(pBuffer + dwLength, cbits, nbBytes); dwLength += nbBytes; } // uninitialize For decoding . SpeexBits bits; int i, tmp; state = speex_decoder_init(&speex_nb_mode); tmp =1; speex...
2011 Nov 16
0
Just getting noise
...that would have bit me > sooner or later. > The new code is as follows. > > virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize, > size_t& outputSize) > { > short *in=(short*)inputBuffer; > float *input = new float[(inputSize/2)](); > int nbBytes; > int i; > > for (i=0;i<(inputSize/2);i++) > { > input[i]=in[i]; > } > > /*Flush all the bits in the struct so we can encode a new frame*/ > speex_bits_reset(&mBits); > > /*Encode the frame*/ > speex_encode(mState, input,...
2007 Dec 06
2
Some question about speexcodex 1.2 beta2 on linux
...is the encode.c of mine: ===================================== #include <speex/speex.h> #include <speex/speex_preprocess.h> #include <stdio.h> #define MAX_FRAME_SIZE 320 int main() { FILE *fin, *fout; short in[MAX_FRAME_SIZE]; char cbits[200]; int nbBytes = 0; void *state; SpeexBits bits; int m_frame_size; int m_channels = 1; // SpeeX encode options int m_bitrate = (8 << 10); int m_complexity = 3; int m_quality = 8; int m_encMode = 6; int m_iAGC = 0; int...
2006 Jul 18
1
SpeexEncoder requires 320 samples to process a Frame, not 160
...em; import javax.sound.sampled.DataLine; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.AudioFormat.Encoding; import java.io.*; import org.xiph.speex.*; public class RecordTest { /** * @param args * @throws Exception */ private static int nbBytes = 0; private static int obBytes = 0; private static int myNum = 0; public static void main(String[] args) throws Exception { AudioFormat format; TargetDataLine line; byte[] buffer; format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,8000.0f, 16, 1, 2, 8000.0f, false); D...
2005 Oct 17
3
Error Executing sampledec in VC++
...tream instead of stdin) #include "speex/speex.h" #include <stdio.h> #include <iostream.h> void main () { // Definitions #define FRAME_SIZE 160 #define FIXED_POINT // Variable Declarations FILE *fo, *fs; short spx [FRAME_SIZE]; float pcm [FRAME_SIZE]; char cbits [200]; int nbBytes, n, temp; void *decstate; SpeexBits spxbits; // Program starts here: cout << "Starting spxdec...\n"; fo = fopen("samp.spx","rb"); if (fo == NULL) cout << "Error!\n"; else cout << "Okay!\n"; fs = fopen ("pcmfile", &q...
2007 Feb 13
0
Hello guys Please help
...clude <conio.h> using namespace std; /*The frame size in hardcoded for this sample code but it doesn't have to be*/ #define FRAME_SIZE 160 int main(int argc, char **argv) { char *inFile; FILE *fin; FILE *fout; short in[FRAME_SIZE]; float input[FRAME_SIZE]; char cbits[200]; int nbBytes; /*Holds the state of the encoder*/ void *state; /*Holds bits so they can be read and written to by the Speex routines*/ SpeexBits bits; int i, tmp; /*Create a new encoder state in narrowband mode*/ state = speex_encoder_init(&speex_nb_mode); /*Set the quality to 8 (15 kbps)*/ tmp=8;...
2010 Apr 15
2
Decoded output buffer size
...o know how many speex frames there are, how can I do this? I try to use speex_bits_remaining, but after some cycles it returns always 4. UINT DecodePayload( char* payload, UINT payload_len ) { speex_bits_reset(&spx_bits_); speex_bits_read_from(&spx_bits_, payload, payload_len); UINT nbBytes = speex_bits_remaining(&spx_bits_); while (nbBytes>0) { speex_decode(spx_state_, &spx_bits_, spx_dec_frame_); nbBytes = speex_bits_remaining(&spx_bits_); // Save the speex frame into the buffer DecOutBuffer_.Write(spx_dec_frame_, spx_frame_size_); } } Any su...
2012 Mar 14
0
Audio file is corrupted after decoding
...vity_spxEnc(JNIEnv * env, jobject jobj,jstring dir1,jstring dir2) { const char *inFile= (*env)->GetStringUTFChars(env,dir1,0); const char *outFile= (*env)->GetStringUTFChars(env,dir2,0); FILE *fin; FILE *fout; short in[FRAME_SIZE]; float input[FRAME_SIZE]; char cbits[360]; int nbBytes; void *state; SpeexBits bits; int i, tmp; state = speex_encoder_init(&speex_wb_mode); tmp=8; speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp); fin = fopen(inFile, "r"); fout=fopen(outFile,"w"); speex_bits_init(&bits); int bool=1;...