Microphone Functions

Learn to use DS Game Maker by Example.

Microphone Functions

Postby JanMulder » August 6th, 2011, 7:57 pm

Hey all,

I recently received a PM in which someone requested me to release my Microphone functions. Honestly, I myself almost forgot that I made them. I made them once for a "new library" James was going to make. It never came and I almost forgot about the file.

JansMicLib.c
include via Tools>>Game Settings>>Coding
(2.1 KiB) Downloaded 488 times


It's really easy.

Just make sure this function
Code: Select all
UseMicrophone();

runs every frame.
So put paste it in an Execute Code action and put it in a step event of an object.

After you did that you can use these functions as variables:
GetMicVolume()
BlowingInMic()
ClappedInMic()
GetMicFrequency()

I didn't add support for recording something even though it is possible. It costs way too much memory.

GetMicVolume() returns the volume of the microphone (0 to 127).
BlowingInMic() returns 'true' when someone blows in the microphone else it returns 'false' of course.
ClappedInMic() returns 'true' when someone claps in front of the microphone else it returns 'false'.
GetMicFrequency() returns the frequency of the sound that is recorded by the microphone (in Hz).

Hope this helps.

Jan.
here and yet not here
JanMulder
 
Posts: 738
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby nicklausw » August 8th, 2011, 11:03 pm

This is awesome. I looked at it to see what coding people use for this, ad it's great!
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

Re: Microphone Functions

Postby JanMulder » August 13th, 2011, 9:36 pm

That won't work anymore if you use the UseMicrophone() function.
here and yet not here
JanMulder
 
Posts: 738
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby JanMulder » August 14th, 2011, 10:45 am

No it won't. You don't understand.
here and yet not here
JanMulder
 
Posts: 738
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby aekara » August 14th, 2011, 8:51 pm

i think i may use it so what do i have to do with the GetMicVolume() ???
Working on something big!

My web site here.
aekara
 
Posts: 690
Joined: July 12th, 2011, 1:24 pm
Location: Earth

Re: Microphone Functions

Postby aekara » August 15th, 2011, 9:26 am

and what does this variable does? do i have to set it? or i can just view it?
Working on something big!

My web site here.
aekara
 
Posts: 690
Joined: July 12th, 2011, 1:24 pm
Location: Earth

Re: Microphone Functions

Postby JanMulder » August 15th, 2011, 10:52 am

Just view it. And you can do stuff like this:
If GetMicVolume() > 100
Start Block
//do something
End Block
here and yet not here
JanMulder
 
Posts: 738
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby aekara » August 15th, 2011, 2:18 pm

ok i know how to use the other variables so i am going to test it out
Working on something big!

My web site here.
aekara
 
Posts: 690
Joined: July 12th, 2011, 1:24 pm
Location: Earth

Re: Microphone Functions

Postby snivy1999 » June 28th, 2012, 7:10 pm

aekara wrote:ok i know how to use the other variables so i am going to test it out

how?
can you upload it?
or send to snivy1999@gmail.com?
snivy1999
 
Posts: 27
Joined: May 28th, 2012, 4:19 pm

Re: Microphone Functions

Postby Nobody » June 29th, 2012, 2:26 am

a variable just holds a value. So to use GetMicVolume(), simply use it as a variable. Technically it's a function, but it returns a value which when then can use. So we can use it anywhere values are used such as operations, outputs, and calculations.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: Microphone Functions

Postby snivy1999 » July 1st, 2012, 4:58 pm

JanMulder wrote:Hey all,

I recently received a PM in which someone requested me to release my Microphone functions. Honestly, I myself almost forgot that I made them. I made them once for a "new library" James was going to make. It never came and I almost forgot about the file.

JansMicLib.c


It's really easy.

Just make sure this function
Code: Select all
UseMicrophone();

runs every frame.
So put paste it in an Execute Code action and put it in a step event of an object.

After you did that you can use these functions as variables:
GetMicVolume()
BlowingInMic()
ClappedInMic()
GetMicFrequency()

I didn't add support for recording something even though it is possible. It costs way too much memory.

GetMicVolume() returns the volume of the microphone (0 to 127).
BlowingInMic() returns 'true' when someone blows in the microphone else it returns 'false' of course.
ClappedInMic() returns 'true' when someone claps in front of the microphone else it returns 'false'.
GetMicFrequency() returns the frequency of the sound that is recorded by the microphone (in Hz).

Hope this helps.

Jan.

what do you do with these? it isent very clear.
After you did that you can use these functions as variables:
GetMicVolume()
BlowingInMic()
ClappedInMic()
GetMicFrequency()
snivy1999
 
Posts: 27
Joined: May 28th, 2012, 4:19 pm

Re: Microphone Functions

Postby Nobody » July 1st, 2012, 6:13 pm

you use them just like any variable. You can use them as conditions statements and ways to have interactive user support. Like let's say i made a game that would blow up a balloon if you are blowing into the microphone. I could use BlowinginMic() to do this, ex:

If BlowinginMic() == true
start block
create ballon
end block
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: Microphone Functions

Postby colt05 » August 5th, 2014, 2:03 pm

JanMulder this is not ur fault but like every other file, its DOWN!111!! :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: Crys 50 more times
Where's my signature?

Spoiler: show
In Pokémon X and Y, while the ultimate weapon is present in Geosenge Town, a Team Flare Grunt in front of a house in the west of the town comments "Only Team Flare's stayin' alive, stayin' alive.", referencing the Bee Gees song Stayin' Alive.
http://bulbapedia.bulbagarden.net/wiki/ ... k%C3%A9mon

Spoiler: show
Try to be insane to out sane the sane.
Or try to make games for an hour.
colt05
 
Posts: 122
Joined: July 16th, 2014, 4:39 pm
Location: In the computer

Re: Microphone Functions

Postby BLsquared » August 5th, 2014, 3:14 pm

May I request that you calm down? This forum is mostly dead, so be careful going around grave-digging.
Thank you,
BLsquared.
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron