record audio

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
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

record audio

Post by jack0088 »

Hey guys I have been exploring the audio API and found something about recording from microphone here: https://bitbucket.org/rude/love/src/37e ... ew-default

but frankly the API seems to be not exposed. Any ideas if that is complete and how can be used?
User avatar
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

Re: record audio

Post by jack0088 »

oh, sorry. found out myself. its deactivated.

Code: Select all

// List of functions to wrap.
static const luaL_Reg functions[] =
{
	{ "getSourceCount", w_getSourceCount },
	{ "newSource", w_newSource },
	{ "play", w_play },
	{ "stop", w_stop },
	{ "pause", w_pause },
	{ "resume", w_resume },
	{ "rewind", w_rewind },
	{ "setVolume", w_setVolume },
	{ "getVolume", w_getVolume },
	{ "setPosition", w_setPosition },
	{ "getPosition", w_getPosition },
	{ "setOrientation", w_setOrientation },
	{ "getOrientation", w_getOrientation },
	{ "setVelocity", w_setVelocity },
	{ "getVelocity", w_getVelocity },
	{ "setDopplerScale", w_setDopplerScale },
	{ "getDopplerScale", w_getDopplerScale },
	
	/*{ "record", w_record },
	{ "getRecordedData", w_getRecordedData },
	{ "stopRecording", w_stopRecording },*/
	
	{ "setDistanceModel", w_setDistanceModel },
	{ "getDistanceModel", w_getDistanceModel },
	{ "setMixMode", w_setMixMode },
	{ 0, 0 }
};
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: record audio

Post by zorg »

jack0088 wrote: Fri Nov 10, 2017 4:48 pm oh, sorry. found out myself. its deactivated.
To be more precise, if you look into the minor branch, you can see a fully functioning API there; Audio recording and queueable sources, along with effect objects and tons of other things will come with the next version, 0.11, which will be released sometime in the future.
(You can already try it out by getting the nightly builds)
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
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

Re: record audio

Post by jack0088 »

I didn't notice this branch. thank you for clarifying :)
incognito_mage
Prole
Posts: 15
Joined: Mon Nov 06, 2017 12:38 pm

Re: record audio

Post by incognito_mage »

Still no latency reporting, or did I miss it? ._.
What's this? What's this? There's violas everywhere!
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: record audio

Post by zorg »

incognito_mage wrote: Fri Nov 10, 2017 5:35 pm Still no latency reporting, or did I miss it? ._.
Depends on what you mean.
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.
incognito_mage
Prole
Posts: 15
Joined: Mon Nov 06, 2017 12:38 pm

Re: record audio

Post by incognito_mage »

When making a rhythm game, you need to know exactly how many samples of delay there are from when you start playing music and when that music is played on a speaker. if the player presses a key at t = 1.123, and the music is at t = 1.223, that might be a good or a perfect hit depending on exactly what the latency is.

In this particular case, the latency to the audio interface for a particular sound should be enough, even though the best thing for audio-focused games (or audio applications) would be to have an actual audio callback where you can fill the buffer with all your audio data yourself.
What's this? What's this? There's violas everywhere!
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: record audio

Post by zorg »

incognito_mage wrote: Sat Nov 11, 2017 11:26 am When making a rhythm game, you need to know exactly how many samples of delay there are from when you start playing music and when that music is played on a speaker. if the player presses a key at t = 1.123, and the music is at t = 1.223, that might be a good or a perfect hit depending on exactly what the latency is.
Usually, those games allow you to change the timings so the graphics can be spot-on with the system's added audio latencies.
incognito_mage wrote: Sat Nov 11, 2017 11:26 amIn this particular case, the latency to the audio interface for a particular sound should be enough, even though the best thing for audio-focused games (or audio applications) would be to have an actual audio callback where you can fill the buffer with all your audio data yourself.
Queueable sources say hi; consult with the minor branch in bitbucket, or download a nightly release since they're a 0.11 feature yet to be released officially.

You fill those with your own callback, so you can have samplepoint-accurate timing (on the lua-side anyway; the Audio driver will most likely add a bit of latency too, but not much)

The size of the SoundData you use as buffer will of course determine the "lua-side" latency. (including the sample/sampling rate as well)
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
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: record audio

Post by Sulunia »

incognito_mage wrote: Sat Nov 11, 2017 11:26 am When making a rhythm game, you need to know exactly how many samples of delay there are from when you start playing music and when that music is played on a speaker. if the player presses a key at t = 1.123, and the music is at t = 1.223, that might be a good or a perfect hit depending on exactly what the latency is.

In this particular case, the latency to the audio interface for a particular sound should be enough, even though the best thing for audio-focused games (or audio applications) would be to have an actual audio callback where you can fill the buffer with all your audio data yourself.

Coming from someone who developed a rhythm game on Love, I'd say you're looking preeeetty far down the system, and you probably don't need all this to sync game and music. :monocle:

Using love's Source:tell("seconds")*1000 is probably more than enough for all your needs.
Simply update your logic according to the Tell function result.
After that's done, you may want to look into timer interpolation, so you avoid things being jittery on systems with higher latencies, such as Android, for example.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests