How to store Audio Input in array?
-
This post is deleted!
-
This post is deleted!
@kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll
-
@kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll
@jsulm Thank you! I didnt see this. So as I read the data real-time it can also append data to the file?
-
@jsulm Thank you! I didnt see this. So as I read the data real-time it can also append data to the file?
@kayakaan02 Yes, you can also write the data you get from the QIODevice into a file.
-
@kayakaan02 https://doc.qt.io/qt-5/qaudiooutput.html#start-1 returns QIODevice* which you can use to read the data (see https://doc.qt.io/qt-5/qiodevice.html#readyRead and https://doc.qt.io/qt-5/qiodevice.html#readAll
@jsulm I've got an another question, this can read the data but how can I access it? where does it store what it just read? seems like It doesn't return anything.
-
@jsulm I've got an another question, this can read the data but how can I access it? where does it store what it just read? seems like It doesn't return anything.
@kayakaan02 said in How to store Audio Input in array?:
seems like It doesn't return anything.
What do you mean? When you call QByteArray QIODevice::readAll() it returns a
QByteArrayof the bytes read. If you have your owncharbuffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize). -
@kayakaan02 said in How to store Audio Input in array?:
seems like It doesn't return anything.
What do you mean? When you call QByteArray QIODevice::readAll() it returns a
QByteArrayof the bytes read. If you have your owncharbuffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize). -
@kayakaan02 said in How to store Audio Input in array?:
seems like It doesn't return anything.
What do you mean? When you call QByteArray QIODevice::readAll() it returns a
QByteArrayof the bytes read. If you have your owncharbuffer you would prefer it read into there is also qint64 QIODevice::read(char *data, qint64 maxSize).@JonB So I have another problem, The QByteArray that readAll() returns is empty, and also I compared two .raw files that QAudioInput generated, one of them is recorded while my mic is muted and the other is normal, they have no difference. As I said, It's the same code as shown as example at QT Doc(here)
-
@JonB So I have another problem, The QByteArray that readAll() returns is empty, and also I compared two .raw files that QAudioInput generated, one of them is recorded while my mic is muted and the other is normal, they have no difference. As I said, It's the same code as shown as example at QT Doc(here)
@kayakaan02 said in How to store Audio Input in array?:
The QByteArray that readAll() returns is empty
That is not possible provided you call
readAll()in the slot forreadyRead(), just as I see you have marked as the correct answer from @jsulm above..... If you callreadAll()anywhere else it could be empty. Your code cannot be the same as the example you quote since that does not usereadAll(). -
@kayakaan02 said in How to store Audio Input in array?:
The QByteArray that readAll() returns is empty
That is not possible provided you call
readAll()in the slot forreadyRead(), just as I see you have marked as the correct answer from @jsulm above..... If you callreadAll()anywhere else it could be empty. Your code cannot be the same as the example you quote since that does not usereadAll().This post is deleted!