Clicking sounds when playing Raw Audio.
-
@Tirupathi-Korla Hi, thanks for the reply. What do you mean Header format is correct?
-
Hi,
Since it seems you are getting audio from a microphone, then why not use QAudioInput ?
-
@SGaist Hi, because I have an API function that stores the recorded data from the microphone into an array. I don't need to record the audio on my own. What i am doing is streaming the data from the array into a QByteArray, and writing that QByteArray to the QIODevice of QAudioOutput.
-
Basically this is the code that I have obtained from my C++ API and saved to a file.
[0_1514195321157_myfile_fs40kHz.txt](Uploading 100%)I played with Audacity. Imported Raw Audio played at 64bit float. It sounds muffled.
int* buffer; DWORD tdFrames, fdFrames; int framesize, counter=0; DWORD blocksize; CcmGetTimeDomainBlockSize(&blocksize); framesize = 40 * (int)blocksize; buffer = new int[framesize]; sourceFile = new QFile("myfile_fs40kHz.txt"); sourceFile->open(QIODevice::ReadWrite); QDataStream mDstream(sourceFile); while(counter<200){ CcmReadFrames(buffer,NULL,framesize,0,&tdFrames,&fdFrames,NULL,CCM_WAIT); for(int x=0; x<(int) blocksize; x++){ mDstream << static_cast<quint64>(buffer[x]) << endl; } counter++; } sourceFile->close();
-
-
@scottnat
When i tried to play your audio with sampleRate as 10000 and sampleSize 32, i don't hear any thing.. I changed SampleSize to 8 and i hear a sine wave audio and after few seconds i observed some noise along sine wave audio.. Is it the file you shared?? -
Hi all, thanks for the assistance. The issue has been fixed. Initially i was attempting to read and write data sequentially to achieve Real Time audio playback. However, this probably caused the issue of buffer underrun. I decided to save all my incoming data into a qbytearray and then buffer qiodevice to write.