hello everyone and happy new year to one and all!!. hope everyone had a very wondeful holiday filled with joy,happiness and wishing more positive happenings in this year.
i worked on a small bit of code late last year which involved working with some audio data where i had to do some bit syntax and bit manipulation to get the various metadata and parts of an audio file either over the network being streamed or a file on disk
Erlang and erlang related languages(Elixir,Lfe,Luerl) have this short and nifty way of unpacking this data out and getting the various sections efficiently and also with a small bit of code it takes a little bit of getting used to but its very powerful none the less
|
|
this piece of code above will get all the metadata/pcm data about an mp3 file. the various sections can be integers,floats,text,binary which can be spliced out.
the endianess can be also put into the equation as seen above. I broke the code down for clarity sake but the part of the code for the dissassembly can be done in just 2 or 3 lines of code.pretty cool !!!. try putting this code in a file,compile and try it out.