Microphone Support

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
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Microphone Support

Post by CanadianGamer »

I need some help with microphone support. I checked the forums and I discovered that it seems that there was a Lua library made to implement this, which was later committed to the core build. Unfortunately I couldn't find much documentation on how to use this input system. Any help would greatly appreciated.
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Microphone Support

Post by zorg »

Committed, yes; to 0.11, meaning it's not out yet. You have two choices;
Use lpghatguy's lib: https://github.com/LPGhatguy/love-microphone/
Or if you're using a nightly version of Löve, which already have this functionality, then you'll need to look into the source of it:
https://bitbucket.org/rude/love/src/cbe ... ce.cpp-134
https://bitbucket.org/rude/love/src/cbe ... io.cpp-507
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Microphone Support

Post by raidho36 »

You can't find documentation because it doesn't exist yet - it's impemented in minor branch, which means it's only coming when the next minor release is coming.

Code: Select all

local devices = love.audio.getRecordingDevices( )
local default = devices[ 1 ]
print ( default:getName ( ) )

local success = default:start( maxsamples, samplerate, bitdepth, channels )
assert ( success )

local source = love.audio.newQueueableSource ( samplerate, bitdepth, channels )

if default:isRecording ( ) and default:getSampleCount ( ) > minsamples then
	local recorded = default:getData ( )
	source:queue ( recorded )
end

if stop and default:isRecording ( ) then
	local lastrecorded = default:stop ( )
	source:queue ( lastrecorded )
end
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Microphone Support

Post by zorg »

raidho36 wrote: Mon May 08, 2017 9:19 pm

Code: Select all

if stop and default:isRecording ( ) then
	local lastrecorded = default:stop ( )
	source:queue ( lastrecorded )
	--> from here
end
You forgot the source:play() :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Microphone Support

Post by raidho36 »

If you look closely enough you'll also notice that there's no recording nor playback loop either, and there are number of constants that were never defined, and flag variables that never change, etc.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Microphone Support

Post by zorg »

I mean sure, but that can be alleviated and inferred easier imho... in any case, it doesn't matter that much.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

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