Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h

Date2009-04-11 20:38
Frommichael.gogins@gmail.com
Subject[Csnd] Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
Attachmentsaudio_out_lister.py  
Okay, I wasn't aware that you could get your list of interfaces on Windows 
and Linux, but not on the Mac. Why is that? Sorry I'm not a Mac expert, I'm 
just curious.

You can use ctypes to do exactly what we did in the example program, only 
from Python. For that matter, you can use ctypes to call into whatever audio 
interface libraries you have available on your system, or into PortAudio, 
for example. On Windows, you can use ctypes and Python to directly get a 
list of available audio interfaces. I enclose a script that does just that; 
perhaps it can serve as an introduction to the use of ctypes.

You could do the same thing on any other system where the audio interface 
descriptions are available from a shared library (this usually means the 
operating system, also).

On the other hand, why use Python? Why not use C++ directly for your whole 
project, since you know it? You would have a lot more power that way, a 
self-contained application, and more efficiency.

Regards,
Mike


----- Original Message ----- 
From: "Chuckk Hubbard" 
To: 
Sent: Saturday, April 11, 2009 2:22 PM
Subject: [Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h


It helps a great deal, especially the comments.  I wasn't trying to
make sound, myself, I just want to get a list of available -odac
values, by specifying one that doesn't work.  I can do this using
Python for Windows and Linux, but not Mac.  I still have to make the
part that captures and parses the output; probably just send the whole
output back to Python, since I already have the code to parse it.

I didn't realize I had two CppSound instances, and I saw on looking
again that I used both the C++ and Python initializing commands:
CppSound cs;
and later
cs = CppSound();
taking out the Python one fixes that traceback.  I guess I was
thinking of declaring and later initializing.  I really do know better
than that, it just slipped past me.

The reason for -+rtaudio without a module is that argv[1] is going to
be the module to check for DACs, called from Python when the user
selects a module.

> Thanks for the stimulus to produce a working example of how to use C++ in 
> a
> very simple way with Csound.

Glad I could contribute, in my own oblivious way.

-Chuckk

On Sat, Apr 11, 2009 at 6:58 PM,   wrote:
> I've taken the liberty of rewriting your example pretty completely. I 
> wanted
> the example to produce a real sound, I wanted it to link with just a 
> regular
> installation of Csound (not a build setup), and I wanted the code to be as
> simple and clear as possible.
>
> I have included an SConstruct file that builds the example on my 
> MinGW/MSys
> setup using only the headers and libraries installed by the Windows Csound
> installer. And, I have added comments to both the SConstruct file and the
> source code file. My build of the example compiles without errors, 
> produces
> a real-time sound, and exits without any errors or backtraces.
>
> I don't know specifically why you were getting a backtrace. Possibly 
> because
> you have two instances of CppSound in your program, when only one is
> required. Or possibly because you specify -+rtaudio without the name of an
> rtaudio module.
>
> Thanks for the stimulus to produce a working example of how to use C++ in 
> a
> very simple way with Csound.
>
> Hope this helps,
> Mike
>
> ----- Original Message ----- From: "Chuckk Hubbard"
> 
> To: 
> Sent: Saturday, April 11, 2009 9:31 AM
> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>
>
> Hi Mike.
> Thanks a lot for the info (and the class). I just signed on to report
> that I had found the answer in your refman.pdf, to include CppSound.h
> and link to libcsound and lib_csnd.
>
> I'm getting a pretty big backtrace, though, and Csound is aborting
> from the attached test2.cpp compiled with the attached g++ command. I
> don't think I did anything wrong with the CppSound part. I cobbled
> together the string manipulations from several folks' suggestions, but
> everything runs fine if I comment out cs.compile().
> The program is meant to be run simply with an argument of the name of
> a real-time module, e.g. portaudio.
>
> Can anyone spot what I'm doing wrong? (in this program specifically,
> not in my life in general)
>
> -Chuckk
>
> On Sat, Apr 11, 2009 at 3:30 PM,  wrote:
>>
>> Nope.
>>
>> The CsoundFile class, which is one of the classes from which CppSound
>> derives, contains in memory the Csound orchestra, score, and command line
>> (hence the need for the exportForPerformance() call before rendering). 
>> The
>> Csound class declared in csound.hpp, on the other hand, only deals with
>> Csound files on the disk.
>>
>> The CsoundFile class was developed by me for use in CsoundVST. VST songs
>> are
>> required to contain all data for plugin patches in memory, hence I needed
>> to
>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>
>> If, for some reason, you do not wish to, or cannot, use CppSound, then 
>> you
>> can maintain your own copy of the Csound csd file or its parts in memory
>> using your own code, and save them to the disk before using the Csound
>> class
>> to render them.
>>
>> But why not just use CppSound? This is exactly what it is designed for,
>> and
>> as far as I can see it works just fine.
>>
>> The CppSound class also derives from the Csound class, so anything you 
>> can
>> do with the Csound class you can also do with CppSound.
>>
>> Hope this helps,
>> Mike
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: "Csound List" 
>> Sent: Saturday, April 11, 2009 6:40 AM
>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>
>>
>>> Hello.
>>> I want to pass a string to a Csound instance using C++, either to
>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>> appears the standard input arguments for the functions in csound.h and
>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>> CppSound class, which is derived from CsoundFile, which has the
>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>> method with the classes in csound.h/csound.hpp?
>>>
>>> -Chuckk
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"



