08-23-2017 03:04 PM
Hi!
I been trying to get information about an audio file like Duration, size, format, Bit Rate, etc.
I been trying using Shell32.dll in different languages like C#, C++, Visual basic, etc. and of course LabView.
do anybody have an Idea?
I search inside the forum for a possible sample but no luck.
Thank you guys.
08-23-2017 03:20 PM
Hi Luis,
I been trying using Shell32.dll in different languages like C#, C++, Visual basic, etc.
What have you tried so far? Had any luck with those languages?
and of course LabView. do anybody have an Idea?
You may load WAV files using the Sound file functions. Then you can determine duration from sample rate and sample count…
08-23-2017 03:33 PM - edited 08-23-2017 03:35 PM
Every sound file format has... well... a different format!!! I believe most (all?) sound files have a header at the beginning describing everything you just mentioned - and probably a lot more stuff than you'll ever want to know about it. These headers are mostly (all?) in plain text so you should be able to make a parser for whatever sound files you want to parse. Click here for more info. (Hey, you were just about to ask me where you could find all this info, right?)
08-23-2017 03:42 PM
Following GerdW's suggestion, I can tell you that on my Windows 10 PC, the Windows Startup .WAV file has 9584 samples per channel, sampled at 44100 samples/sec for 2 channels and 16 bits/sample. If we assume most of the file is data, 2 channels * 2 bytes/sample * 9584 samples = 38,168 bytes -- Windows reports the file size as 38,380, pretty close (there is probably embedded meta-data). But LabVIEW can definitely get you the data files, the number of channels, the data format, and the sampling rate, all you should need.
Go try it out!
Bob Schor
08-23-2017 03:54 PM
Thanks everybody.
1.- I tried using LabView and other languages, but no luck in any.
2.- we normally have many different formats (MP3, WAV, etc), and every format have different characteristics of Bit Rate, duration size, etc.
3.- I tried to use the "Headers" information inside very file, but can't fine the header.
I need that information to use it inside a database, and the user can choose any audio file in any format.
08-23-2017 04:05 PM
Hi Luis,
you can try to use tools from some packages like ffdshow/FFmpeg. I would start with ffprobe…
08-23-2017 04:07 PM - edited 08-23-2017 04:09 PM
Now you've done it - you've made me go and look the stuff up. 😉
Seems like, at least for mp3 files, the file is broken up into frames and each frame has a header. (This explains why many mp3 players keep a running dialog that has all those audio parameters. I thought they calculated it on the fly. I guess they just read the headers and display the information. What a letdown.)
What you will have to do for each mp3 file is parse all the frames, get all the headers, then decide what to do with them. I think usually all the frame information is averaged over all the headers. It shouldn't be very difficult. Read the file, look for headers on the fly. Parse them out as you find them. Do something with them once you've parsed them all.
You might then consider writing an ID3 tag and prefixing the file with it.
08-28-2017 12:45 PM
Some code for parsing the ID3v1 tags can be found on LAVA.
https://lavag.org/files/file/44-mp3-id3v1-tags/
As for V2 (more common) you'll likely need a DLL, or a very deep understanding of the format. I'd also recommend looking into command line calls to something like VLC.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord