Csound Csound-dev Csound-tekno Search About

some Csound fun...

Date2015-08-02 16:51
FromRory Walsh
Subjectsome Csound fun...
AttachmentsNone  None  
I'm working on a Csound package for Unity at the moment, and as part of that project I was eager to see if I could get Csound to work with Unity's web player. Thanks to some help from Ed a little earlier, I managed to get it going. So I decided to throw together a little game for the list. For best results run it in Firefox. It won't work in Chrome on OSX. And you may need to hit refresh if there is no sound at the start. I'm working with a slow internet connection here and it seems to take a few moments for the sounds to load up. The Unity player doesn't work on Linux as far as I can tell but if anyone finds a way, please let me know. 
I'll be presenting my CsoundUnity package at the Csound conference in October. It's a lot of fun! 

Date2015-08-04 09:19
FromOeyvind Brandtsegg
SubjectRe: some Csound fun...
Yes! Nice, Rory. It'll be interesting to see what happens when more
people get the opportunity of flexible sound design in games.

2015-08-02 17:51 GMT+02:00 Rory Walsh :
> I'm working on a Csound package for Unity at the moment, and as part of that
> project I was eager to see if I could get Csound to work with Unity's web
> player. Thanks to some help from Ed a little earlier, I managed to get it
> going. So I decided to throw together a little game for the list. For best
> results run it in Firefox. It won't work in Chrome on OSX. And you may need
> to hit refresh if there is no sound at the start. I'm working with a slow
> internet connection here and it seems to take a few moments for the sounds
> to load up. The Unity player doesn't work on Linux as far as I can tell but
> if anyone finds a way, please let me know.
>
> https://dl.dropboxusercontent.com/u/11301894/CsoundUnityWeb/WebPlayer.html
>
> I'll be presenting my CsoundUnity package at the Csound conference in
> October. It's a lot of fun!
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>


Date2015-08-08 02:27
FromSinusoidal
SubjectRe: some Csound fun...
This is pretty great. I've been coding games and Csound for, well, a long
time now and I've always wanted to combine the two.

Lately, I've been trying to get the Csound library working in Android Studio
with LibGDX: a Java game engine, but I keep getting
java.lang.NoClassDefFoundError: csnd6.csnd

I'm using the .jars you uploaded here:
http://csound.1045644.n5.nabble.com/Compiling-csound6-04-Sample-CSDPlayer-in-ANDROID-STUDIO-td5740225.html
and found some information on getting past NoClassDefFound errors here:
http://stackoverflow.com/questions/17724642/android-studio-java-lang-noclassdeffounderror
and I think I've almost got it cracked. Still not working, but close. Soon!!

https://soundcloud.com/underwaterbob
http://gamejolt.com/profile/sally/153771/games
http://sinusoidal.itch.io/curse-of-the-mountain-man



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743026.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-09 21:26
FromRory Walsh
SubjectRe: some Csound fun...
AttachmentsNone  None  
That's cool. I plan to look into using Csound with Unity for Android pretty shortly. Hopefully it will work out, but you never know!

On 8 August 2015 at 03:27, Sinusoidal <Underwaterbob@gmail.com> wrote:
This is pretty great. I've been coding games and Csound for, well, a long
time now and I've always wanted to combine the two.

Lately, I've been trying to get the Csound library working in Android Studio
with LibGDX: a Java game engine, but I keep getting
java.lang.NoClassDefFoundError: csnd6.csnd

I'm using the .jars you uploaded here:
http://csound.1045644.n5.nabble.com/Compiling-csound6-04-Sample-CSDPlayer-in-ANDROID-STUDIO-td5740225.html
and found some information on getting past NoClassDefFound errors here:
http://stackoverflow.com/questions/17724642/android-studio-java-lang-noclassdeffounderror
and I think I've almost got it cracked. Still not working, but close. Soon!!

https://soundcloud.com/underwaterbob
http://gamejolt.com/profile/sally/153771/games
http://sinusoidal.itch.io/curse-of-the-mountain-man



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743026.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-13 08:55
FromSinusoidal
SubjectRe: some Csound fun...
I'm very interested to hear how that turns out. The few times I messed with
it, I never liked Unity a whole lot, but if Csound happens to work in it, I
might be tempted to pick it back up.

I've got AndroidCsound imported, compiling and running with LibGDX in
Android Studio now, but it won't make any sound, nor report any errors.
Slowly losing my mind.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743107.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 12:50
FromRory Walsh
SubjectRe: some Csound fun...
AttachmentsNone  None  
So you can see some output from Csound when it starts? Are you calling setOpenSlCallbacks()?

On 13 August 2015 at 09:55, Sinusoidal <Underwaterbob@gmail.com> wrote:
I'm very interested to hear how that turns out. The few times I messed with
it, I never liked Unity a whole lot, but if Csound happens to work in it, I
might be tempted to pick it back up.

I've got AndroidCsound imported, compiling and running with LibGDX in
Android Studio now, but it won't make any sound, nor report any errors.
Slowly losing my mind.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743107.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-13 12:51
FromRory Walsh
SubjectRe: some Csound fun...
AttachmentsNone  None  
And you're also calling csound.SetOption("-odac");

On 13 August 2015 at 13:50, Rory Walsh <rorywalsh@ear.ie> wrote:
So you can see some output from Csound when it starts? Are you calling setOpenSlCallbacks()?

On 13 August 2015 at 09:55, Sinusoidal <Underwaterbob@gmail.com> wrote:
I'm very interested to hear how that turns out. The few times I messed with
it, I never liked Unity a whole lot, but if Csound happens to work in it, I
might be tempted to pick it back up.

I've got AndroidCsound imported, compiling and running with LibGDX in
Android Studio now, but it won't make any sound, nor report any errors.
Slowly losing my mind.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743107.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



Date2015-08-13 13:33
FromSinusoidal
SubjectRe: some Csound fun...
I set -odac in the CsOptions in the csd file.

I have now setOpenSlCallbacks (Thanks for that!!) and it tells me "Failed to
open csd file: No such file or directory".

The Android portion of a LibGDX project sets the working directory to
android/assets which is where I've put my csd file, but I imagine
csound.CompileCsd("csoundFile.csd") isn't finding it because... I don't
know, I'm not really a very good coder, but my guess is that the Csound API
doesn't use or see LibGDX's default asset folder.

I'm trying to find out how to fix the path now...



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743110.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 14:27
FromRory Walsh
SubjectRe: some Csound fun...
AttachmentsNone  None  
I think there are some utility methods for reading the .csd file from the res folder. In my previous projects I simply created the csd text as a string and passed it directly. Check out this source:


Just search for csound and it should take you to the relevant sections. 

On 13 August 2015 at 14:33, Sinusoidal <Underwaterbob@gmail.com> wrote:
I set -odac in the CsOptions in the csd file.

I have now setOpenSlCallbacks (Thanks for that!!) and it tells me "Failed to
open csd file: No such file or directory".

The Android portion of a LibGDX project sets the working directory to
android/assets which is where I've put my csd file, but I imagine
csound.CompileCsd("csoundFile.csd") isn't finding it because... I don't
know, I'm not really a very good coder, but my guess is that the Csound API
doesn't use or see LibGDX's default asset folder.

I'm trying to find out how to fix the path now...



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743110.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-08-13 15:13
FromSinusoidal
SubjectRe: some Csound fun...
Now I'm completely mystified because I'm passing the csd file as a string to
.CompileCsd and the error is still "Failed to open csd file: No such file or
directory" which says to me that CompileCsd wants a file name or nothing.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743114.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 15:15
FromSinusoidal
SubjectRe: some Csound fun...
Could the fault lie in CompileCsd because in the example you linked, he
separates his Orc and Sco and that's a habit I tried very hard to get rid of
when Csound 5 came along... XP



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743115.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 15:37
FromSinusoidal
SubjectRe: some Csound fun...
Well, I split my csd string into separate ORC and SCO strings and compiled
them separately with CompileOrc and ReadScore and it /somehow /worked and I
heard the most lovely 10 second long 1kHz sin wave I've ever heard in my
life come out of my shoddy phone speaker and I'm the happiest I've ever been
in my life.

If anyone is interested in the process of getting the Csound API working
with LibGDX in Android Studio, well, I'm not sure I can reproduce it, but
feel free to ask.

Now to make it actually interactive.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743116.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 16:04
FromMichael Gogins
SubjectRe: some Csound fun...
AttachmentsNone  None  

Correct, file name or nothing.

There's more, csds can use t,s,e, and score expressions but ReadScore can't, and all times are seconds.

