Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Csound API: Can I compile an orc from a String instead of a .csd?

Date2008-05-10 22:03
Fromvictor
Subject[Csnd] Re: Csound API: Can I compile an orc from a String instead of a .csd?
Use the CppSound class.
----- Original Message ----- 
From: "Jacob Joaquin" 
To: 
Sent: Saturday, May 10, 2008 9:05 PM
Subject: [Csnd] Csound API: Can I compile an orc from a String instead of a 
.csd?


>
> Hello all.
>
> I'm working on a Java app that uses the Csound API for the synth engine. 
> Is
> it possible to compile Csound orchestra code stored in a String as opposed
> to specifying a .csd file?  If yes, how?  Every example I've come across
> compiles from a .csd file.
>
> Thanks,
> Jake
> -- 
> View this message in context: 
> http://www.nabble.com/Csound-API%3A-Can-I-compile-an-orc-from-a-String-instead-of-a-.csd--tp17167042p17167042.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2008-05-10 23:27
FromJacob Joaquin
Subject[Csnd] Re: Csound API: Can I compile an orc from a String instead of a .csd?
I guess the biggest problem I'm having is the lack of documentation.  I've
downloaded the Csound API Reference pdf at sourceforge, and it appears that
the listed CppSound.hpp class reference doesn't quite jive with the methods
of the csnd.jar.  For example, I'm not finding any methods that can set the
orchestra.

I'm also having difficulty finding the original files that were used to
create the csnd.jar file.  Does anybody know these are located.  As it
stands now, the jar contains only .class files.

That reference manual is also dated October of 2006, so I'm not sure it's up
to date.  And it seems that the text of it are bitmaps, not fonts, which
makes it serious pain to browse, as I can't do searches, and there is a
significant hiccup between each page load.

Best,
Jake


Victor Lazzarini wrote:
> 
> Use the CppSound class.
> 

-- 
View this message in context: http://www.nabble.com/Csound-API%3A-Can-I-compile-an-orc-from-a-String-instead-of-a-.csd--tp17167042p17168204.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2008-05-11 00:01
FromRory Walsh
Subject[Csnd] Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
I don't do Java but here is an untested c++ example which uses the 
cppsound class and it's 'setCSD()' method. I hope you can work out the 
java code from it. I can answer any questions you have about the c++ code.

Rory.


#include "CppSound.hpp"
#include "csPerfThread.hpp"
#include 
#include 

using namespace std;

int main()
{
/* create string that holds an entire csd file */
std::string csdText = " \n\
 \n\
csound -odevaudio -b10 -idevaudio  temp.orc temp.sco \n\
  \n\
  \n\
sr = 44100  \n\
kr = 44100  \n\
ksmps = 1  \n\
nchnls = 1  \n\
instr 1  \n\
k1 chnget \"freq\" \n\
a1 oscil 10000, k1+100, 1  \n\
out a1  \n\
endin   \n\
   \n\
  \n\
f1 0 1024 10 1  \n\
i1 0 100    \n\
 \n\
";

int hold;
/*create CppCsound class */
CppSound csound;
/* set the csd text */
csound.setCSD(csdText);
/* export csd text for performance */
csound.exportForPerformance();
/* compile csd text */
csound.compile();

/*create performance thread */
CsoundPerformanceThread thread(csound.GetCsound());
cout << “Press 1 to play, 2 to pause and 0 to quit\n”;
while(1){
cin >> hold;
if(hold==1){
	thread.Play();
	hold = 0;
	}
else if(hold==2){
	thread.Pause();
	hold=0;
	}
}
}

Jacob Joaquin wrote:
> I guess the biggest problem I'm having is the lack of documentation.  I've
> downloaded the Csound API Reference pdf at sourceforge, and it appears that
> the listed CppSound.hpp class reference doesn't quite jive with the methods
> of the csnd.jar.  For example, I'm not finding any methods that can set the
> orchestra.
> 
>>
> 

Date2008-05-11 01:16
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Csound API: Can I compile an orc from a String instead of a .csd?
AttachmentsNone