| Hello,
Last week I needed to perform a crazy microtonal piece (but very good! by a
young Iranian composer Arash Yazdani) where the singer needed to hit very
exact pitches given in hertzes.
To make it possible I wrote a small android app with numerous buttons,
everyone playing a tone with the given pitch using the Csound library. It
turned out very practical solution and absolutely saved the situation.
The app can be downloaded from
http://tarmo.uuu.ee/android/CS%20tuning%20fork.apk
and eclipse project with the source code:
http://tarmo.uuu.ee/android/CS%20tuning%20fork.zip
Soon I will post a bit more elaborate example using channels and OSC messages
but I have not had time to clean the code yet.
As mentioned many times, the potential of Csound+Android is huge. I have had a
lot of struggling to start to understand java and eclipse, I am not in deep
understandign yet at all, but here are some tips for those who want to try it
out:
1) Install Android SDK and Eclipse (easiest for development). see for example
http://www.devx.com/wireless/Article/39101
2) download Csound fro Android ( as zip file - includes prebuilt libraries)
from http://sourceforge.net/projects/csound/files/csound5/Android/
3) in eclipse open CsoundAndroid project from the package you just unpacked,
it useful to open also CsoundAndroidExamples
4) create new android application project
5) in Properties->android->Library add CsoundAndroid
6) add permissions to AndroidManifest.xml:
if you you use also OSC or other network communication:
also, add following lines to block in AndroidManifest.xml, to
black crashes on orientation cahnges
android:configChanges="orientation"
android:screenOrientation="portrait"
(There must be better solutions - the crashes are caused by onCreate method of
your main activity - it is relaunched every time the screen or other
configuration changes, redefining some things leads to crash.)
7) for me it was easiest to base the main acitivity on class
BaseCsoundActivity delcared in the sources of CsoundAndroidExamples. It is
also possible not to use it but one has to define some of the methods (like
handling a csd file) by themselves. To use it:
copy BaseCsoundActivity.java from CsoundAndroidExamples to the src folder of
your project where your main activity lies.
correct import declarations and package names as necessary in
BaseCsoundActivity.java according to your own package.
add
'extends BaseCsoundActivity implements CsoundObjCompletionListener' after your
activity handling csound business.
let eclipse add suggested auto-generated methods, have a look to
CsoundAndroidExamples how to fill some necessary autogenerated methods (like
csoundObjComplete, csoundObj.addValueCacheable or others).
Study the examples to understand the business - there is not yet proper
documentation.
8) create folder 'raw' under folder 'res', where you can put your csd(s). You
can refer to it in the the source code as R.raw.yourcsdname
9) add widgets (easiest are buttons and sliders) to your layout, you can use
methods CsoundObj.addSlider and CsoundObj.addButton to forward their values
dirctly to csound channels.
I am sure, if you follow this list, you will not get a running adnroid app,
there is a lot to invent and explore, but at least it is a way to start off!
best regards,
tarmo
|