Regards,
Mike

On Aug 13, 2015 10:56 AM, "Sinusoidal" <Underwaterbob@gmail.com> wrote:
Could the fault lie in CompileCsd because in the example you linked, he
separates his Orc and Sco and that's a habit I tried very hard to get rid of
when Csound 5 came along... XP



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743115.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 16:06
FromSteven Yi
SubjectRe: some Csound fun...
There's no problems to use CSD's. The examples project that comes with
the Csound for Android SDK demonstrates this:

https://github.com/csound/csound/blob/develop/android/CsoundAndroidExamples/src/com/csounds/examples/tests/MultiTouchXYActivity.java#L159-L164



On Thu, Aug 13, 2015 at 10:37 AM, Sinusoidal  wrote:
> Well, I split my csd string into separate ORC and SCO strings and compiled
> them separately with CompileOrc and ReadScore and it /somehow /worked and I
> heard the most lovely 10 second long 1kHz sin wave I've ever heard in my
> life come out of my shoddy phone speaker and I'm the happiest I've ever been
> in my life.
>
> If anyone is interested in the process of getting the Csound API working
> with LibGDX in Android Studio, well, I'm not sure I can reproduce it, but
> feel free to ask.
>
> Now to make it actually interactive.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743116.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-13 16:16
FromRory Walsh
SubjectRe: some Csound fun...
AttachmentsNone  None  
Thanks Steven, I couldn't remember the name of the getResourceFileAsString() method.   



Date2015-08-14 02:54
FromSinusoidal
SubjectRe: some Csound fun...
A LibGDX project doesn't have the getResourceFileAsString() nor
createTempFile() methods from the BaseCsoundActivity class. LibGDX also
doesn't manage resources the same way the default Android activity does.

There are methods in LibGDX that return Java.io.File types from internal
assets. I'll give that a shot with my csd and try passing that to
CompileCsd.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743121.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-14 11:16
FromJacques Leplat
SubjectRe: some Csound fun...
All java classes have something along the lines of: getClass().getResourceAsStream(filename)

If you place your csd file alongside your java sources, and get the builder to copy the file when building, you should see it sitting alongside the compiled java class files. This should work, 
I've done it many times using the desktop JDK

All the best,

Jacques

> On 14 Aug 2015, at 02:54, Sinusoidal  wrote:
> 
> A LibGDX project doesn't have the getResourceFileAsString() nor
> createTempFile() methods from the BaseCsoundActivity class. LibGDX also
> doesn't manage resources the same way the default Android activity does.
> 
> There are methods in LibGDX that return Java.io.File types from internal
> assets. I'll give that a shot with my csd and try passing that to
> CompileCsd.
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743121.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-15 17:12
FromSinusoidal
SubjectRe: some Csound fun...
LibGDX does indeed have getResourceAsStream(), but now I don't exactly know
what to do with that stream...



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743144.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-16 06:11
FromSinusoidal
SubjectRe: some Csound fun...
Well, I got it working.

It was a problem of how Android and LibGDX handle file storage.

LibGDX deals with assets in what it calls "internal" storage, which are
read-only because - it being a game engine - you typically don't need to
change textures or sound files on the fly. It also has what it calls "local"
storage which are files that you can read from and write to. All of this is
because of the way Android deals with memory management I guess.

I had a lot of trouble trying to get a local file packed with the apk that
Studio generates, so, I ended up packing the csd file as an internal file,
then writing the InputStream from that to a temp.csd local file, which I
then have to use LibGDX's FileHandle .file() method on to turn it into a
Java.io.File type to pass to csoundObject.startCsound().

Thanks for the tips everyone! I'll post some links once (if) I ever publish
an app.



--
View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743150.html
Sent from the Csound - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-08-16 09:23
FromJacques Leplat
SubjectRe: some Csound fun...
There are many java io classes that take an InputStream to facilitate reading from the stream, or you can just read from the input stream inside a loop. Appending each character to a stringbuilder. 

When all is read, stringbuilder.tostring() should give you the contents as a string


All the best

Jacques

> On 15 Aug 2015, at 18:12, Sinusoidal  wrote:
> 
> LibGDX does indeed have getResourceAsStream(), but now I don't exactly know
> what to do with that stream...
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/some-Csound-fun-tp5742957p5743144.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here