| | |
audio level detection
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2005
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by AlanC
Larmit..
Please see the attached zipped VB6 project. The code is thoroughly commented so hopefully should be easy to use...
The pre-compiled exe was compiled on a Win98SE system and because of the nature of the API used (winmm.dll) you will need to compile it again if the target system is NT/W2000/XP.
If it doesn't run as expected, I can do a version for you with lots of diagnostics in so we can see at which point it is failing.
Don't forget that this works by putting the sound driver in record mode, so you'll need to set up the Windows audio recording mixer to actually give you an input..
Let me know how you get on.
Usual disclaimers apply about this developmental software...
Regards
Alan![]()
Any ideas?
Just as I was about to reply...
Glad you're sorted with the code... I thought about the mic gain problem though,
Check in Control Panel to see if you've got a setup utility for your sound card, or try enabling 'Advanced Controls' on the Windows recording mixer. A lot of modern cards have a '+20dB' box to check which gives you a 100x boost in mic sensitivity.
If this fails try another mic.
Hope this helps
Alan
Glad you're sorted with the code... I thought about the mic gain problem though,
Check in Control Panel to see if you've got a setup utility for your sound card, or try enabling 'Advanced Controls' on the Windows recording mixer. A lot of modern cards have a '+20dB' box to check which gives you a 100x boost in mic sensitivity.
If this fails try another mic.
Hope this helps
Alan
•
•
Join Date: Dec 2005
Posts: 7
Reputation:
Solved Threads: 0
hi,
i need a vu meter for video file playback.
i hope video file playback is controled by wave in/out.
can u pls. help me how to view the moving vu meter for video file playback, so that i can control wave slider in the audio mixer and control the sound level.
regards
soorya
soorya@vsnl.com
i need a vu meter for video file playback.
i hope video file playback is controled by wave in/out.
can u pls. help me how to view the moving vu meter for video file playback, so that i can control wave slider in the audio mixer and control the sound level.
regards
soorya
soorya@vsnl.com
Hi Soorya!
I did some work on this myself because I needed an 'automatic level control' for an mp3 based disco application I was writing, and wanted to to equalise the level at which different mp3 files played. As I understand it, audio/video- it makes no difference as far as the way the sound is handled is concerned.
As for the answer, here's a few pointers:
VU meters (in sound card terms) aren't a good idea as they aren't implemented in any standard way on different cards and some low end chip sets don't have them at all. With these, what you get is a 'snapshot' of the sample values at regularly repeating intervals. When this is displayed on a bar graph, the peak value the samples get to is visible by persistance of vision. This is really all the usual displays (like on the Windows mixer) do. However, it's neither a 'VU meter' in the true sense of the word nor a measurement you can export without some additional maths. The sound card VU meter gives a 16-bit number where 16383 is 'zero' and 0 and 32767 are positive and negative max. respectively. See what I mean?!
Incidentally, a true VU meter is logarithmic and has defined attack and decay times.
Controlling the volume sliders in the sound card is difficult. There is a lot of API programming and it's necessary to enumerate the sources, destinations, 'controls' and 'lines' in the sound card, and their names and capabilities, to sort out what is what.
The following link is to a VB5/6 project that is a vaulable development tool for anyone playing with audio, it enumerates and displays all of the facilities in the card.
http://www.shrinkwrapvb.com/mixer.htm
The good news is, once you've been through the grief of identifying the control you want to change, writing a new value to it (a 16 bit number between 0 and 32767) is easy enough.
Here's some pitfalls:
Some of the DirectX controls seem to bypass part of the sound card, or do their D/A conversion in a different way, so that VU meter on the wave out line doesn't work. An example of this is using msdxm.ocx to play an mp3.
I hope this helps. I might write a tutorial on using audio if I ever get time...
Regards, AlanC
I did some work on this myself because I needed an 'automatic level control' for an mp3 based disco application I was writing, and wanted to to equalise the level at which different mp3 files played. As I understand it, audio/video- it makes no difference as far as the way the sound is handled is concerned.
As for the answer, here's a few pointers:
VU meters (in sound card terms) aren't a good idea as they aren't implemented in any standard way on different cards and some low end chip sets don't have them at all. With these, what you get is a 'snapshot' of the sample values at regularly repeating intervals. When this is displayed on a bar graph, the peak value the samples get to is visible by persistance of vision. This is really all the usual displays (like on the Windows mixer) do. However, it's neither a 'VU meter' in the true sense of the word nor a measurement you can export without some additional maths. The sound card VU meter gives a 16-bit number where 16383 is 'zero' and 0 and 32767 are positive and negative max. respectively. See what I mean?!
Incidentally, a true VU meter is logarithmic and has defined attack and decay times.
Controlling the volume sliders in the sound card is difficult. There is a lot of API programming and it's necessary to enumerate the sources, destinations, 'controls' and 'lines' in the sound card, and their names and capabilities, to sort out what is what.
The following link is to a VB5/6 project that is a vaulable development tool for anyone playing with audio, it enumerates and displays all of the facilities in the card.
http://www.shrinkwrapvb.com/mixer.htm
The good news is, once you've been through the grief of identifying the control you want to change, writing a new value to it (a 16 bit number between 0 and 32767) is easy enough.
Here's some pitfalls:
Some of the DirectX controls seem to bypass part of the sound card, or do their D/A conversion in a different way, so that VU meter on the wave out line doesn't work. An example of this is using msdxm.ocx to play an mp3.
I hope this helps. I might write a tutorial on using audio if I ever get time...
Regards, AlanC
•
•
Join Date: Dec 2005
Posts: 7
Reputation:
Solved Threads: 0
Thanks a lot AlanC,
I agree what u say...
but i have seen DXVU Meter activeX written in VB6 works really great. It has more fetaures than i wanted.
I generally don't use third party tool in my application.
so i prefer writting my own control.
but i could'nt find any sample code to make VU meter by using DirectX.
if u come across any sample, pls. let me know.
Thanks again for the time you have spent for me.
soorya
soorya@vsnl.com
I agree what u say...
but i have seen DXVU Meter activeX written in VB6 works really great. It has more fetaures than i wanted.
I generally don't use third party tool in my application.
so i prefer writting my own control.
but i could'nt find any sample code to make VU meter by using DirectX.
if u come across any sample, pls. let me know.
Thanks again for the time you have spent for me.
soorya
soorya@vsnl.com
•
•
•
•
Originally Posted by AlanC
Hi Soorya!
I did some work on this myself because I needed an 'automatic level control' for an mp3 based disco application I was writing, and wanted to to equalise the level at which different mp3 files played. As I understand it, audio/video- it makes no difference as far as the way the sound is handled is concerned.
As for the answer, here's a few pointers:
VU meters (in sound card terms) aren't a good idea as they aren't implemented in any standard way on different cards and some low end chip sets don't have them at all. With these, what you get is a 'snapshot' of the sample values at regularly repeating intervals. When this is displayed on a bar graph, the peak value the samples get to is visible by persistance of vision. This is really all the usual displays (like on the Windows mixer) do. However, it's neither a 'VU meter' in the true sense of the word nor a measurement you can export without some additional maths. The sound card VU meter gives a 16-bit number where 16383 is 'zero' and 0 and 32767 are positive and negative max. respectively. See what I mean?!
Incidentally, a true VU meter is logarithmic and has defined attack and decay times.
Controlling the volume sliders in the sound card is difficult. There is a lot of API programming and it's necessary to enumerate the sources, destinations, 'controls' and 'lines' in the sound card, and their names and capabilities, to sort out what is what.
The following link is to a VB5/6 project that is a vaulable development tool for anyone playing with audio, it enumerates and displays all of the facilities in the card.
http://www.shrinkwrapvb.com/mixer.htm
The good news is, once you've been through the grief of identifying the control you want to change, writing a new value to it (a 16 bit number between 0 and 32767) is easy enough.
Here's some pitfalls:
Some of the DirectX controls seem to bypass part of the sound card, or do their D/A conversion in a different way, so that VU meter on the wave out line doesn't work. An example of this is using msdxm.ocx to play an mp3.
I hope this helps. I might write a tutorial on using audio if I ever get time...
Regards, AlanC
Soorya,
Please try the project attached below. It's a VU meter using the principle I worked on for level detection, i.e. it puts the sound card in record, grabs samples, and measures them. Its all VB6 with no 3rd party controls.
This works even using DirectX components for play, but will only work if your sound card's full duplex (most are now aren't they?) You'll need to select 'wave' on your recording mixer as the source.
This is a first stab attempt and I roughly calibrated it to 0dB full scale with a given level setting but it'll depend on your system. Attack/decay timing will depend on the speed of your computer. As it's logarithmic even tiny signals and any noise or offset will give a slight reading with no sound.
I also have a tone generator app for calibrating such things if you need it.
Take care and have a good Christmas.
AlanC
Please try the project attached below. It's a VU meter using the principle I worked on for level detection, i.e. it puts the sound card in record, grabs samples, and measures them. Its all VB6 with no 3rd party controls.
This works even using DirectX components for play, but will only work if your sound card's full duplex (most are now aren't they?) You'll need to select 'wave' on your recording mixer as the source.
This is a first stab attempt and I roughly calibrated it to 0dB full scale with a given level setting but it'll depend on your system. Attack/decay timing will depend on the speed of your computer. As it's logarithmic even tiny signals and any noise or offset will give a slight reading with no sound.
I also have a tone generator app for calibrating such things if you need it.
Take care and have a good Christmas.
AlanC
•
•
Join Date: Dec 2005
Posts: 7
Reputation:
Solved Threads: 0
Thanks a miilion !
I got the code and tried...
It is not working in my PC.
always the level seems 20% flat, even without any signal.
(Sound card device is detected correctly)
when I play video file/wave audio file, no difference at all...
I tried adjusting wave mixer control level....
I am not sure about my sound card, it is built-in sound card with Intel P4 Mother Board.
i can't suspect ur great coding... u might have checked it in ur system. i think some small trick is needed to make it working perfect with all system.
DXVU Meter ActiveX and AC3 DS Filter VU meter works fine with my system. so i can't doubt my sound card also.
pls. spend some more time to fix this issue.
Again my hearties Thanks for ur interest on my need.
regards
soorya
I got the code and tried...
It is not working in my PC.
always the level seems 20% flat, even without any signal.
(Sound card device is detected correctly)
when I play video file/wave audio file, no difference at all...
I tried adjusting wave mixer control level....
I am not sure about my sound card, it is built-in sound card with Intel P4 Mother Board.
i can't suspect ur great coding... u might have checked it in ur system. i think some small trick is needed to make it working perfect with all system.
DXVU Meter ActiveX and AC3 DS Filter VU meter works fine with my system. so i can't doubt my sound card also.
pls. spend some more time to fix this issue.
Again my hearties Thanks for ur interest on my need.
regards
soorya
•
•
•
•
Originally Posted by AlanC
Soorya,
Please try the project attached below. It's a VU meter using the principle I worked on for level detection, i.e. it puts the sound card in record, grabs samples, and measures them. Its all VB6 with no 3rd party controls.
This works even using DirectX components for play, but will only work if your sound card's full duplex (most are now aren't they?) You'll need to select 'wave' on your recording mixer as the source.
This is a first stab attempt and I roughly calibrated it to 0dB full scale with a given level setting but it'll depend on your system. Attack/decay timing will depend on the speed of your computer. As it's logarithmic even tiny signals and any noise or offset will give a slight reading with no sound.
I also have a tone generator app for calibrating such things if you need it.
Take care and have a good Christmas.
AlanC
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Sort a dynamic array of structs
- Next Thread: build help system...
Views: 24071 | Replies: 32
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 2007 access activex add age append application basic beginner birth bmp c++ calculator cd click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows




