[Cs-dev] Csound in Android 5
Date | 2014-12-06 18:13 |
From | SimonKenny |
Subject | [Cs-dev] Csound in Android 5 |
As of the new Android OS update to major version 5 there are apparently some audio latency reductions and greater support for hardware peripherals. >From the Android Lollipop page, "Lower latency audio input ensuring that music and communication applications that have strict delay requirements provide an amazing realtime experience" "Multi-channel audio stream mixing means professional audio applications can now mix up to eight channels including 5.1 and 7.1 channels" "USB Audio support means you can plug USB microphones, speakers, and a myriad of other USB audio devices like amplifiers and mixers into your Android device" I am personally very interested in reducing latency specifically as I'm just about the release a commercial app for Android which uses Csound. Having updated to the new Android 5, there doesn't seem to be any immediate automatic reduction. I assume this needs to be optimised for Android 5 at a low level. I'd be willing to work on this with whoever is maintaining the Android API as I'm very invested in seeing performance increases! Are there any plans to take advantage of this? -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-in-Android-5-tp5739058.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2014-12-06 18:47 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound in Android 5 |
There has been no change in the NDK and OpenSL ES (as far as I can see), so I guess it’s a question of trying to see if smaller buffer sizes now work (-B and -b). The point is to reduce them so that -b is of the order of ksmps (64,32) and -B about 4 times that value. With 4.4, I am not able to reduce -B to less than 1024. But even 1024 is giving me more than 1024 sample frames of latency there. If low-latency is promised but not achieved, I can look at the code to see if I can figure out something else, but I will need to get a 5.0 device to test first (my tablet OS has not been updated yet). Regards ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 6 Dec 2014, at 18:13, SimonKenny |
Date | 2014-12-15 17:38 |
From | SimonKenny |
Subject | Re: [Cs-dev] Csound in Android 5 |
Hi Victor Thank you for your reply. I can replicate your findings that anything less than 1024 for the hardware buffer size (-B) gives sound problems. Also you are saying then that the software buffer size (-b) should be no less than 256? And should ksmps still be around 32 or 64? I've also noticed that the AUDIO_OUTOUT_FAST_FLAG is not being accepted by the AudioTrack library. Here's part of a log: 12-15 16:15:34.113: D/CsoundObj(23005): --Csound version 6.04 (float samples) Dec 1 2014 12-15 16:15:34.113: D/CsoundObj(23005): graphics suppressed, ascii substituted 12-15 16:15:34.113: D/CsoundObj(23005): 0dBFS level = 1.0 12-15 16:15:34.114: D/CsoundObj(23005): orch now loaded 12-15 16:15:34.114: D/CsoundObj(23005): audio buffered in 2048 sample-frame blocks 12-15 16:15:34.114: W/libOpenSLES(23005): class OutputMix interface 0 requested but unavailable MPH=43 12-15 16:15:34.118: W/AudioTrack(23005): AUDIO_OUTPUT_FLAG_FAST denied by client 12-15 16:15:34.123: D/CsoundObj(23005): writing 4096 sample blks of 32-bit floats to dac You can see a larger log as well as references to the description of the system, and a link to the code that accepts or denies the flag here: https://docs.google.com/document/d/1g9-M8NRrzRkiEVfNZOrQuULVbMKiSaytBJGQAtlCOIE/edit?usp=sharing I'm wondering two thins about this: (1) Is it problematic if the buffer sizes requested via -B and -b command line flags are different from the buffer sizes above? (2) Is the AUDIO_OUTOUT_FLAG_FAST denial very bad for latency or inconsequential? By the way, my Nexus 7 2013 edition can update to Android 5, if you have access to one this will work. Thanks for your time -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-in-Android-5-tp5739058p5739274.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2014-12-16 14:53 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound in Android 5 |
What version of Android is this? I would think that -b can be lowered down to the ksmps value, but I am not sure whether that would help. I have to look at the flag you mentioned. I think this is defined by the hw. If the hw does not support it, then it can't be set. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 15 Dec 2014, at 17:38, SimonKenny |
Date | 2014-12-16 16:18 |
From | SimonKenny |
Subject | Re: [Cs-dev] Csound in Android 5 |
I'm building for Api 19 (v4.4 KitKat) and testing on Nexus 7 2013 with Android 5.0.1. Having read the CsoundObj java wrapper code in more detail today I discovered that there is another constructor which takes the boolean argument /useAudioTrack/ that I was unaware of. This is set to false by default constructor. When I set this flag true I do not get the AudioTrack warning as previously described, there is no warning. However, now Csound (almost always) crashes the app if either or both -B and -b flags are used. If neither are used, Csound starts and operates normally. In fact I think there is a performance increase when /useAudioTrack/ is set but I have to verify that. The crash is either silent, without an error message, or sometimes I get this: 12-16 15:54:02.050: A/libc(32178): Pure virtual function called. Are you calling virtual methods from a destructor? 12-16 15:54:02.052: D/CsoundObj(32178): WARNING: 12-16 15:54:02.052: D/CsoundObj(32178): Csound not ready for performance: csoundStart() has not been called The -b flag seems to set X in the "audio buffered in X sample-frame blocks" message during Csound start, seen in the following log: 12-16 15:55:46.295: D/CsoundObj(32440): --Csound version 6.04 (float samples) Dec 1 2014 12-16 15:55:46.295: D/CsoundObj(32440): 0dBFS level = 1.0 12-16 15:55:46.296: D/CsoundObj(32440): orch now loaded 12-16 15:55:46.296: D/CsoundObj(32440): audio buffered in 256 sample-frame blocks 12-16 15:55:46.296: D/CsoundObj(32440): SECTION 1: 12-16 15:55:46.296: D/CsoundObj(32440): Return Value2: 0 12-16 15:55:46.296: D/csound(32440): Setup called 12-16 15:55:46.296: D/csound(32440): Trying to get internal pointers... 12-16 15:55:46.300: D/csound(32440): Got SP pointers 12-16 15:55:46.301: D/csound(32440): Got I O pointers 12-16 15:55:46.305: D/CsoundObj(32440): Buffer Size: 7056 12-16 15:55:46.306: D/CsoundObj(32440): Multiplier: 32767.0 : 3.051851E-5 It's interesting to see the "Buffer Size: 7056" message. This must be the hardware buffer? In any case I'm seeing some better stability with /useAudioTrack/, as sometimes Csound would crash the app for no apparent reason, or not one I could pin down, and I haven't gotten this yet. And there seems to be less latency between screen touch and sound. I will measure this, comparing with and without setting /useAudioTrack/. -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-in-Android-5-tp5739058p5739281.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2014-12-16 17:20 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound in Android 5 |
That boolean argument switches off the NDK audio backend (OpenSL) and uses the Java code only. That is not recommended (it is there for backwards compatibility). I think it will not help me to have you doing these tests, as you are shooting in the dark. The only thing is for me to wait until I can get a 5.0 tablet to test. Regards ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 16 Dec 2014, at 16:18, SimonKenny |
Date | 2014-12-16 17:51 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Csound in Android 5 |
On Android 4.4 I use ksmps=960, -b1920, -B3840 --sample-accurate. Latency is bad, but performance is OK. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Dec 16, 2014 at 9:53 AM, Victor Lazzarini |
Date | 2014-12-16 18:15 |
From | Victor.Lazzarini@nuim.ie |
Subject | Re: [Cs-dev] Csound in Android 5 |
Attachments | None None None None |
Date | 2014-12-16 19:45 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Csound in Android 5 |
Thanks for the information, I'll try your settings. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Dec 16, 2014 at 1:15 PM, |
Date | 2014-12-16 20:18 |
From | Stephen Kyne |
Subject | Re: [Cs-dev] Csound in Android 5 |
Attachments | None None |
Out of interest, has anyone tried the new Android version (Lollipop)? It's supposed to be lower at least but I can't find any exact figures or details. Stephen > Date: Tue, 16 Dec 2014 14:45:18 -0500 > From: michael.gogins@gmail.com > To: csound-devel@lists.sourceforge.net > Subject: Re: [Cs-dev] Csound in Android 5 > > Thanks for the information, I'll try your settings. > > Regards, > Mike > > ----------------------------------------------------- > Michael Gogins > Irreducible Productions > http://michaelgogins.tumblr.com > Michael dot Gogins at gmail dot com > > > On Tue, Dec 16, 2014 at 1:15 PM, <Victor.Lazzarini@nuim.ie> wrote: > > Very high ksmps. Here I can use ksmps=32, -b256 -B1024, on the Nexus & > > Samsung tablets. > > Latency is not great, better on the Nexus. > > > > > > > > ----- Original Message ----- > > From: Michael Gogins <michael.gogins@gmail.com> > > Date: Tuesday, December 16, 2014 5:52 pm > > Subject: Re: [Cs-dev] Csound in Android 5 > > To: Developer discussions <csound-devel@lists.sourceforge.net> > > > >> On Android 4.4 I use ksmps=960, -b1920, -B3840 --sample-accurate. > >> Latency is bad, but performance is OK. > >> > >> Regards, > >> Mike > >> > >> ----------------------------------------------------- > >> Michael Gogins > >> Irreducible Productions > >> http://michaelgogins.tumblr.com > >> Michael dot Gogins at gmail dot com > >> > >> > >> On Tue, Dec 16, 2014 at 9:53 AM, Victor Lazzarini > >> <Victor.Lazzarini@nuim.ie> wrote: > >> > What version of Android is this? > >> > > >> > I would think that -b can be lowered down to the ksmps value, > >> but I am not sure whether that would help. > >> > > >> > I have to look at the flag you mentioned. I think this is > >> defined by the hw. If the hw does not support it, then it can't > >> be set. > >> > > >> > Victor Lazzarini > >> > Dean of Arts, Celtic Studies, and Philosophy > >> > Maynooth University > >> > Ireland > >> > > >> >> On 15 Dec 2014, at 17:38, SimonKenny <digithree@gmail.com> > >> wrote:>> > >> >> Hi Victor > >> >> > >> >> Thank you for your reply. > >> >> > >> >> I can replicate your findings that anything less than 1024 > >> for the hardware > >> >> buffer size (-B) gives sound problems. Also you are saying > >> then that the > >> >> software buffer size (-b) should be no less than 256? And > >> should ksmps still > >> >> be around 32 or 64? > >> >> > >> >> I've also noticed that the AUDIO_OUTOUT_FAST_FLAG is not > >> being accepted by > >> >> the AudioTrack library. Here's part of a log: > >> >> 12-15 16:15:34.113: D/CsoundObj(23005): --Csound version 6.04 > >> (float>> samples) Dec 1 2014 > >> >> 12-15 16:15:34.113: D/CsoundObj(23005): graphics suppressed, ascii > >> >> substituted > >> >> 12-15 16:15:34.113: D/CsoundObj(23005): 0dBFS level = 1.0 > >> >> 12-15 16:15:34.114: D/CsoundObj(23005): orch now loaded > >> >> 12-15 16:15:34.114: D/CsoundObj(23005): audio buffered in > >> 2048 sample-frame > >> >> blocks > >> >> 12-15 16:15:34.114: W/libOpenSLES(23005): class OutputMix > >> interface 0 > >> >> requested but unavailable MPH=43 > >> >> 12-15 16:15:34.118: W/AudioTrack(23005): > >> AUDIO_OUTPUT_FLAG_FAST denied by > >> >> client > >> >> 12-15 16:15:34.123: D/CsoundObj(23005): writing 4096 sample > >> blks of 32-bit > >> >> floats to dac > >> >> > >> >> You can see a larger log as well as references to the > >> description of the > >> >> system, and a link to the code that accepts or denies the > >> flag here: > >> >> https://docs.google.com/document/d/1g9- > >> M8NRrzRkiEVfNZOrQuULVbMKiSaytBJGQAtlCOIE/edit?usp=sharing>> > >> >> I'm wondering two thins about this: > >> >> (1) Is it problematic if the buffer sizes requested via -B > >> and -b command > >> >> line flags are different from the buffer sizes above? > >> >> (2) Is the AUDIO_OUTOUT_FLAG_FAST denial very bad for latency or > >> >> inconsequential? > >> >> > >> >> By the way, my Nexus 7 2013 edition can update to Android 5, > >> if you have > >> >> access to one this will work. > >> >> > >> >> > >> >> Thanks for your time > >> >> > >> >> > >> >> > >> >> -- > >> >> View this message in context: > >> http://csound.1045644.n5.nabble.com/Csound-in-Android-5- > >> tp5739058p5739274.html>> Sent from the Csound - Dev mailing list > >> archive at Nabble.com. > >> >> > >> >> -------------------------------------------------------------- > >> ---------------- > >> >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > >> >> from Actuate! Instantly Supercharge Your Business Reports and > >> Dashboards>> with Interactivity, Sharing, Native Excel Exports, > >> App Integration & more > >> >> Get technology previously reserved for billion-dollar > >> corporations, FREE > >> >> > >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk>> > >> _______________________________________________ > >> >> Csound-devel mailing list > >> >> Csound-devel@lists.sourceforge.net > >> >> https://lists.sourceforge.net/lists/listinfo/csound-devel > >> > > >> > --------------------------------------------------------------- > >> --------------- > >> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > >> > from Actuate! Instantly Supercharge Your Business Reports and > >> Dashboards> with Interactivity, Sharing, Native Excel Exports, > >> App Integration & more > >> > Get technology previously reserved for billion-dollar > >> corporations, FREE > >> > > >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk> > >> _______________________________________________ > >> > Csound-devel mailing list > >> > Csound-devel@lists.sourceforge.net > >> > https://lists.sourceforge.net/lists/listinfo/csound-devel > >> > >> ----------------------------------------------------------------- > >> ------------- > >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > >> from Actuate! Instantly Supercharge Your Business Reports and > >> Dashboardswith Interactivity, Sharing, Native Excel Exports, App > >> Integration & more > >> Get technology previously reserved for billion-dollar > >> corporations, FREE > >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > >> _______________________________________________ > >> Csound-devel mailing list > >> Csound-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music, > > National University of Ireland, Maynooth > > > > ------------------------------------------------------------------------------ > > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > > with Interactivity, Sharing, Native Excel Exports, App Integration & more > > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > > _______________________________________________ > > Csound-devel mailing list > > Csound-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/csound-devel > > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel |
Date | 2014-12-16 20:31 |
From | Victor.Lazzarini@nuim.ie |
Subject | Re: [Cs-dev] Csound in Android 5 |
Attachments | None None None None |
Date | 2014-12-16 22:05 |
From | SimonKenny |
Subject | Re: [Cs-dev] Csound in Android 5 |
@Victor: I absolutely am shooting in the dark! I see your point, there's no point to randomly testing it. Thanks for letting me know about the /useAudioTrack/ flag, I thought it might be a magic fix... I've read that there has been polling for preferred buffer sizes since Android 17 (4.2) in this article from 2012: http://www.music.columbia.edu/pipermail/andraudio/2012-November/000712.html Quote: /Beginning with API level 17 (Android platform version 4.2), an application can query for the native or optimal output sample rate and buffer size for the device's primary output stream. When combined with the feature test just mentioned, an app can now configure itself appropriately for lower latency output on devices that claim support./ Also, FYI, if you use the *android.hardware.audio.low_latency* |
Date | 2014-12-17 17:07 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound in Android 5 |
The manifest feature does not seem to do anything. I also have tried the “optimal” settings and they do not make any change. Touch to sound latency on 4.4, nexus 7 tablet is ~ 130ms Regards ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 16 Dec 2014, at 22:05, SimonKenny |
Date | 2014-12-17 17:41 |
From | SimonKenny |
Subject | Re: [Cs-dev] Csound in Android 5 |
The manifest feature is just a way of determining which devices are compatible, it does not actually change the operation of the app. Also I should say that that list of tablets also has several other feature requests so is not a complete list of tablets that claim low latency support. Good to know that I'm running at as close to as good as it gets for the moment anyway. So as I said earlier, if I can contribute to any development specifically for Android I'd be very interested. Thank you very much for your time. -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-in-Android-5-tp5739058p5739318.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2014-12-17 18:03 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound in Android 5 |
If you want to contribute, you can install the devel tools for android (NDK, SDK), and go for it. The C backend is in Android/CsoundAndroid/jni/rtopensl.c . There is a build.sh in CsoundAndroid that can be used to build the C/C++ libs. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 17 Dec 2014, at 17:41, SimonKenny |