Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need a means to select audio input #90

Open
ec1oud opened this issue Nov 11, 2018 · 5 comments
Open

need a means to select audio input #90

ec1oud opened this issue Nov 11, 2018 · 5 comments

Comments

@ec1oud
Copy link

ec1oud commented Nov 11, 2018

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)

@zbanks
Copy link
Owner

zbanks commented Nov 11, 2018

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 ?

@ec1oud
Copy link
Author

ec1oud commented Nov 11, 2018

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?

@ervanalb
Copy link
Collaborator

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

@ec1oud
Copy link
Author

ec1oud commented Nov 12, 2018

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?

@ervanalb
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants