Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 7th, 2005, 4:41 PM   #1
timrochester
Newbie
 
Join Date: Sep 2005
Posts: 2
Rep Power: 0 timrochester is on a distinguished road
Audio Level

I am quite new to C programming, but have grasped the concept quite well and am interested in writing a function that can be used to run an audio level meter.

This function should return a number depending on the loudness of the input comming from the microphone on a laptop.

I scoured the internet, but cannot find a way of retrieving sound from the input for processing, i can record it but that doesnt help

Any ideas would be appreciated!

Thank you

timrochester is offline   Reply With Quote
Old Sep 7th, 2005, 7:45 PM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
If you can record it, then it becomes a matter of analyzing the data you're getting from the mic
__________________

tempest is offline   Reply With Quote
Old Sep 7th, 2005, 9:05 PM   #3
iignotus
Professional Programmer
 
iignotus's Avatar
 
Join Date: Apr 2005
Location: Nowhere Special
Posts: 466
Rep Power: 4 iignotus is on a distinguished road
Send a message via AIM to iignotus
Sounds like you need to investigate the Fourier Transform. It takes audio data and represents it as Hertz and Decibels.
http://en.wikipedia.org/wiki/Fast_Fourier_transform
http://mathworld.wolfram.com/FastFourierTransform.html
http://www.fftw.org/
http://astronomy.swin.edu.au/~pbourke/other/dft/
http://homepages.inf.ed.ac.uk/rbf/CV...LL/node20.html
http://en.wikipedia.org/wiki/Discrete_Fourier_transform
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[ 
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}
iignotus is offline   Reply With Quote
Old Sep 7th, 2005, 9:22 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
When you say you can record it, does that mean with your own software, or just with one of your existing apps?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Sep 10th, 2005, 6:13 PM   #5
timrochester
Newbie
 
Join Date: Sep 2005
Posts: 2
Rep Power: 0 timrochester is on a distinguished road
I apologise for it taking ages to reply to this, i thought i subscribed to this so i get e-mails when new posts are made

I have found bits and peices that can record the microphone input to a wav file, but not tried writing a program based on that information, as i have no idea how to intercept, or read back the information recorded.

I have read the fourier pages and it looks like its helpful, what i need now is some help writing the code to get the sample voltages from the microphone to variables in a program. I dont even know which API to use... Or if there is an alternative
timrochester is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC