Csound Csound-dev Csound-tekno Search About

[Csnd] Csound-Adnroid example and tips

Date2012-11-15 06:33
FromTarmo Johannes
Subject[Csnd] Csound-Adnroid example and tips
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






Date2012-11-15 07:46
Fromzappfinger
Subject[Csnd] Re: Csound-Adnroid example and tips
Hello Tarmo,

You are mentioning OSC. Does it mean that OSC input is somehow possible now
on Android?
I was thinking of creating a midi to OSC thing to control a csd on Android
that way.


regards,
Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/Csound-Adnroid-example-and-tips-tp5717957p5717958.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2012-11-15 07:51
FromVictor
SubjectRe: [Csnd] Re: Csound-Adnroid example and tips
Not as part of Csound, yet, but we know how to do it and will be able to include it soon.



On 15 Nov 2012, at 07:46, zappfinger  wrote:

> Hello Tarmo,
> 
> You are mentioning OSC. Does it mean that OSC input is somehow possible now
> on Android?
> I was thinking of creating a midi to OSC thing to control a csd on Android
> that way.
> 
> 
> regards,
> Richard
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csound-Adnroid-example-and-tips-tp5717957p5717958.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 


Date2012-11-15 08:06
FromRory Walsh
SubjectRe: [Csnd] Re: Csound-Adnroid example and tips
While we are on the subject of OSC, how difficult would it be to send
OSC messages from a Csound Android app to control an instance of
Csound running on a desktop?

On 15 November 2012 07:51, Victor  wrote:
> Not as part of Csound, yet, but we know how to do it and will be able to include it soon.
>
>
>
> On 15 Nov 2012, at 07:46, zappfinger  wrote:
>
>> Hello Tarmo,
>>
>> You are mentioning OSC. Does it mean that OSC input is somehow possible now
>> on Android?
>> I was thinking of creating a midi to OSC thing to control a csd on Android
>> that way.
>>
>>
>> regards,
>> Richard
>>
>>
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/Csound-Adnroid-example-and-tips-tp5717957p5717958.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2012-11-15 08:56
FromTarmo Johannes
SubjectRe: [Csnd] Re: Csound-Adnroid example and tips

Hello,
As Victor mentioned, OSCsend does not work inside csd yet since it depends on foreign library.  As I understood, it is possible to build the necessary libraries (like done with fluidsynth already, I guess) and include them in CsoundAndroid somehow. When liblo for osc gets bundled, it will be great!

What I used for now, i put up a flag in a csound channel when i neede to send osc message, android app was checking the channel and sent the message using javaOSC library. I will send the example soon.
Greetings,
Tarmo

2012 11 15 10:06 kirjutas kuupäeval "Rory Walsh" <rorywalsh@ear.ie>:
While we are on the subject of OSC, how difficult would it be to send
OSC messages from a Csound Android app to control an instance of
Csound running on a desktop?

On 15 November 2012 07:51, Victor <Victor.Lazzarini@nuim.ie> wrote:
> Not as part of Csound, yet, but we know how to do it and will be able to include it soon.
>
>
>
> On 15 Nov 2012, at 07:46, zappfinger <zappfinger@gmail.com> wrote:
>
>> Hello Tarmo,
>>
>> You are mentioning OSC. Does it mean that OSC input is somehow possible now
>> on Android?
>> I was thinking of creating a midi to OSC thing to control a csd on Android
>> that way.
>>
>>
>> regards,
>> Richard
>>
>>
>>
>> --
>> View this message in context: http://csound.1045644.n5.nabble.com/Csound-Adnroid-example-and-tips-tp5717957p5717958.html
>> Sent from the Csound - General mailing list archive at Nabble.com.
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"