search for: numsamples

Displaying 14 results from an estimated 14 matches for "numsamples".

Did you mean: num_samples
2009 Dec 12
1
Skipping of sample in ogg writing
...uggest what could be wrong in the code. Is there anything like bug in ogg itself or am I missing something critical step. Here is the code for writing the ogg file. //============================================================================== bool write (const int** samplesToWrite, int numSamples) { if (numSamples > 0) { float** const vorbisBuffer = vorbis_analysis_buffer (&vd, numSamples); for (int i = numChannels; --i >= 0;) { float* const dst = vorbisBuffer[i]; const int* const src...
2009 Dec 12
1
Skipping of sample in ogg writing
...uggest what could be wrong in the code. Is there anything like bug in ogg itself or am I missing something critical step. Here is the code for writing the ogg file. //============================================================================== bool write (const int** samplesToWrite, int numSamples) { if (numSamples > 0) { float** const vorbisBuffer = vorbis_analysis_buffer (&vd, numSamples); for (int i = numChannels; --i >= 0;) { float* const dst = vorbisBuffer[i]; const int* const src...
2009 Apr 06
3
how to subsample all possible combinations of n species taken 1:n at a time?
...ied two methods but both give memory errors at about 25 taxa. The expand.grid() method: n <- 11 toto <- vector("list",n) titi <- lapply(toto,function(x) c(0,1)) tutu <- expand.grid(titi) The combn() method (a slightly lengthlier function): samplecommunityD<- function(n,numsamples) { super<-mat.or.vec(,n) for (numspploop in 1:n) { minor<-t(combn(n,numspploop)) if (dim(minor)[1]<numsamples) { minot<-mat.or.vec(dim(minor)[1],n) for (loopi in 1:dim(minor)[1]) { for (loopbi in 1:dim(minor)[2]) { minot[loopi,minor[loopi,loopbi]] &...
2012 Jun 20
1
prcomp: where do sdev values come from?
...genvectors on the original "data" gives the same values as the standard deviations given by prcomp(). Can anyone reconcile this example with the manual page for prcomp() or explain how the standard deviations are calculated? the code for standardize(): standardize<-function(data){ numSamples = nrow(data); # calculate mean for each marker mn=apply(data,2,mean); numMarkers = ncol(data); #standardize every entry for(j in 1:numMarkers){ for(k in 1:numSamples){ temp = sqrt(mn[j]/2*(1-mn[j]/2)); data[k,j] = (data[k,j] - mn[j])/temp; } } data; } Thank you,...
2007 Nov 20
0
speex_bits_write / speex_bits_read_from - getting Static
...********** Managed C++ Code *********************************** //Public function -- m_encoderState is a void* member, m_bits is a SpeexBits* member array<Byte>^ SpeexEncoder::Encode(array<short>^ inputFrame) { //begin lazy man's way of converting to regular C unsigned int numSamples = inputFrame->Length; short* inputptr = (short*) malloc(numSamples*sizeof(short)); unsigned int i = 0; for(i = 0; i<numSamples; i++) inputptr[i] = (short) inputFrame[i]; //end lazy man's conversion speex_bits_reset(m_bits); //preprocess the input //sp...
2008 Aug 29
0
Fw: Voice Activation Level (speex 1.1.11.1)
Manisha, I'm still here. :-) Here's the function: // Returns the average power level in the given signal float getPower(signed short int *signal, int numSamples) { int i; float amp; float powerSum = 0.0f; for (i = 0; i < numSamples; i++) { amp = (float) abs(signal[i]); powerSum += amp * amp; } return powerSum / (32768.0f * 32768.0f * (float) numSamples); } Note that you should determine an activation thresh...
2006 Mar 02
0
Voice Activation Level (speex 1.1.11.1)
...ckground noise is not a problem if you just use the Speex denoiser (which is VERY effective) and calculate the power of the signal after that. This is the function I use to calculate the power: // Returns the power of a signal (sample_t is signed 16-bit int) float getPower(sample_t *signal, int numSamples) { float powerSum = 0.0f; for (int i = 0; i < numSamples; i++) { float amp = (float) abs(signal[i]); powerSum += amp * amp; } return powerSum / (32768.0f * 32768.0f * (float) numSamples); } I can't say that this is optimal or even correct, but it works very well for me. And users...
2006 Mar 02
0
Voice Activation Level (speex 1.1.11.1)
...ound noise is not a problem if you just use the Speex denoiser = (which is VERY effective) and calculate the power of the signal after = that. This is the function I use to calculate the power: // Returns the power of a signal (sample_t is signed 16-bit int) float = getPower(sample_t *signal, int numSamples) { float powerSum =3D 0.0f; for (int i =3D 0; i < numSamples; i++) { float amp =3D (float) abs(signal[i]); powerSum +=3D amp * amp; } return powerSum / (32768.0f * 32768.0f * (float) numSamples); } I can't say that this is optimal or even correct, but it works very well = for me....
2006 Mar 03
0
Fw: Voice Activation Level (speex 1.1.11.1)
...kground noise is not a problem if you just use the Speex denoiser (which is VERY effective) and calculate the power of the signal after that. This is the function I use to calculate the power: // Returns the power of a signal (sample_t is signed 16-bit int) float getPower(sample_t *signal, int numSamples) { float powerSum = 0.0f; for (int i = 0; i < numSamples; i++) { float amp = (float) abs(signal[i]); powerSum += amp * amp; } return powerSum / (32768.0f * 32768.0f * (float) numSamples); } I can't say that this is optimal or even correct, but it works very well for me. And users rarely h...
2005 Jun 22
1
Newbie - Encoding PCM
...ment an encoder but unsuccesfully. Here's my code: /* ============ SPEEX stream ENCODER ============================================ */ int SPEEX_EncodePCM(struct _IDA_ClientSocket *IDA,char *buffer,unsigned char *PCM,int num_samples) { /* buffer point to the output buffer PCM point to the numsamples bytes 8bit - 8Khz PCM from the modem num_samples is, commonly, 16000 */ int ret,c,d; short int PCM_F[160]; for(c=0;c<num_samples;c++) { /* tempbuf 0<-127->256 */ /* pcmbuff -32786 <- 0 -> +32786 */ PCM_F[d] = (PCM[c] << 8)^0x8000; d++; if(d > 160) { sp...
2013 Feb 12
0
Speexdec says: 'This doesn't look like a Speex file' (am I missing headers?)
...#39;lpcm' mFormatFlags: 0xc mBytesPerPacket: 2 mFramesPerPacket: 1 mBytesPerFrame: 2 mChannelsPerFrame: 1 mBitsPerChannel: 16 } ... } ... } sbufToTrackReadiness = 0x0 numSamples = 375 sampleTimingArray[1] = { {PTS = {82626949766094/1000000000 = 82626.950, rounded}, DTS = {INVALID}, duration = {1/44100 = 0.000}}, } sampleSizeArray[1] = { sampleSize = 2, } dataBuffer = 0x6e7a40 b) Actual data which is kept in aforementioned buffer (for t...
2013 Feb 12
0
Speexdec says: 'This doesn't look like a Speex file' (am I missing headers?).
...m' mFormatFlags: 0xc mBytesPerPacket: 2 mFramesPerPacket: 1 mBytesPerFrame: 2 mChannelsPerFrame: 1 mBitsPerChannel: 16 } ... } ... } sbufToTrackReadiness = 0x0 numSamples = 375 sampleTimingArray[1] = { {PTS = {82626949766094/1000000000 = 82626.950, rounded}, DTS = {INVALID}, duration = {1/44100 = 0.000}}, } sampleSizeArray[1] = { sampleSize = 2, } dataBuffer = 0x6e7a40 b) Actual data which is kept in aforementioned buffer (for t...
2013 Feb 12
0
Speexdec says: 'This doesn't look like a Speex file' (am I missing headers?).
...#39;lpcm' mFormatFlags: 0xc mBytesPerPacket: 2 mFramesPerPacket: 1 mBytesPerFrame: 2 mChannelsPerFrame: 1 mBitsPerChannel: 16 } ... } ... } sbufToTrackReadiness = 0x0 numSamples = 375 sampleTimingArray[1] = { {PTS = {82626949766094/1000000000 = 82626.950, rounded}, DTS = {INVALID}, duration = {1/44100 = 0.000}}, } sampleSizeArray[1] = { sampleSize = 2, } dataBuffer = 0x6e7a40 b) Actual data which is kept in aforementioned buffer (for t...
2013 Feb 12
0
Speexdec says: 'This doesn't look like a Speex file' (am I missing headers?)
...m' mFormatFlags: 0xc mBytesPerPacket: 2 mFramesPerPacket: 1 mBytesPerFrame: 2 mChannelsPerFrame: 1 mBitsPerChannel: 16 } ... } ... } sbufToTrackReadiness = 0x0 numSamples = 375 sampleTimingArray[1] = { {PTS = {82626949766094/1000000000 = 82626.950, rounded}, DTS = {INVALID}, duration = {1/44100 = 0.000}}, } sampleSizeArray[1] = { sampleSize = 2, } dataBuffer = 0x6e7a40 b) Actual data which is kept in aforementioned buffer (for t...