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 183 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: 728
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby Mint » 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!
ATTENTION ALL BRONIES!
You can't take over the DSGM forum. So don't try.
You're welcome here but we all don't have to know you like My Little Pony.

Woot, me gots da Obj-C'z on ma windows ocho-huit-eight!!!
User avatar
Mint
 
Posts: 969
Joined: May 23rd, 2011, 10:25 pm
Location: Liberty City, USA

Re: Microphone Functions

Postby YoshiInAVoid » August 13th, 2011, 4:38 pm

Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

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: 728
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby YoshiInAVoid » August 14th, 2011, 8:59 am

OK.

I'm too lazy to find a fix but if you re-name the functions from PA_... to whatever you call them and do a bit of testing then it should work.
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

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: 728
Joined: December 30th, 2010, 3:08 pm

Re: Microphone Functions

Postby YoshiInAVoid » August 14th, 2011, 5:37 pm

Ok.
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

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: 693
Joined: July 12th, 2011, 1:24 pm
Location: Earth

Re: Microphone Functions

Postby YoshiInAVoid » August 14th, 2011, 11:12 pm

Use it as a variable.

EG:

Draw Variable GetMicVolume()
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

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: 693
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: 728
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: 693
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:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1980
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:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1980
Joined: February 14th, 2011, 12:08 am
Location: United States of America


Return to Tutorials & Examples

Who is online

Users browsing this forum: No registered users and 1 guest