Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] CppSound and CsoundPerformanceThread..

Date2008-01-31 18:17
FromMichael Gogins
SubjectRe: [Cs-dev] CppSound and CsoundPerformanceThread..
They are not deleted afterwards. Personally, I want them around to document the rendering so I can recreate it or modify it later. There are number of pieces that I have lost because I did not do this, or did not lose because I still had the temporary files around (I used to do each rendering in its own directory, now I change the temp filenames to match a master filename).

In addition to this personal philosophical preference for the temporary files, there is a technical reason. The Csound orchestra and score parsers need the orc and sco to be files on a disk. This should probably be changed -- not everyone is like me. You would like to create the orc and sco in memory and render from that, correct?

For now, if you are writing a front end, I suggest you create a RAM disk and write to that. This might or might not work for you: http://www.cenatek.com/product_page_ramdisk_download.php

You may also be able to find open source for a RAM disk somewhere. 

It would actually be a very useful addition to Csound to be able to render from memory; contemporary computers usually have much more than enough RAM for these text files.

It might also be possible to change the Csound internals to be able to use pre-allocated memory buffers for this, or file handles that belong to a memory stream. I will look at this latter idea again to see if it is possible. It is easily possible in C++ but I do not know about C.

Hope this helps,
Mike

-----Original Message-----
>From: Rory Walsh 
>Sent: Jan 31, 2008 12:01 PM
>To: Developer discussions 
>Subject: Re: [Cs-dev] CppSound and CsoundPerformanceThread..
>
>Thanks Mike, and Cesare for your help. Do the temp files get deleted 
>afterwards? I thought using these methods would allow me to do away with 
>temp files altogether. If users run one of my frontends without write 
>access to a particular disk the program will fail. I guess the same 
>thing can happen using these methods or am I wrong?
>
>Rory.
>
>
>
>
>Michael Gogins wrote:
>> You need a dummy orc and sco name in the options to export to, e.g.:
>> 
>> csound -odevaudio -b10 -idevaudio  temp.orc temp.sco
>> 
>> I always use a complete command line of the sort that I would type on the console.
>> 
>> Hope this helps,
>> Mike
>> 
>> 
>> -----Original Message-----
>>> From: Rory Walsh 
>>> Sent: Jan 31, 2008 10:31 AM
>>> To: Developer discussions 
>>> Subject: [Cs-dev] CppSound and CsoundPerformanceThread..
>>>
>>> CppSound and CsoundPerformanceThread work fine for me until I try the 
>>> setCSD() and exportForPerformance() methods. What am I missing from the 
>>> code below?
>>>
>>> Rory.
>>>
>>>
>>>
>>> int main()
>>> {
>>> std::string csdText = " \
>>>  \
>>> -odevaudio -b10 -idevaudio \
>>>  \
>>>  \
>>> sr = 44100 \
>>> kr = 44100 \
>>> ksmps = 1 \
>>> nchnls = 1 \
>>> instr 1 \
>>> a1 oscil 10000, 440, 1 \
>>> out a1 \
>>> endin  \
>>>   \
>>>  \
>>> f1 0 1024 10 1 \
>>> i1 0 100   \
>>>  \
>>> ";
>>>
>>> CppSound csound;
>>> csound.PreCompile();
>>> csound.setCSD(csdText);
>>> csound.exportForPerformance();
>>>
>>> /*works with the standard compile method
>>> csound.Compile("basic1.csd");*/
>>>
>>> CsoundPerformanceThread thread(csound.getCsound());
>>> thread.Play();
>>> while(!thread.GetStatus());
>>> }
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> You 
>> 
>> 
>> 
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2008.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-31 18:56
FromRory Walsh
SubjectRe: [Cs-dev] CppSound and CsoundPerformanceThread..
Thanks Mike, that's exactly what I was trying to do, i.e., create the 
orc and sco in memory and render from that. Personally I'm more than 
happy to do it the other way and I can't see it ever being a problem for 
my work. By the way is there a set or append csoptions method somewhere?

Rory.



Michael Gogins wrote:
> They are not deleted afterwards. Personally, I want them around to document the rendering so I can recreate it or modify it later. There are number of pieces that I have lost because I did not do this, or did not lose because I still had the temporary files around (I used to do each rendering in its own directory, now I change the temp filenames to match a master filename).
> 
> In addition to this personal philosophical preference for the temporary files, there is a technical reason. The Csound orchestra and score parsers need the orc and sco to be files on a disk. This should probably be changed -- not everyone is like me. You would like to create the orc and sco in memory and render from that, correct?
> 
> For now, if you are writing a front end, I suggest you create a RAM disk and write to that. This might or might not work for you: http://www.cenatek.com/product_page_ramdisk_download.php
> 
> You ma

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-01-31 21:05
FromJonatan Liljedahl
SubjectRe: [Cs-dev] CppSound and CsoundPerformanceThread..
Michael Gogins wrote:
> They are not deleted afterwards. Personally, I want them around to
> document the rendering so I can recreate it or modify it later. There
> are number of pieces that I have lost because I did not do this, or
> did not lose because I still had the temporary files around (I used
> to do each rendering in its own directory, now I change the temp
> filenames to match a master filename).

Are you talking about the ones that the SetCSD() stuff is creating
(because csound can only parse files, not strings) and not the
/tmp/fileXXX.* files? (because these are deleted as they should, at
least for me)

> In addition to this personal philosophical preference for the
> temporary files, there is a technical reason. The Csound orchestra
> and score parsers need the orc and sco to be files on a disk. This
> should probably be changed -- not everyone is like me. You would like
> to create the orc and sco in memory and render from that, correct?
...
> It might also be possible to change the Csound internals to be able
> to use pre-allocated memory buffers for this, or file handles that
> belong to a memory stream. I will look at this latter idea again to
> see if it is possible. It is easily possible in C++ but I do not know
> about C.

How does the parsers look? Do they use filedescriptors or FILE* streams?
It should be "easy" to just allocate buffers and use these instead, and
do stuff like c = *buf++ instead of c = fgetc(f), or sscanf() instead of
scanf(), memcpy() instead of read(), etc...

-- 
/Jonatan         [ http://kymatica.com ]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net