Ocaml libraries for mp3 editing? - mp3

In OCaml, is there any library to manipulate mp3 files editing (for ex. splitting, blank detection)? Yes, I see things should have been much easier in other languages.

Well, if you find a solution in C (should be easy enough) then you can interface it from Ocaml.

As Stéphane Gimenez mentioned, OCaml-lame from the liquidsoap project is probably what you are looking for.

Related

Beginner questions: how to use these obscure commands like 'RenderWindow' in C++

This is kind of a beginner question, so please let me know if this is appropriate for this website and if not, where else I should be asking this.
I've just gotten into the basics of C++ (pretty much what's being taught in this video from FreeCodeCamp: https://www.youtube.com/watch?v=vLnPwxZdW4Y). Obviously, not everything there is to know is discussed in this tutorial and I've been running into a couple of things in other demonstration vids that I don't quite get yet.
For example, this quick demonstration of how Tetris can be coded: https://www.youtube.com/watch?v=zH_omFPqMO4&t=0m25s) you can see him use the command 'RenderWindow', which apparently creates a new window the size of his choice (320*480 pixels in this case). This doesn't seem to be a standard function in C++, so I assume he somehow imported it. How can I do this myself? Does it have to with the file inclusions written at the top of the file (#include <SFML/Graphics.hpp>)? If so, how can I learn more about such files, where can I find them (is it anything like the Python Package Index, or interfaces in Java) and can I create them myself? Any general explanatory words on this?
Thanks in advance.
This doesn't seem to be a standard function in C++
That is correct. There are no functions for graphics nor window handling in C++.
so I assume he somehow imported it. How can I do this myself?
Usually, you would pick a library of your choice (there are many), or do it yourself by using whatever API your operating system provides.
Does it have to with the file inclusions written at the top of the file (#include <SFML/Graphics.hpp>)?
Yes, SFML is one of those libraries.
If so, how can I learn more about such files
You would go to the library's homepage and read the documentation.
where can I find them
Try searching the web for lists of libraries, articles, projects, etc.
is it anything like the Python Package Index
No, there is no standard one for C++. There are several package managers, build systems, etc. Popular libraries are in most of them and support one or more build systems.

Reading DNxHD MXF files using Objective-C and mxflib

I'm trying to read MXF files (from Avid) into an Objective-C project and analyze some frames from video. Preferably getting them into a CGImage or NSImage.
I've been exploring the mxflib, but find myself at a bit of a standstill. I'm used to the mechanics of the standard video methods within Obj-c, but this package is C++ and not exactly something I'm familiar with.
Does anyone have experience working with this library or another similar one? There's not much information available on the subject (at least not that I can understand). And I'm not quite sure where to begin.
Actually, I'd say you're looking at it from a not so good way, as the mxflib is prepared to handle standard MXF files, not really Avid ones.
In short, for this to work, you need to extend the library as per Avid specs (it can be done!) or go with AMT, for which I understand you need to engage Avid to have it.
Finally, I think you're stuck with C++! ;-)

Unzipping a directory in C++

I am creating a C++ program that will read a .docx's plain text. My plan of attack is to rename the .docx as a .zip and then unzip. I then will rename the .xml file containing the text of the document as a .txt and parse it out.
Right now I have figured out the renaming which was easy enough. I am now struggling with unzipping. I am very proficient in C++, but this is my first time I have been extending myself to real word applications and using it beyond the STL library.
At first I tried many wrappers for C++ from the zlib library, but have not been able to get any of them to compile or work properly (it may be due to environment being in Cygwin). For that reason it seems I have to default to using the messy zlib code to do this. But from all the documentation and examples I can find it only shows zlib being used to read a .zip that is a compression of one file not multiple files. I now don't know where to go from here and, like I said earlier, being completely new to the domain outside of STL I am feeling quite lost.
Any help or guidance is much appreciated!
Thanks,
Michael
I don't think zlib supports multi-file zips directly (could be wrong), so you may want to look for alternatives. As an aside, you might also want to consider switching from cygwin to MinGW, unless you really need the POSIX/UNIX compatibility that cygwin provides.
I've been dealing with a similar issue, but don't really have a great solution yet.
zlib does not currently support multiple files.
See: C/C++ Packing and Compression
zlib is for GZip compression, not ZIP compression (see here for details).
As a result you'd perhaps be better to shell out to the unzip utility provided in Cygwin and available for lots of platforms.

Minimal XML library for C++?

What XML libraries are out there, which are minimal, easy to use, come with little dependencies (ideally none), can be linked statically and come with a liberal license? So far, I've been a pretty happy user of TinyXML, but I'm curious what alternatives I have missed so far.
expat is a very fast C XML parser (although a C++ wrapper exists) that's widely used in many open-source projects. If I remember correctly, it has very few dependencies, and it's licensed under the very liberal MIT License.
I recommend rapidxml. It's an order of magnitude smaller than tinyxml, and doesn't choke on doctypes like tinyxml does.
If you need entity support or anything advanced, forget about static linking and use expat or libxml2.
FWIW there is also a version of TinyXML with a more C++-like interface, called ticpp.
There's one called libxml2.
There's also a Windows-only solution, a COM library that's part of the O/S, called msxml.
In "what’s the easiest way to generate xml in c++?" I wrote a comment that lists a few C++ XML libraries
TinyXML++ (ticpp) was, IMHO, the most appropriate for a small, easy to use XML library in C++.

How to convert Cardinal numbers into Ordinal ones

Is there an easy way to convert the number 1, 2, 3, ... to "1st", "2nd", "3rd", ..., and in such a way that I can give the function a language and have it return me the correct form for the language I'm targeting? Either standard C++ (stl or boost OK), MFC or ATL, win32 api or a small, single-purpose and free library that I can download from somewhere. Thanks.
I doubt whether it is possible at all, since in many languages this form will depend on the context, like gender or case of the noun it describes and different languages will require different kind of context information to allow to determine the correct form.
EDIT: E.g. in Polish it is "5-ta klasa" (5th class) vs. "5-ty miesiąc" (5th month) vs. "w 5-tym miesiącu" (in the 5th month).
I've spend quite some time researching this, because it's too large a project to get right myself. It looks like the ICU library is the only one that provides this functionality in a somewhat comprehensive way (http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html). I'm not too keen on incorporating a huge library like that, though. I'll keep on looking and I'm still open to suggestions.
Did you look up the CLDR repository on the Unicode site? I don't know if they have this kind of thing but since it's probably the most comprehensive locale data repository out there, it's probably worth a look.
http://www.unicode.org/cldr/
Since you use C++, I assume you could use GNU gettext (there's a Windows port as well) for all the translations, or at least get the idea how they solved it. Here's the relevant manual page on plural forms that explains the problem (which you already found, but in more detail) and their solution:
http://www.gnu.org/software/automake/manual/gettext/Plural-forms.html
Here is the piece of code on CodeProject that does the job. Haven't tried it on my own.