Issue with RecordingDevice [RESOLVED]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
dcuny
Prole
Posts: 3
Joined: Wed Aug 04, 2021 1:19 am

Issue with RecordingDevice [RESOLVED]

Post by dcuny »

I've set up the microphone for recording with these settings:

Code: Select all

-- choose the first recording device
local rdList = love.audio.getRecordingDevices()  
local rdIndex = 1
local rd = rdList[rdIndex]

-- audio settings
local SAMPLE_RATE = 44100
local BIT_DEPTH = 16
local CHANNEL_COUNT = 1
local BUFFER_SIZE = SAMPLE_RATE * 2

-- start recording
rd:start( BUFFER_SIZE, SAMPLE_RATE, BIT_DEPTH, CHANNEL_COUNT )
The output is coming out shrill and buzzy, and doesn't reflect the what the microphone sounds like in other applications. It doesn't sound like 16-bit audio.

When I look at the results in an FFT, the frequency only goes up to about 5850 Hz according to Praat. So the sampling rate isn't anything close to the requested 44100 samples/second. :huh:

I've tried this with multiple microphones, and on multiple Win10 machines, using Love 11.3.0. The results are the same.

I haven't had this kind of problem with the playback devices, so I'm wondering if this is a known limitation with using microphones with Love's audio library on Windows, or if perhaps there's something I've gotten wrong.

Thanks!
Last edited by dcuny on Thu Aug 05, 2021 7:00 am, edited 1 time in total.
dcuny
Prole
Posts: 3
Joined: Wed Aug 04, 2021 1:19 am

Re: Issue with RecordingDevice

Post by dcuny »

The issue was there was a mismatch between the sampling rate of the microphone.

Windows had set it to the default quality of 48000 Hz, which didn't match the 44100 value I'd used in the code.

Although OpenAL didn't throw an error, it didn't work properly , either. :|

I've run across this with other audio programs as well, which is how I eventually remembered about it.

While changing the sampling rate to 48000 would have taken care of the problem, I want to work with audio at the CD quality sampling rate, so that meant:

* Bringing up the Window Sound Control Panel;
* Choosing the "Recording" tab;
* Selecting the proper microphone;
* Choosing "Properties";
* Choosing the "Advanced" tab;
* Under "Default Format", choosing "1 channel, 16 bit, 44100 Hz (CD Quality)".

Of course, choosing the wrong value means potentially having your USB mouse lock up and having to reboot. Because, Windows.

On the plus side, it gave me a chance to look through the Love source code, and the OpenAL documentation, so... yay? :roll:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 45 guests