need a means to select audio input
I was trying to start something similar to this project with QtMultimedia: https://github.com/ec1oud/kaleidospect (which looks to be a waste of time since you have gotten so far with this project... I just found it this afternoon, despite doing a lot of searching before I put too much time into mine). My starting point was that maybe I want to monitor the audio output of what the system is playing, or maybe I want to monitor the microphone input in case some other system is playing the music. So I'm surprised this app doesn't have either a command line option or some UI for selecting the device (it always selects the default device, and the result is I'm not seeing any waveform), and I'm not sure how PortAudio API would allow selecting it anyway. I'm trying to make this sort of project easier in QML: https://codereview.qt-project.org/#/c/245047/ and 214395 So maybe with that, your attempt to use QtMultimedia would be more fruitful? What went wrong on the no-portaudio branch? (I'll just try to get it working, and find out, I guess)
In the meantime, we've been using pavucontrol to set the audio input, which allows you to set it to the monitor of your output which sounds like what you want.
I seem to remember there was something bad about QtMultimedia, but I don't remember what. @ervanalb ?
I got it working, but I'm having trouble with waitForReadyRead() and bytesAvailable() and such, so just have to do blind reading from the device that QAudioInput::start() returns, and use transactions to "put back" any short reads; because the FFT and beat detection probably needs to have a full set of 512 samples each time, doesn't it?
I recall having tried using QAudioInput, but it was much too high latency to be useful. Portaudio offers fairly good control over buffer sizes and latency, and I had used it before, so we went with it.
There's plenty complaints about Qt's lack of low latency support, but perhaps it has improved in the last few years. https://stackoverflow.com/questions/33923542/what-is-the-best-multithreading-approach-to-low-latency-audio-synthesis-in-qt
Hmm, I don't see a big emphasis on latency in Qt bugs about the multimedia module:
https://bugreports.qt.io/browse/QTBUG-42287?jql=text%20~%20%22latency%22%20and%20component%20%3D%20Multimedia%20ORDER%20BY%20createdDate%20
Do you try to measure latency? How?
We don't really. I recall it being very obvious (100+ ms.) I've also been meaning to add an "anticipation" field to the tempo controls, that will offset the time of the reported "beats" to account for latency in the system.