Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

is it possible?

For general discussion related FlowStone

is it possible?

Postby Jay » Sun Dec 15, 2013 12:54 pm

Hi all

Is it possible to in some way, too get the lengh of an mp3 file in samples? like we can with the wave prims? the reason i ask this is, on the audiostreamin prim the output of Play position info is never ever correct on any of my 8 machines! it always gives out random results such as - 18% when a track has acctualy played all the way through!

i am trying to get an output of 1 trigger everytime a song has ended, tried lots of ways to do this but have failed so far!

can anyone help?

cheers!
Jay
 
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: is it possible?

Postby tester » Sun Dec 15, 2013 1:27 pm

As far I remember, mp3 files are "measured" in frames. A "frame" here is a smallest portion of audio, that is being processed by the mp3 algo. Check here:

http://en.wikipedia.org/wiki/MP3

I suspect, that you could follow frames with some sort of ruby algo. Otherwise - you have to decode mp3 partials to wave somewhere virtually (buffer), and then you can measure samples.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: is it possible?

Postby trogluddite » Sun Dec 15, 2013 3:20 pm

Are your mp3's variable bit-rate by any chance?

My guess is that the length measurement is wrong because it assumes a constant bit-rate mp3 - i.e. it is lazy and only checks the header for the first frame to get the bit-rate. For a variable-rate mp3 you would have to read every single frame header and arrive at a cumulative value for it to be accurate. VBR is the default for a lot of encoders, as it allows the best compromise between quality and compression for typical music files.
The first frame of most tracks would be pretty much silence at the start of the fade-in, so a variable bit-rate file would encode that at a very low bit-rate indeed, massively throwing out the size measurement for the more "detailed" frames that come along when the music kicks in.

Parsing the file format in Ruby would certainly be possible - though maybe not very quickly, as a long VBR track would have a lot of frames to scan through.
Would be interesting to study the format of the data blocks - "stored as frequency and amplitude data" it says on the Wiki; that sounds like it could be rather useful!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: is it possible?

Postby Jay » Sun Dec 15, 2013 5:07 pm

cheers for the info guys!

yup you are correct Trogg!" ive just converted some tracks into single bitrate files (256kbp) and everything works now! still ,its useless to use in a product though!

"hey here is my free app! you just have to re-encode and degrade all of your mp3's to use it" :twisted:

maybe that is something that could be fixed out with the new dll thing! although i cant understand why this has not been addressed by the devs! so it's just like the haar cascade primitive that does not understand haar files :? (been waiting what? 2 years for that to get fixed lol)

in the meantime we have synthedit ;)

regards
Jay
 
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: is it possible?

Postby tester » Sun Dec 15, 2013 6:04 pm

Maybe it can be done... in ruby? :D
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet


Return to General

Who is online

Users browsing this forum: No registered users and 88 guests