|
Volume is how loud the sound is (a soft sound, like someone wispering, has low volume, a loud sound, like a fighter aircraft engine, has high volume.)
Frequency is the pitch or tone of a sound - a double bass plays notes which have a low frequency (a low cycle per second or Herz value) while a penny whistle plays notes which have a high frequency.
The frequency and the volume of a sound are not really related, although human perception does come into it.
The normal PC software volume control only controls volume, it does not affect frequency.
From your original question, I think you were trying to decide whether a sound was soft or loud, i.e. volume. My point was that you should be able to determine this in a simpler way than doing an FFT.
|
|
|
|
|
Let's say you have a block of audio data from the microphone (you could use the WaveIn functions - see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveform_functions.asp[^] .)
The data block has a number of characteristics which you specify, such as block length (50 or 100 milliseconds is reasonable), sampling rate (22 kHz should be OK), sample size (8 or 16 bit per sample), stereo or mono (microphone is probably mono.)
The general procedure I would follow would be:
Long SumOfSamples = 0
Long SumOfSquaredDifferences = 0
For count = 1 to numberSamplesInBlock
SumOfSamples += soundSample[count]
AverageSoundLevel = SumOfSamples / numberSamplesInBlock
For count = 1 to numberSamplesInBlock
ThisSampleDifference = sample[count] - AverageSoundLevel
SumOfSquaredDifferences += ThisSampleDifference * ThisSampleDifference
AverageDifference = SquareRoot(SumOfSquaredDifferences) / numberSamplesInBlock
If AverageDifference < softSoundThreshold
Display "The Sound Is Soft"
Else if AverageDifference > loudSoundThreshold
Display "The Sound Is Loud"
Else
Display "The Sound Is Between Soft And Loud Limits"
|
|
|
|
|
I need a virtual drive in ram , not in hard disk .
plz help me.
|
|
|
|
|
I saw like your question in another sites
and they want to create or lock virtual ram
can you be more specific.
|
|
|
|
|
I need a software , a example , a prescription ,the last word a way to create a virtual drive in ram , for example to create a file on it like other drives and adress it like "E:\" .
if you know anything like that please tell me .
tank you
|
|
|
|
|
This[^] is one tool that I found. I haven't used it though.
You can google with the term RamDisk to get some specific hits.
Nibu thomas
Software Developer
|
|
|
|
|
thanks a lot , it was useful to me .
|
|
|
|
|
V_shr wrote: thanks a lot , it was useful to me
So! What are you upto...:smugging:;P
Nibu thomas
Software Developer
|
|
|
|
|
|
thanks but my problem already solved.
|
|
|
|
|
Hi,
My requirement is that I have to login to an SSO enabled Server from a dialog based application. Can anyone guide me? I serched the WEB but got nothing on it.
Thanks.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
I want to select a device without UI , I looked "selecting a device" in msdn and I know that it is what I need , but I cant understand what is it.
plz help me
|
|
|
|
|
What device are you talking about ??
Could you be more specific (a LOT more specific) ?
|
|
|
|
|
I need to choose 1 webcam from webcames connected to computer without UI.
|
|
|
|
|
These webcams are USB devices ? Do you have drivers provided with them ? Or what driver are you using.
What do you need to do to communicate with your webcam when only one is installed (using CreateFile to open the driver for example) ?
I will try to help you but I'm not sure at all I can provide you a solution.
|
|
|
|
|
the webcams connect with USB port , and their drivers are installed ,
I looked msdn an I found this :
Call "CoCreateInstance" to retrieve a pointer to the "IWiaDevMgr" interface.
Use the "IWiaDevMgr::EnumDeviceInfo" method of the "IWiaDevMgr" interface to obtain a pointer to the "IEnumWIA_DEV_INFO" interface.
Use "IEnumWIA_DEV_INFO" interface to obtain "IWiaPropertyStorage" interface pointers for each WIA device enumerated.
Use "IWiaPropertyStorage" interface to inspect the device information properties of each device and save the "WIA_DIP_DEV_ID" property from the desired device.
Use the "DeviceID" property with the "IWiaDevMgr::CreateDevice" method in the "IWiaDevMgr" interface to create a WIA device object. The "IWiaDevMgr::CreateDevice method" provides the application with the pointer to the IWiaItem interface of the root item of the specified device.
example for create a device :
HRESULT CreateWiaDevice( IWiaDevMgr *pWiaDevMgr, BSTR bstrDeviceID, IWiaItem **ppWiaDevice )
{
if (NULL == pWiaDevMgr || NULL == bstrDeviceID || NULL == ppWiaDevice)
{
return E_INVALIDARG;
}
*ppWiaDevice = NULL;
HRESULT hr = pWiaDevMgr->CreateDevice( bstrDeviceID, ppWiaDevice );
return hr;
}
I know that this is what I need , but I cant understand it .
plz help me
|
|
|
|
|
|
// Activate (with the Default/first device)
SelCapDrvProc(hwndMain,WM_COMMAND,SELCAPDRVDLG_BUTTON,0);
and this actives the default (first) camera and I want to change the default .
|
|
|
|
|
From google it looks like you are making reference to some code in some project available on Planet Source Code?
Edit: I've found the source from Planet Source Code. It uses Video For Windows, so I'm not sure what your previous post was about.
For reference the source is located at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2679&lngWId=3[^]
You would like to use this and just change it to use a particular webcam? You could just modify EnumCapDrv and only add that particular webcam to the listbox. The code for the project in general looks like it could be a little buggy, but I think it already demonstrates everything you want to know? Like getting devices using capGetDriverDescription()?
-- modified at 5:34 Thursday 4th May, 2006
|
|
|
|
|
|
Looks like it's based on the project that I found. Look at the edited post above this one for comments. As I mentioned earlier look at EnumCapDrv, it calls capGetDriverDescription() to get devices.
From looking at the API again though, my initial idea is wrong. Looks like you specify the device from the index.
for (i=0; i<10; i++)
{
if(capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName),
szDeviceVersion, sizeof(szDeviceVersion)) )
{
if(strcmp(szDeviceName, "MyDeviceName") == 0)
{
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, i, 0L);
}
}
}
Anyway i think the code is a bit buggy.
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, sel);
Shouldn't it be
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, &sel);
Actually I think he should have just used a single selection listbox and use the LB_GETCURSEL message to get the current selection. Anyway, if it happens that your problem was that you couldn't select anything other than the first device, then this might be the reason.
-- modified at 5:26 Thursday 4th May, 2006
|
|
|
|
|
I looked my code , it was the correct one . and my problem isn't that I change the default device but it doesn't change , my problem is that I dont know how to change that .
|
|
|
|
|
Reread my previous posts (I might have modified them after you read them) and tell me which part you don't understand.
What do you mean by "your code was the correct one"?
Setting the device just involves setting the index 'i' in the WM_CAP_DRIVE_CONNECT message.
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, i, 0L); http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_wm_cap_driver_connect.asp[^]
As I said before use capGetDriverDescription() to figure out which index your device corresponds to.
-- modified at 6:21 Thursday 4th May, 2006
|
|
|
|
|
I cant find similarity of our sources , and when you refer to somthing in code I cant find where you are saying . and because I didn't work on devices befor this I cant guess what are you saying. can you say it simpler ?
thank you
|
|
|
|
|
More like working with Video For Windows API in this case. Devices is too generic a term. In fact most people do this using DirectShow instead of VFW these days.
My suggestion to how to get the device index that you want.
for (i=0; i<10; i++)
{
if(capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName), szDeviceVersion, sizeof(szDeviceVersion)) )
{
if(strcmp(szDeviceName, "MyDeviceName") == 0)
{
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, i, 0L);
break;
}
}
}
Look at this to see how he enumerates the Video For Windows devices
main.cpp: Line 185
int TForm1::EnumCapDrv()
main.cpp: Line 118
SendMessage( hwndVideo, WM_CAP_DRIVER_CONNECT, sel, 0L);
main.cpp: Line 115
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, sel);
Should be
SendMessage( hwndSelCapDrvDlg_LBox, LB_GETSELITEMS, 1, &sel);
Or it will only set the device to index 0, as sel was initialised to 0.
|
|
|
|