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.
Captura.jpg
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 ();
connect (probe, SIGNAL (audioBufferProbed (QAudioBuffer)), this, SLOT (Processed (QAudioBuffer)));
probe-> setSource (Audiorecorder);
audioRecorder.record ();
To copy to clipboard, switch view to plain text mode
I consulted the internet information. I can build a buffer size as desired:
QAudioBuffer (int numFrames, QAudioFormat const & format, qint64 startTime = -1)
QAudioBuffer (int numFrames, QAudioFormat const & format, qint64 startTime = -1)
To copy to clipboard, switch view to plain text mode
I try to do this, define to variables
QAudioFormat FORMATO;
const QAudioBuffer Buffer;
QAudioFormat FORMATO;
const QAudioBuffer Buffer;
To copy to clipboard, switch view to plain text mode
and start it in constructor
FORMATO(),
Buffer(400, FORMATO, -1.0) //400 samples for example
FORMATO(),
Buffer(400, FORMATO, -1.0) //400 samples for example
To copy to clipboard, switch view to plain text mode
After, i try:
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),this, SLOT(Procesado( Buffer)));
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),this, SLOT(Procesado( Buffer)));
To copy to clipboard, switch view to plain text mode
I define the slot like:
void Processed(const QAudioBuffer Buffer);
void Processed(const QAudioBuffer Buffer);
To copy to clipboard, switch view to plain text mode
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')
QObject::connect: No such slot MainWindow::Procesado(const Buffer) in ..\ComparadorAlgoritmosEstimadoresPitch\mainwindow .cpp:182
QObject::connect: (receiver name: 'MainWindow')
To copy to clipboard, switch view to plain text mode
How do I set the buffer to the function of QAudioProbe, audioBufferProbed?
Thank you very much. Sorry but my english is not very good.
Bookmarks