Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / sound recognition

Author
Message
047
20
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 8th Jan 2015 09:07
Anyone has any idea on how to get DBP to recognize noise or sound from the microphone? I thought about using the "record sound" command but I'm not sure there's any way that could actually work. Any suggestions?
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th Jan 2015 10:57
It appears you will have to perform it manually, first calling Record Sound and specifying Sound number and a length [You can possibly map that to the length of the trigger, say a key press] and then call Stop Recording Sound

I am not sure it would be wise or possible to trigger recording unless you used the sound wave snippet found in Dark Source

It allows you to read the data from a sound file, say a .wav file...

So what you could do is perform a time based recording to create a sample, say 5 seconds at a time, save it to a file, open it, read the data, see if it spikes anywhere in the data, then begin recording for a fixed or extended period of time...

If you can detail what you want to do a bit more, someone may have what you are looking for...



Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 9th Jan 2015 02:59
One way would be to go a bit deeper and create a DLL using the windows mixer API. If I remember correctly, the lines all have ids and the mixer has peak meters. If you query the meter values or the volume levels themselves, you can return this value. I imagine through the mixer control you could monitor the record in from the MIC. I haven't messed with that stuff in many years but I think it's all in the WINMM but it might be something new in the more modern windows OS. You'd use the functions in that library to write your own DLL for use with DBPro.

Enjoy your day.
047
20
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 9th Jan 2015 05:17
What I was trying to create was my own PC version of a smartphone app I have that I use as a boxing training aid. The app calls random punching combinations that I perform on my punching bag. And what I intended to do in my version was to add the ability for the computer to detect when the bag has been hit, by attaching a microphone to the bag so the computer can register the hit by the noise the bag makes when punched.
I'll keep thinking to see if I can come up with a different approach.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th Jan 2015 07:09 Edited at: 9th Jan 2015 07:10


View here:

http://betaforum.thegamecreators.com/?m=forum_view&t=213211&b=1&msg=2546883#m2546883

I would share the code with you but I bought it with Dark Source, so makes no sense for me to just give it out... Sorry...

In the video I used a music file but you can actually playback the recorded sound file, however you can also randomise the payback of other sound clips equally...

One problem I found was... the speakers and microphone must never be in range otherwise you will get the stutter you can hear as a remix at the beginning of the video and through it in some parts [My music file was 7 seconds long...

It does make a sweet basic remix agent

Login to post a reply

Server time is: 2026-07-05 03:51:16
Your offset time is: 2026-07-05 03:51:16