Closed shalinsirwani closed 1 month ago
Your code contains:
inputParameters.device = Pa_GetDefaultInputDevice();
…
inputParameters.hostApiSpecificStreamInfo = &wasapiInfo;
Unless you messed around with PortAudio host API build options, the default input device will not be a WASAPI device. It will be an MME device.
You cannot use a WASAPI stream info struct with a non-WASAPI device, hence the "Incompatible host API specific stream info" error.
If you want to pick the default WASAPI input device, set the device index to Pa_GetHostApiInfo(Pa_HostApiTypeIdToHostApiIndex(paWASAPI))->defaultInputDevice
.
After applying
Pa_GetHostApiInfo(Pa_HostApiTypeIdToHostApiIndex(paWASAPI))->defaultInputDevice
I am getting error : - WASAPI ERROR PAERROR: -9997 : Invalid sample rate
That's a completely different issue that could have any number of causes. I would start with trying a more standard sample rate (such as 44100 or 48000), a more typical channel count (2) and without passing any WASAPI stream info at first. Then once you get a setup that works, you can add options back until you find the one that's causing problems.
Got it. But is there any way to start recording with following options : - 1) sample rate 16k 2) channel 1 3) speech mode 4) frame per buffer 320 5) wasapi mode
Not a bug.
(Please use the mailing list for support requests and general discussion. This is only for actual bugs.)
Describe the bug Error [-9984] Incompatible host API specific stream info, while passing PaWasapiStreamInfo to hostApiSpecificStreamInfo.
To Reproduce Steps to reproduce the behavior. Include code if applicable. 1.
Expected behavior A clear and concise description of what you expected to happen. => I was expecting it should start recording without any error
Actual behavior What actually happened. Include a recording if helpful. Error messages or logs longer than a page should be attached as a .txt file.
=> Getting error -9984 (Incompatible host API specific stream info)
Desktop (please complete the following information):
Additional context Add any other context about the problem here. NA
Note: PortAudio is a community supported project. If you have a solution, please create a Pull Request for us to consider.