How to convert midi to wav using Timidity++? - android

I am actually trying to use timidity lib in my android project using the jni interface.
The problem is I need to create the shared lib for that including some C files.
I don't know the C files/classes and methods in them that are used for the above task.
So Please help me ,if any of you C developer have the idea or has the experience of using this library.

Related

How to Create a video in Android?

I am new to android. I have two files of same length, One is audio file and one is video file with no audio. I want to make a video with audio by combining these two files. Help me to achieve this task.
I assume you have native Android app and familiarity with Java (or know porting the code in native C) and are willing to use other open-source classes in your project.
This is what you might give a head-start: Since this project is not actively maintained now, you might have to fork and use their logic into your code.
https://github.com/tqnst/MP4ParserMergeAudioVideo
Another alternative is using ffmpeg port for Android (however I am not sure how this works natively).
https://github.com/WritingMinds/ffmpeg-android-java

Can we rewrite the MediaCodec API in C?

I am thinking about using hardware encoding on my Nexus Tablet, since I need to use some video algorithm, I want to make it C.
There is a native-media sample in Google NDK which support native use of OMX to do the decode job. But it seems that it doesn't support encode yet. Now we have the MediaCodec API, which can provide the hardware encode. I check the java file, it seems that most of it function is written in C. So I am wondering if this is possible:
1)find the corresponding C files
2)compile these C file into .so file
3)write a .cpp file according to the MediaCodec.java file, this .cpp file will call the functions in the .so file and perform the similar function as MediaCodec.java.
Then I can do the encode in C.
Is that right? And is that possible? If that possible, do i need to modify the system on my tablet?
Thank you!

JNI, NDK, and OpenCV

I have recently begun using the Android NDK and I have successfully implemented a few simple Android apps. I need to detect objects (squares and rectangles) from an image. My research has shown me that OpenCV is the solution for this. This is the algorithm I use to detect a square from the image.
However, I am unclear as to how should I use the squares.cpp file in my code. The OpenCV samples show how to use the cpp files in JNI format. Do I need to convert the squares.cpp file to JNI or would there be another feasible solution?
Thanks. All suggestions and feedback are welcome.
You don't have to convert the squares.cpp file to JNI.
From your Java code, you will call a JNI function (as I suppose you did in the "few simple Android apps" you have implemented) that will then call the functions in squares.cpp.
In other words, you basically only need one call to a JNI function from Java, and once you are in the C++ code, you can code in C++ as usual.

C: How to parse XML in android?

I'm working to create a library for my app in C. I want to parse a XML file in my code.
So, how can i do it in C ?
I know its java implementation but how can i parse a XML in my C code ?
What are the libraries that can be used for the purpose ?
I suggest Expat, I've used with many projects and it is very simple to use and has extremely small overhead. Its code base is also quite stable.
Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags).
However with every other external project mentioned, you need to build it yourself.
you should use c library for parsing xmls. here are some famous library links.. you can check
http://www.jclark.com/xml/expat.html
http://www.xmlsoft.org/
http://tibleiz.net/asm-xml/benchmark.html
you can find many other library to parse xml. But if you have any lightweight parsing task then you can use
http://www.minixml.org/
I have used http://www.minixml.org/ so i suggest to use this. Minixml is quite simple and easy to understand and use.
So you can download whole code of minixml and cross compile it for Android using Android toolchain or android NDK. And now Link that library to your jni code and use its API in your c code.
Just refference for includeing 3rd party library in jni code see
How to link any library in ndk application

using opencv haarcascades in android ndk

I would like to use the facedetection in opencv cpp to use it in an android app. I have compiled jni successfully. But I wonder how would i use the haarcascades. I can store in sdcard and read it from there. Is there any other way i can use the xml files directly from the project?
There is a c++ example called facedetect coming with the opencv superpack. I'm running OpenCV-2.3.1 myself and it's located in this folder: ../opencv-2.3.1/samples/c/
The sample uses haarcascades and this might be your best bet for facedetection. If you can use the Android NDK with proper JNI calls from a .cpp file then you shouldn't have any problems to use this sample.
I'm working on a similar thing myself but haven't tried it myself yet. Should be implementing the thing somewhere next week but can't guarantee it. Let me know if this works out for you

Categories

Resources