[Csnd] Audiofiles for Csound inandroid APK
Date | 2013-01-25 15:24 |
From | Martin Huenniger |
Subject | [Csnd] Audiofiles for Csound inandroid APK |
Hi list, right now I'm trying to use Csound on android to play audiofiles. Usually, I would do something like this: instr 1 asig diskin2 p4, 1, 0, 1 outs asig, asig endin and use the score event i 1 0 10 "inputfile.aiff" to play the file. Now I read a little on the structure of the apk's and I wonder how to achieve the same functionality, since there are no absolute paths in the apk. First I tried to put "inputsound.aiff" into res/raw/ but this would not work. I found out, that assets/ might be the better position, but then I don't know how to provide the file to Csound. The access to assets works via the AssetManager which allows to get filestreams from the packed archive. Does Csound understand these Streams? I suppose not. So then how do I get the file from assets into diskin2? Best, Martin _________________________ Martin Hünniger a_s_tarantoga@yahoo.de a-s-tarantoga.tumblr.com soundcloud.com/a_s_tarantoga |
Date | 2013-01-25 16:11 |
From | "Jacques Leplat" |
Subject | Re: [Csnd] Audiofiles for Csound inandroid APK |
Hello Martin, You need to write your own method to extract the file. For example: you have a file as a resource in your apk (kept in the res/raw folder of your project) whose id is R.raw.something: - InputStream stream = getResources().openRawResource(R.raw.something) - Create a file output stream of your choosing, so you say what file name and folder to use (maybe BufferedOutputStream to be efficient?) - Use a byte[] buffer to read the bytes efficiently - while ((bytesRead = bin.read(buffer)) > 0) bout.write(buffer, 0, bytesRead); And there you have a new file, you know its name and location. All the best, Jacques ----- Original Message ----- From: "Martin Huenniger" |
Date | 2013-01-25 16:24 |
From | Martin Huenniger |
Subject | Re: [Csnd] Audiofiles for Csound inandroid APK |
Hi Jacques, hmm, I almost thought in this direction, but I'm very new to android to find all the classes. Thank you for your tip, this will make it a lot more easy to get it done. Best, Martin Am 25.01.2013 um 17:11 schrieb Jacques Leplat: > Hello Martin, > > You need to write your own method to extract the file. For example: you have a file as a resource in your apk (kept in the res/raw folder of your project) whose id is R.raw.something: > > - InputStream stream = getResources().openRawResource(R.raw.something) > - Create a file output stream of your choosing, so you say what file name and folder to use (maybe BufferedOutputStream to be efficient?) > - Use a byte[] buffer to read the bytes efficiently > - while ((bytesRead = bin.read(buffer)) > 0) bout.write(buffer, 0, bytesRead); > > And there you have a new file, you know its name and location. > > All the best, > > Jacques > > ----- Original Message ----- From: "Martin Huenniger" |
Date | 2013-02-14 02:40 |
From | Andres Cabrera |
Subject | Re: [Csnd] Audiofiles for Csound inandroid APK |
Hi, Late reply, but I'm wondering if embedding the file with B64 encoding within the csd using <CsFileB> might be easier (if it is supported on Android). http://www.csounds.com/manualOLPC/CommandUnifile.html CsoundQt supports embedding files in the csd file in version 0.7.2 if you open the split view to see the embedded files. Andrés
On Fri, Jan 25, 2013 at 8:24 AM, Martin Huenniger <a_s_tarantoga@yahoo.de> wrote: Hi Jacques, |