mohabb
14th November 2014, 12:55
I’m doing a project for audio processing in real time. I used the library QAudioRecorder to record and QAudioProbe to process the data. Everything works properly. I plot the result with QWT.
10745
The problem is that the data buffer stores only 40ms,i change the sampleRate (Fs) and it continue to stores 40ms, 320 samples with 8000Hz or 640 samples with 16000Hz in a mono channel. The problem is that i have to process every 250 ms. I want to change the size of the buffer.. How I can change the buffer size?
I think I should change this line of code in question, it connect the buffer with the slot Processed.
connect (probe, SIGNAL (audioBufferProbed (QAudioBuffer)), this, SLOT (Processed (QAudioBuffer)));
probe-> setSource (Audiorecorder);
audioRecorder.record ();
I consulted the internet information. I can build a buffer size as desired:
QAudioBuffer (int numFrames, QAudioFormat const & format, qint64 startTime = -1)
I try to do this, define to variables
QAudioFormat FORMATO;
const QAudioBuffer Buffer;
and start it in constructor
FORMATO(),
Buffer(400, FORMATO, -1.0) //400 samples for example
After, i try:
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),this, SLOT(Procesado( Buffer)));
I define the slot like:
void Processed(const QAudioBuffer Buffer);
It compile correctly, but when i run the programe:
QObject::connect: No such slot MainWindow::Procesado(const Buffer) in ..\ComparadorAlgoritmosEstimadoresPitch\mainwindow .cpp:182
QObject::connect: (receiver name: 'MainWindow')
How do I set the buffer to the function of QAudioProbe, audioBufferProbed?
Thank you very much. Sorry but my english is not very good.
10745
The problem is that the data buffer stores only 40ms,i change the sampleRate (Fs) and it continue to stores 40ms, 320 samples with 8000Hz or 640 samples with 16000Hz in a mono channel. The problem is that i have to process every 250 ms. I want to change the size of the buffer.. How I can change the buffer size?
I think I should change this line of code in question, it connect the buffer with the slot Processed.
connect (probe, SIGNAL (audioBufferProbed (QAudioBuffer)), this, SLOT (Processed (QAudioBuffer)));
probe-> setSource (Audiorecorder);
audioRecorder.record ();
I consulted the internet information. I can build a buffer size as desired:
QAudioBuffer (int numFrames, QAudioFormat const & format, qint64 startTime = -1)
I try to do this, define to variables
QAudioFormat FORMATO;
const QAudioBuffer Buffer;
and start it in constructor
FORMATO(),
Buffer(400, FORMATO, -1.0) //400 samples for example
After, i try:
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),this, SLOT(Procesado( Buffer)));
I define the slot like:
void Processed(const QAudioBuffer Buffer);
It compile correctly, but when i run the programe:
QObject::connect: No such slot MainWindow::Procesado(const Buffer) in ..\ComparadorAlgoritmosEstimadoresPitch\mainwindow .cpp:182
QObject::connect: (receiver name: 'MainWindow')
How do I set the buffer to the function of QAudioProbe, audioBufferProbed?
Thank you very much. Sorry but my english is not very good.