-- 
http://www.badmuthahubbard.com


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound" 

Date2009-04-11 21:25
Fromvictor
Subject[Csnd] Re: Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
AFAIK, if you do -odac99 on the mac you get a list of interfaces just
as elsewhere.

Victor
----- Original Message ----- 
From: 
To: 
Sent: Saturday, April 11, 2009 8:38 PM
Subject: [Csnd] Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h


> Okay, I wasn't aware that you could get your list of interfaces on Windows
> and Linux, but not on the Mac. Why is that? Sorry I'm not a Mac expert, 
> I'm
> just curious.
>
> You can use ctypes to do exactly what we did in the example program, only
> from Python. For that matter, you can use ctypes to call into whatever 
> audio
> interface libraries you have available on your system, or into PortAudio,
> for example. On Windows, you can use ctypes and Python to directly get a
> list of available audio interfaces. I enclose a script that does just 
> that;
> perhaps it can serve as an introduction to the use of ctypes.
>
> You could do the same thing on any other system where the audio interface
> descriptions are available from a shared library (this usually means the
> operating system, also).
>
> On the other hand, why use Python? Why not use C++ directly for your whole
> project, since you know it? You would have a lot more power that way, a
> self-contained application, and more efficiency.
>
> Regards,
> Mike
>
>
> ----- Original Message ----- 
> From: "Chuckk Hubbard" 
> To: 
> Sent: Saturday, April 11, 2009 2:22 PM
> Subject: [Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h
>
>
> It helps a great deal, especially the comments.  I wasn't trying to
> make sound, myself, I just want to get a list of available -odac
> values, by specifying one that doesn't work.  I can do this using
> Python for Windows and Linux, but not Mac.  I still have to make the
> part that captures and parses the output; probably just send the whole
> output back to Python, since I already have the code to parse it.
>
> I didn't realize I had two CppSound instances, and I saw on looking
> again that I used both the C++ and Python initializing commands:
> CppSound cs;
> and later
> cs = CppSound();
> taking out the Python one fixes that traceback.  I guess I was
> thinking of declaring and later initializing.  I really do know better
> than that, it just slipped past me.
>
> The reason for -+rtaudio without a module is that argv[1] is going to
> be the module to check for DACs, called from Python when the user
> selects a module.
>
>> Thanks for the stimulus to produce a working example of how to use C++ in
>> a
>> very simple way with Csound.
>
> Glad I could contribute, in my own oblivious way.
>
> -Chuckk
>
> On Sat, Apr 11, 2009 at 6:58 PM,   wrote:
>> I've taken the liberty of rewriting your example pretty completely. I
>> wanted
>> the example to produce a real sound, I wanted it to link with just a
>> regular
>> installation of Csound (not a build setup), and I wanted the code to be 
>> as
>> simple and clear as possible.
>>
>> I have included an SConstruct file that builds the example on my
>> MinGW/MSys
>> setup using only the headers and libraries installed by the Windows 
>> Csound
>> installer. And, I have added comments to both the SConstruct file and the
>> source code file. My build of the example compiles without errors,
>> produces
>> a real-time sound, and exits without any errors or backtraces.
>>
>> I don't know specifically why you were getting a backtrace. Possibly
>> because
>> you have two instances of CppSound in your program, when only one is
>> required. Or possibly because you specify -+rtaudio without the name of 
>> an
>> rtaudio module.
>>
>> Thanks for the stimulus to produce a working example of how to use C++ in
>> a
>> very simple way with Csound.
>>
>> Hope this helps,
>> Mike
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: 
>> Sent: Saturday, April 11, 2009 9:31 AM
>> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>>
>>
>> Hi Mike.
>> Thanks a lot for the info (and the class). I just signed on to report
>> that I had found the answer in your refman.pdf, to include CppSound.h
>> and link to libcsound and lib_csnd.
>>
>> I'm getting a pretty big backtrace, though, and Csound is aborting
>> from the attached test2.cpp compiled with the attached g++ command. I
>> don't think I did anything wrong with the CppSound part. I cobbled
>> together the string manipulations from several folks' suggestions, but
>> everything runs fine if I comment out cs.compile().
>> The program is meant to be run simply with an argument of the name of
>> a real-time module, e.g. portaudio.
>>
>> Can anyone spot what I'm doing wrong? (in this program specifically,
>> not in my life in general)
>>
>> -Chuckk
>>
>> On Sat, Apr 11, 2009 at 3:30 PM,  wrote:
>>>
>>> Nope.
>>>
>>> The CsoundFile class, which is one of the classes from which CppSound
>>> derives, contains in memory the Csound orchestra, score, and command 
>>> line
>>> (hence the need for the exportForPerformance() call before rendering).
>>> The
>>> Csound class declared in csound.hpp, on the other hand, only deals with
>>> Csound files on the disk.
>>>
>>> The CsoundFile class was developed by me for use in CsoundVST. VST songs
>>> are
>>> required to contain all data for plugin patches in memory, hence I 
>>> needed
>>> to
>>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>>
>>> If, for some reason, you do not wish to, or cannot, use CppSound, then
>>> you
>>> can maintain your own copy of the Csound csd file or its parts in memory
>>> using your own code, and save them to the disk before using the Csound
>>> class
>>> to render them.
>>>
>>> But why not just use CppSound? This is exactly what it is designed for,
>>> and
>>> as far as I can see it works just fine.
>>>
>>> The CppSound class also derives from the Csound class, so anything you
>>> can
>>> do with the Csound class you can also do with CppSound.
>>>
>>> Hope this helps,
>>> Mike
>>>
>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>> 
>>> To: "Csound List" 
>>> Sent: Saturday, April 11, 2009 6:40 AM
>>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>>
>>>
>>>> Hello.
>>>> I want to pass a string to a Csound instance using C++, either to
>>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>>> appears the standard input arguments for the functions in csound.h and
>>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>>> CppSound class, which is derived from CsoundFile, which has the
>>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>>> method with the classes in csound.h/csound.hpp?
>>>>
>>>> -Chuckk
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body 
>>>> "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> -- 
> http://www.badmuthahubbard.com
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-04-11 23:45
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
This is what made me ask about .setPythonMessageCallback() on Mac,
though; without that, unless I'm mistaken, I can't actually parse the
interface list.  I have to look at Mike's suggestion, though, because
directly querying the OS seems far more efficient.

-Chuckk

On Sat, Apr 11, 2009 at 11:25 PM, victor  wrote:
> AFAIK, if you do -odac99 on the mac you get a list of interfaces just
> as elsewhere.
>
> Victor
> ----- Original Message ----- From: 
> To: 
> Sent: Saturday, April 11, 2009 8:38 PM
> Subject: [Csnd] Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
>
>
>> Okay, I wasn't aware that you could get your list of interfaces on Windows
>> and Linux, but not on the Mac. Why is that? Sorry I'm not a Mac expert,
>> I'm
>> just curious.
>>
>> You can use ctypes to do exactly what we did in the example program, only
>> from Python. For that matter, you can use ctypes to call into whatever
>> audio
>> interface libraries you have available on your system, or into PortAudio,
>> for example. On Windows, you can use ctypes and Python to directly get a
>> list of available audio interfaces. I enclose a script that does just
>> that;
>> perhaps it can serve as an introduction to the use of ctypes.
>>
>> You could do the same thing on any other system where the audio interface
>> descriptions are available from a shared library (this usually means the
>> operating system, also).
>>
>> On the other hand, why use Python? Why not use C++ directly for your whole
>> project, since you know it? You would have a lot more power that way, a
>> self-contained application, and more efficiency.
>>
>> Regards,
>> Mike
>>
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: 
>> Sent: Saturday, April 11, 2009 2:22 PM
>> Subject: [Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h
>>
>>
>> It helps a great deal, especially the comments.  I wasn't trying to
>> make sound, myself, I just want to get a list of available -odac
>> values, by specifying one that doesn't work.  I can do this using
>> Python for Windows and Linux, but not Mac.  I still have to make the
>> part that captures and parses the output; probably just send the whole
>> output back to Python, since I already have the code to parse it.
>>
>> I didn't realize I had two CppSound instances, and I saw on looking
>> again that I used both the C++ and Python initializing commands:
>> CppSound cs;
>> and later
>> cs = CppSound();
>> taking out the Python one fixes that traceback.  I guess I was
>> thinking of declaring and later initializing.  I really do know better
>> than that, it just slipped past me.
>>
>> The reason for -+rtaudio without a module is that argv[1] is going to
>> be the module to check for DACs, called from Python when the user
>> selects a module.
>>
>>> Thanks for the stimulus to produce a working example of how to use C++ in
>>> a
>>> very simple way with Csound.
>>
>> Glad I could contribute, in my own oblivious way.
>>
>> -Chuckk
>>
>> On Sat, Apr 11, 2009 at 6:58 PM,   wrote:
>>>
>>> I've taken the liberty of rewriting your example pretty completely. I
>>> wanted
>>> the example to produce a real sound, I wanted it to link with just a
>>> regular
>>> installation of Csound (not a build setup), and I wanted the code to be
>>> as
>>> simple and clear as possible.
>>>
>>> I have included an SConstruct file that builds the example on my
>>> MinGW/MSys
>>> setup using only the headers and libraries installed by the Windows
>>> Csound
>>> installer. And, I have added comments to both the SConstruct file and the
>>> source code file. My build of the example compiles without errors,
>>> produces
>>> a real-time sound, and exits without any errors or backtraces.
>>>
>>> I don't know specifically why you were getting a backtrace. Possibly
>>> because
>>> you have two instances of CppSound in your program, when only one is
>>> required. Or possibly because you specify -+rtaudio without the name of
>>> an
>>> rtaudio module.
>>>
>>> Thanks for the stimulus to produce a working example of how to use C++ in
>>> a
>>> very simple way with Csound.
>>>
>>> Hope this helps,
>>> Mike
>>>
>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>> 
>>> To: 
>>> Sent: Saturday, April 11, 2009 9:31 AM
>>> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>>>
>>>
>>> Hi Mike.
>>> Thanks a lot for the info (and the class). I just signed on to report
>>> that I had found the answer in your refman.pdf, to include CppSound.h
>>> and link to libcsound and lib_csnd.
>>>
>>> I'm getting a pretty big backtrace, though, and Csound is aborting
>>> from the attached test2.cpp compiled with the attached g++ command. I
>>> don't think I did anything wrong with the CppSound part. I cobbled
>>> together the string manipulations from several folks' suggestions, but
>>> everything runs fine if I comment out cs.compile().
>>> The program is meant to be run simply with an argument of the name of
>>> a real-time module, e.g. portaudio.
>>>
>>> Can anyone spot what I'm doing wrong? (in this program specifically,
>>> not in my life in general)
>>>
>>> -Chuckk
>>>
>>> On Sat, Apr 11, 2009 at 3:30 PM,  wrote:
>>>>
>>>> Nope.
>>>>
>>>> The CsoundFile class, which is one of the classes from which CppSound
>>>> derives, contains in memory the Csound orchestra, score, and command
>>>> line
>>>> (hence the need for the exportForPerformance() call before rendering).
>>>> The
>>>> Csound class declared in csound.hpp, on the other hand, only deals with
>>>> Csound files on the disk.
>>>>
>>>> The CsoundFile class was developed by me for use in CsoundVST. VST songs
>>>> are
>>>> required to contain all data for plugin patches in memory, hence I
>>>> needed
>>>> to
>>>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>>>
>>>> If, for some reason, you do not wish to, or cannot, use CppSound, then
>>>> you
>>>> can maintain your own copy of the Csound csd file or its parts in memory
>>>> using your own code, and save them to the disk before using the Csound
>>>> class
>>>> to render them.
>>>>
>>>> But why not just use CppSound? This is exactly what it is designed for,
>>>> and
>>>> as far as I can see it works just fine.
>>>>
>>>> The CppSound class also derives from the Csound class, so anything you
>>>> can
>>>> do with the Csound class you can also do with CppSound.
>>>>
>>>> Hope this helps,
>>>> Mike
>>>>
>>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>>> 
>>>> To: "Csound List" 
>>>> Sent: Saturday, April 11, 2009 6:40 AM
>>>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>>>
>>>>
>>>>> Hello.
>>>>> I want to pass a string to a Csound instance using C++, either to
>>>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>>>> appears the standard input arguments for the functions in csound.h and
>>>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>>>> CppSound class, which is derived from CsoundFile, which has the
>>>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>>>> method with the classes in csound.h/csound.hpp?
>>>>>
>>>>> -Chuckk
>>>>>
>>>>> --
>>>>> http://www.badmuthahubbard.com
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>>> "unsubscribe
>>>>> csound"
>>>>>
>>>>
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>



-- 
http://www.badmuthahubbard.com


Date2009-04-11 23:49
Fromvictor
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
True. I need to fix that. As I said it's just a matter of removing the 
#ifdefs for
OSX in pyhton_interface.i, but I need to test it (and protect the 2.3 build
which still exists). I won't be in front of a Mac for a week, though.

Victor
----- Original Message ----- 
From: "Chuckk Hubbard" 
To: 
Sent: Saturday, April 11, 2009 11:45 PM
Subject: [Csnd] Re: Re: Re: Re: Re: Re: Re: Setting options/orc/sco using 
csound.h


This is what made me ask about .setPythonMessageCallback() on Mac,
though; without that, unless I'm mistaken, I can't actually parse the
interface list.  I have to look at Mike's suggestion, though, because
directly querying the OS seems far more efficient.

-Chuckk

On Sat, Apr 11, 2009 at 11:25 PM, victor  wrote:
> AFAIK, if you do -odac99 on the mac you get a list of interfaces just
> as elsewhere.
>
> Victor
> ----- Original Message ----- From: 
> To: 
> Sent: Saturday, April 11, 2009 8:38 PM
> Subject: [Csnd] Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
>
>
>> Okay, I wasn't aware that you could get your list of interfaces on 
>> Windows
>> and Linux, but not on the Mac. Why is that? Sorry I'm not a Mac expert,
>> I'm
>> just curious.
>>
>> You can use ctypes to do exactly what we did in the example program, only
>> from Python. For that matter, you can use ctypes to call into whatever
>> audio
>> interface libraries you have available on your system, or into PortAudio,
>> for example. On Windows, you can use ctypes and Python to directly get a
>> list of available audio interfaces. I enclose a script that does just
>> that;
>> perhaps it can serve as an introduction to the use of ctypes.
>>
>> You could do the same thing on any other system where the audio interface
>> descriptions are available from a shared library (this usually means the
>> operating system, also).
>>
>> On the other hand, why use Python? Why not use C++ directly for your 
>> whole
>> project, since you know it? You would have a lot more power that way, a
>> self-contained application, and more efficiency.
>>
>> Regards,
>> Mike
>>
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: 
>> Sent: Saturday, April 11, 2009 2:22 PM
>> Subject: [Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h
>>
>>
>> It helps a great deal, especially the comments. I wasn't trying to
>> make sound, myself, I just want to get a list of available -odac
>> values, by specifying one that doesn't work. I can do this using
>> Python for Windows and Linux, but not Mac. I still have to make the
>> part that captures and parses the output; probably just send the whole
>> output back to Python, since I already have the code to parse it.
>>
>> I didn't realize I had two CppSound instances, and I saw on looking
>> again that I used both the C++ and Python initializing commands:
>> CppSound cs;
>> and later
>> cs = CppSound();
>> taking out the Python one fixes that traceback. I guess I was
>> thinking of declaring and later initializing. I really do know better
>> than that, it just slipped past me.
>>
>> The reason for -+rtaudio without a module is that argv[1] is going to
>> be the module to check for DACs, called from Python when the user
>> selects a module.
>>
>>> Thanks for the stimulus to produce a working example of how to use C++ 
>>> in
>>> a
>>> very simple way with Csound.
>>
>> Glad I could contribute, in my own oblivious way.
>>
>> -Chuckk
>>
>> On Sat, Apr 11, 2009 at 6:58 PM,  wrote:
>>>
>>> I've taken the liberty of rewriting your example pretty completely. I
>>> wanted
>>> the example to produce a real sound, I wanted it to link with just a
>>> regular
>>> installation of Csound (not a build setup), and I wanted the code to be
>>> as
>>> simple and clear as possible.
>>>
>>> I have included an SConstruct file that builds the example on my
>>> MinGW/MSys
>>> setup using only the headers and libraries installed by the Windows
>>> Csound
>>> installer. And, I have added comments to both the SConstruct file and 
>>> the
>>> source code file. My build of the example compiles without errors,
>>> produces
>>> a real-time sound, and exits without any errors or backtraces.
>>>
>>> I don't know specifically why you were getting a backtrace. Possibly
>>> because
>>> you have two instances of CppSound in your program, when only one is
>>> required. Or possibly because you specify -+rtaudio without the name of
>>> an
>>> rtaudio module.
>>>
>>> Thanks for the stimulus to produce a working example of how to use C++ 
>>> in
>>> a
>>> very simple way with Csound.
>>>
>>> Hope this helps,
>>> Mike
>>>
>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>> 
>>> To: 
>>> Sent: Saturday, April 11, 2009 9:31 AM
>>> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>>>
>>>
>>> Hi Mike.
>>> Thanks a lot for the info (and the class). I just signed on to report
>>> that I had found the answer in your refman.pdf, to include CppSound.h
>>> and link to libcsound and lib_csnd.
>>>
>>> I'm getting a pretty big backtrace, though, and Csound is aborting
>>> from the attached test2.cpp compiled with the attached g++ command. I
>>> don't think I did anything wrong with the CppSound part. I cobbled
>>> together the string manipulations from several folks' suggestions, but
>>> everything runs fine if I comment out cs.compile().
>>> The program is meant to be run simply with an argument of the name of
>>> a real-time module, e.g. portaudio.
>>>
>>> Can anyone spot what I'm doing wrong? (in this program specifically,
>>> not in my life in general)
>>>
>>> -Chuckk
>>>
>>> On Sat, Apr 11, 2009 at 3:30 PM,  wrote:
>>>>
>>>> Nope.
>>>>
>>>> The CsoundFile class, which is one of the classes from which CppSound
>>>> derives, contains in memory the Csound orchestra, score, and command
>>>> line
>>>> (hence the need for the exportForPerformance() call before rendering).
>>>> The
>>>> Csound class declared in csound.hpp, on the other hand, only deals with
>>>> Csound files on the disk.
>>>>
>>>> The CsoundFile class was developed by me for use in CsoundVST. VST 
>>>> songs
>>>> are
>>>> required to contain all data for plugin patches in memory, hence I
>>>> needed
>>>> to
>>>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>>>
>>>> If, for some reason, you do not wish to, or cannot, use CppSound, then
>>>> you
>>>> can maintain your own copy of the Csound csd file or its parts in 
>>>> memory
>>>> using your own code, and save them to the disk before using the Csound
>>>> class
>>>> to render them.
>>>>
>>>> But why not just use CppSound? This is exactly what it is designed for,
>>>> and
>>>> as far as I can see it works just fine.
>>>>
>>>> The CppSound class also derives from the Csound class, so anything you
>>>> can
>>>> do with the Csound class you can also do with CppSound.
>>>>
>>>> Hope this helps,
>>>> Mike
>>>>
>>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>>> 
>>>> To: "Csound List" 
>>>> Sent: Saturday, April 11, 2009 6:40 AM
>>>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>>>
>>>>
>>>>> Hello.
>>>>> I want to pass a string to a Csound instance using C++, either to
>>>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>>>> appears the standard input arguments for the functions in csound.h and
>>>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>>>> CppSound class, which is derived from CsoundFile, which has the
>>>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>>>> method with the classes in csound.h/csound.hpp?
>>>>>
>>>>> -Chuckk
>>>>>
>>>>> --
>>>>> http://www.badmuthahubbard.com
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>>> "unsubscribe
>>>>> csound"
>>>>>
>>>>
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body 
>>>> "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>



-- 
http://www.badmuthahubbard.com


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound"= 


Date2009-04-11 23:59
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Re: Re: Setting options/orc/sco using csound.h
I see now that I explained none of this in my original post.  I can
see the list on Mac, but I can't redirect the output to Python,
something to do with setPythonMessageCallback().  I have yet to try
compiling anything in C++ on Mac, but I'm always optimistic, sometimes
sarcastically so.
Thanks very much for the audio devices script, my mouth is watering already.
As for using Python, I found it simpler to learn, and as of now I can
code much faster in Python (I learned to use both Python and C++ since
starting this project), and it's now a big bunch of code.  I can see
lots of flaws in it that I didn't consider before, so I might just
convert it some day and replace them with new flaws.  A self-contained
application would be very very nice too.
-Chuckk

On Sat, Apr 11, 2009 at 10:38 PM,   wrote:
> Okay, I wasn't aware that you could get your list of interfaces on Windows
> and Linux, but not on the Mac. Why is that? Sorry I'm not a Mac expert, I'm
> just curious.
>
> You can use ctypes to do exactly what we did in the example program, only
> from Python. For that matter, you can use ctypes to call into whatever audio
> interface libraries you have available on your system, or into PortAudio,
> for example. On Windows, you can use ctypes and Python to directly get a
> list of available audio interfaces. I enclose a script that does just that;
> perhaps it can serve as an introduction to the use of ctypes.
>
> You could do the same thing on any other system where the audio interface
> descriptions are available from a shared library (this usually means the
> operating system, also).
>
> On the other hand, why use Python? Why not use C++ directly for your whole
> project, since you know it? You would have a lot more power that way, a
> self-contained application, and more efficiency.
>
> Regards,
> Mike
>
>
> ----- Original Message ----- From: "Chuckk Hubbard"
> 
> To: 
> Sent: Saturday, April 11, 2009 2:22 PM
> Subject: [Csnd] Re: Re: Re: Re: Setting options/orc/sco using csound.h
>
>
> It helps a great deal, especially the comments.  I wasn't trying to
> make sound, myself, I just want to get a list of available -odac
> values, by specifying one that doesn't work.  I can do this using
> Python for Windows and Linux, but not Mac.  I still have to make the
> part that captures and parses the output; probably just send the whole
> output back to Python, since I already have the code to parse it.
>
> I didn't realize I had two CppSound instances, and I saw on looking
> again that I used both the C++ and Python initializing commands:
> CppSound cs;
> and later
> cs = CppSound();
> taking out the Python one fixes that traceback.  I guess I was
> thinking of declaring and later initializing.  I really do know better
> than that, it just slipped past me.
>
> The reason for -+rtaudio without a module is that argv[1] is going to
> be the module to check for DACs, called from Python when the user
> selects a module.
>
>> Thanks for the stimulus to produce a working example of how to use C++ in
>> a
>> very simple way with Csound.
>
> Glad I could contribute, in my own oblivious way.
>
> -Chuckk
>
> On Sat, Apr 11, 2009 at 6:58 PM,   wrote:
>>
>> I've taken the liberty of rewriting your example pretty completely. I
>> wanted
>> the example to produce a real sound, I wanted it to link with just a
>> regular
>> installation of Csound (not a build setup), and I wanted the code to be as
>> simple and clear as possible.
>>
>> I have included an SConstruct file that builds the example on my
>> MinGW/MSys
>> setup using only the headers and libraries installed by the Windows Csound
>> installer. And, I have added comments to both the SConstruct file and the
>> source code file. My build of the example compiles without errors,
>> produces
>> a real-time sound, and exits without any errors or backtraces.
>>
>> I don't know specifically why you were getting a backtrace. Possibly
>> because
>> you have two instances of CppSound in your program, when only one is
>> required. Or possibly because you specify -+rtaudio without the name of an
>> rtaudio module.
>>
>> Thanks for the stimulus to produce a working example of how to use C++ in
>> a
>> very simple way with Csound.
>>
>> Hope this helps,
>> Mike
>>
>> ----- Original Message ----- From: "Chuckk Hubbard"
>> 
>> To: 
>> Sent: Saturday, April 11, 2009 9:31 AM
>> Subject: [Csnd] Re: Re: Setting options/orc/sco using csound.h
>>
>>
>> Hi Mike.
>> Thanks a lot for the info (and the class). I just signed on to report
>> that I had found the answer in your refman.pdf, to include CppSound.h
>> and link to libcsound and lib_csnd.
>>
>> I'm getting a pretty big backtrace, though, and Csound is aborting
>> from the attached test2.cpp compiled with the attached g++ command. I
>> don't think I did anything wrong with the CppSound part. I cobbled
>> together the string manipulations from several folks' suggestions, but
>> everything runs fine if I comment out cs.compile().
>> The program is meant to be run simply with an argument of the name of
>> a real-time module, e.g. portaudio.
>>
>> Can anyone spot what I'm doing wrong? (in this program specifically,
>> not in my life in general)
>>
>> -Chuckk
>>
>> On Sat, Apr 11, 2009 at 3:30 PM,  wrote:
>>>
>>> Nope.
>>>
>>> The CsoundFile class, which is one of the classes from which CppSound
>>> derives, contains in memory the Csound orchestra, score, and command line
>>> (hence the need for the exportForPerformance() call before rendering).
>>> The
>>> Csound class declared in csound.hpp, on the other hand, only deals with
>>> Csound files on the disk.
>>>
>>> The CsoundFile class was developed by me for use in CsoundVST. VST songs
>>> are
>>> required to contain all data for plugin patches in memory, hence I needed
>>> to
>>> store the Csound orchestra or csd file in memory, hence CsoundFile.
>>>
>>> If, for some reason, you do not wish to, or cannot, use CppSound, then
>>> you
>>> can maintain your own copy of the Csound csd file or its parts in memory
>>> using your own code, and save them to the disk before using the Csound
>>> class
>>> to render them.
>>>
>>> But why not just use CppSound? This is exactly what it is designed for,
>>> and
>>> as far as I can see it works just fine.
>>>
>>> The CppSound class also derives from the Csound class, so anything you
>>> can
>>> do with the Csound class you can also do with CppSound.
>>>
>>> Hope this helps,
>>> Mike
>>>
>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>> 
>>> To: "Csound List" 
>>> Sent: Saturday, April 11, 2009 6:40 AM
>>> Subject: [Csnd] Setting options/orc/sco using csound.h
>>>
>>>
>>>> Hello.
>>>> I want to pass a string to a Csound instance using C++, either to
>>>> "setCSD" or to individually set Command, Orchestra, and Score. It
>>>> appears the standard input arguments for the functions in csound.h and
>>>> csound.hpp expect filenames. csnd.h, on the other hand, has the
>>>> CppSound class, which is derived from CsoundFile, which has the
>>>> 'setCSD', etc. functions. Is there a way to emulate the .setCSD()
>>>> method with the classes in csound.h/csound.hpp?
>>>>
>>>> -Chuckk
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"



-- 
http://www.badmuthahubbard.com