Csound Csound-dev Csound-tekno Search About

[Csnd-dev] the ctcsound.setMessageCallback()

Date2019-08-01 01:39
From"Worrall, David"
Subject[Csnd-dev] the ctcsound.setMessageCallback()

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-01 09:34
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
Hi David,

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

François

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-01 19:25
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-01 20:47
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
Which OS on your machines?

François

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-01 22:07
FromEduardo Moguillansky
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

I don't know much about anaconda / conda, but using pip you can do

pip install ctcsound==6.13

and that will ensure that you install that specific version (otherwise it will install the latest version). When developing your own package that depends on ctcsound you can add ctcsound to the install_requires in the setup.py to automate the process.

On 01.08.19 20:25, Worrall, David wrote:

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-02 01:49
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-02 01:56
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Hi Eduardo,

Thanks for the tip.

I’m trying to arrive at a method for our IT people to set up/maintain installations in several labs.

Pip is part of the anaconda python packages so I’ll experiment with different versions/csound installations and see if that works.

 

David

 

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Eduardo Moguillansky <eduardo.moguillansky@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 16:07
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

I don't know much about anaconda / conda, but using pip you can do

pip install ctcsound==6.13

and that will ensure that you install that specific version (otherwise it will install the latest version). When developing your own package that depends on ctcsound you can add ctcsound to the install_requires in the setup.py to automate the process.

On 01.08.19 20:25, Worrall, David wrote:

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-02 07:40
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-02 08:39
Fromjoachim heintz
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
not sure it is what you (david) are asking, but i have this in my ~/.bashrc:
	export PYTHONPATH=${PYTHONPATH}:/path/to/my/ctcsound/folder

and i have no issues to work with anaconda python or another python on 
my (linux) system: 'import ctcsound' is always working.

	joachim



On 02/08/19 08:40, Francois PINOT wrote:
> ctcsound is a pure Python library. It detects the platform where it is
> loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the
> correct dynamic library. So it is effectively the same ctcsound.py  file
> that is used on linux, window, and OSX.
>
> Actually Csound is built with Python 2.7.x due to the compilation of the
> Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux
> system, I copy manually the ctcsound.py file into
> ~/.local/lib/python3.6/site-pacakages which is the user directory for
> Python3.6 packages, because the Csound build system put ctcsound.py into
> ~/.local/lib/python2.7/site-pacakages.
>
> You can display the python3 path on your system with this command:
> python3 -c "import sys; print(sys.path)"
>
> Then it is easy to write a script for copying ctcsound.py from the
> directory where the Csound installer put it into the python3 path.
>
> François
>
> Le ven. 2 août 2019 à 02:49, Worrall, David  > a écrit :
>
>     Sorry for the omission: OSX in this case. ____
>
>     I suspect this is a csound install issue. Maybe not.____
>
>     __ __
>
>     Is ctcsound the same across platforms for the same version of
>     Csound?____
>
>     __ __
>
>     Thanks,____
>
>     David____
>
>     __ __
>
>     __ __
>
>     *From: *Csound-developers      > on behalf of Francois PINOT
>     >
>     *Reply-To: *Csound-developers      >
>     *Date: *Thursday, August 1, 2019 at 14:47
>     *To: *"CSOUND-DEV@LISTSERV.HEANET.IE
>     "
>     >
>     *Subject: *Re: [Csnd-dev] the ctcsound.setMessageCallback()____
>
>     __ __
>
>     Which OS on your machines?____
>
>     __ __
>
>     François____
>
>     __ __
>
>     Le jeu. 1 août 2019 à 20:25, Worrall, David      > a écrit :____
>
>         Hi François,____
>
>         Thank you for your detailed reply. Much appreciated.____
>
>         I will try to implement an alternative, as you suggest.____
>
>          ____
>
>         I AM aware of the need to use the version of ctcsound that comes
>         with the csound installer. Yesterday I was just searching
>         quickly for online documentation…____
>
>          ____
>
>         On a related matter – should be a different post, I know :-) –
>         I’m doing installations on many machines. I always install
>         anaconda python first – and the csound installer picks it up OK.____
>
>         But somehow, access to ctcsound is not automatic.: following
>         installation, sometimes python import it, othertimes not and I
>         have to manually copy it to a general place.____
>
>         To make it a bit more complicated, Anaconda python does not use
>         $PYTHONPATH.____
>
>         Do you have a suggestion/mod for how to ensure that, following
>         installation, ctcsound will be available to the  python used
>         during the install?____
>
>          ____
>
>         Thank you for your assistance, and your work on this wonderful
>         tool!____
>
>          ____
>
>         Regards,____
>
>          ____
>
>         David____
>
>          ____
>
>         ---____
>
>         Dr David Worrall____
>
>         Professor, Audio Arts and Acoustics____
>
>         Columbia College Chicago____
>
>         33 E. Ida B. Wells Drive Room 601A____
>
>         Chicago, ILLINOIS, USA 60605____
>
>         Tel: (1)312.369.8821 Fax: (1)312.369.8427____
>
>         Wikipedia: David Worrall
>         ____
>
>         President, International Community for Auditory Display icad.org
>         ____
>
>         Personal research/creative practice website: avatar.com.au
>         ____
>
>         Some music/sonification: on soundcloud
>         
>               Youtube videos
>         ____
>
>         New Book: Sonification Design: From data to intelligible
>         soundfields
>         
>         (Springer)____
>
>          ____
>
>         *From: *Csound-developers          > on behalf of Francois
>         PINOT >
>         *Reply-To: *Csound-developers          >
>         *Date: *Thursday, August 1, 2019 at 03:35
>         *To: *"CSOUND-DEV@LISTSERV.HEANET.IE
>         "
>                  >
>         *Subject: *Re: [Csnd-dev] the ctcsound.setMessageCallback()____
>
>          ____
>
>         Hi David,____
>
>          ____
>
>         I didn't implement the setMessageCallback methods in ctcsound
>         because actually ctypes cannot translate correctly the varlist
>         arg. A workaround is to use the createMessageBuffer(False)
>         method of the Csound object. This will redirect all the messages
>         generated by Csound in a buffer that you can use as you want
>         with the firstMessage(), firstMessageAttr(), popFirstMessage(),
>         messageCnt() and destroyMessageBuffer() methods of the Csound
>         object.____
>
>          ____
>
>         Note that you should not use the pydoc version of ctcsound.py.
>         ctcsound.py is part of Csound and it is distributed within each
>         release of Csound. The reason is that if the API changes in a
>         release, those modifications are reflected in the ctcsound.py
>         file distributed  with this release. I don't now who uploaded
>         ctcsound.py to pydoc, but it wasn't a good idea.____
>
>          ____
>
>         François____
>
>          ____
>
>         Le jeu. 1 août 2019 à 02:39, Worrall, David          > a écrit :____
>
>             Hello All,____
>
>             I searched but couldn’t see a discussion on this so Perhaps
>             I’m missing something….____
>
>              ____
>
>             I’m looking at the ctcsound equivalent or workaround for
>             csnd6.SetMessageCallback()____
>
>              ____
>
>             In François’ documentation (thanks François), it says:____
>
>             https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback
>             ____
>
>             is says (my red)____
>
>             |UDPConsole|(/addr/, /port/, /mirror/)____
>
>             Turns on the transmission of console messages to UDP on
>             addr:port.____
>
>             If mirror is one, the messages will continue to be sent to
>             the usual destination (see setMessageCallback()) as well as
>             to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP
>             transmission could not be set up.____
>
>             and at http://pydoc.net/ctcsound/0.0.2/ctcsound/
>             
>             it shows:____
>
>             #def setDefaultMessageCallback():____
>
>                 ____
>
>             #def setMessageCallback():____
>
>              ____
>
>             Can someone please advise me, what the correct way of
>             setting a callback message?____
>
>             This is what I used to do using csnd6:____
>
>             cs = csnd6.Csound()____
>
>             def passCallback():____
>
>                 pass                        # suppress all terminal
>             output from CS____
>
>             TRACE = False____
>
>             if not TRACE:____
>
>                 cs.SetMessageCallback(passCallback())____
>
>              ____
>
>             Many thanks,____
>
>             David____
>
>              ____
>
>             ---____
>
>             Dr David Worrall____
>
>             Professor, Audio Arts and Acoustics____
>
>             Columbia College Chicago____
>
>             33 E. Ida B. Wells Drive Room 601A____
>
>             Chicago, ILLINOIS, USA 60605____
>
>             Tel: (1)312.369.8821 Fax: (1)312.369.8427____
>
>             Wikipedia: David Worrall
>             ____
>
>             Personal research/creative practice website: avatar.com.au
>             ____
>
>             Some music/sonification: on soundcloud
>             
>                   Youtube videos
>             ____
>
>              ____
>

Date2019-08-02 19:37
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Ah, that’s an excellent explanation, thanks François.

When I get a chance, I’ll test Eduardo’s  pip install suggestion and report back.

 

– I suspect that will be a more robust  solution for the tech support team.

David

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Friday, August 2, 2019 at 01:41
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

 

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

 

You can display the python3 path on your system with this command:

python3 -c "import sys; print(sys.path)"

 

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

 

François

 

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-02 19:38
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Hi Joachim,

 

Thanks.

Yes, that ‘normally’ works but, as I mentioned, Anaconda python doesn’t use $PYTHONPATH so it doesn’t work in that situation.

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of joachim heintz <jh@JOACHIMHEINTZ.DE>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Friday, August 2, 2019 at 02:39
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

not sure it is what you (david) are asking, but i have this in my ~/.bashrc:

                export PYTHONPATH=${PYTHONPATH}:/path/to/my/ctcsound/folder

 

and i have no issues to work with anaconda python or another python on

my (linux) system: 'import ctcsound' is always working.

 

                joachim

 

 

 

On 02/08/19 08:40, Francois PINOT wrote:

ctcsound is a pure Python library. It detects the platform where it is

loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the

correct dynamic library. So it is effectively the same ctcsound.py  file

that is used on linux, window, and OSX.

 

Actually Csound is built with Python 2.7.x due to the compilation of the

Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux

system, I copy manually the ctcsound.py file into

~/.local/lib/python3.6/site-pacakages which is the user directory for

Python3.6 packages, because the Csound build system put ctcsound.py into

~/.local/lib/python2.7/site-pacakages.

 

You can display the python3 path on your system with this command:

python3 -c "import sys; print(sys.path)"

 

Then it is easy to write a script for copying ctcsound.py from the

directory where the Csound installer put it into the python3 path.

 

François

 

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu

 

     Sorry for the omission: OSX in this case. ____

 

     I suspect this is a csound install issue. Maybe not.____

 

     __ __

 

     Is ctcsound the same across platforms for the same version of

     Csound?____

 

     __ __

 

     Thanks,____

 

     David____

 

     __ __

 

     __ __

 

     *From: *Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE

     <mailto:CSOUND-DEV@LISTSERV.HEANET.IE>> on behalf of Francois PINOT

     *Reply-To: *Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE

     *Date: *Thursday, August 1, 2019 at 14:47

     *Subject: *Re: [Csnd-dev] the ctcsound.setMessageCallback()____

 

     __ __

 

     Which OS on your machines?____

 

     __ __

 

     François____

 

     __ __

 

     Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu

     <mailto:dworrall@colum.edu>> a écrit :____

 

         Hi François,____

 

         Thank you for your detailed reply. Much appreciated.____

 

         I will try to implement an alternative, as you suggest.____

 

          ____

 

         I AM aware of the need to use the version of ctcsound that comes

         with the csound installer. Yesterday I was just searching

         quickly for online documentation…____

 

          ____

 

         On a related matter – should be a different post, I know :-) –

         I’m doing installations on many machines. I always install

         anaconda python first – and the csound installer picks it up OK.____

 

         But somehow, access to ctcsound is not automatic.: following

         installation, sometimes python import it, othertimes not and I

         have to manually copy it to a general place.____

 

         To make it a bit more complicated, Anaconda python does not use

         $PYTHONPATH.____

 

         Do you have a suggestion/mod for how to ensure that, following

         installation, ctcsound will be available to the  python used

         during the install?____

 

          ____

 

         Thank you for your assistance, and your work on this wonderful

         tool!____

 

          ____

 

         Regards,____

 

          ____

 

         David____

 

          ____

 

         ---____

 

         Dr David Worrall____

 

         Professor, Audio Arts and Acoustics____

 

         Columbia College Chicago____

 

         33 E. Ida B. Wells Drive Room 601A____

 

         Chicago, ILLINOIS, USA 60605____

 

         Tel: (1)312.369.8821 Fax: (1)312.369.8427____

 

         Wikipedia: David Worrall

 

         President, International Community for Auditory Display icad.org

 

         Personal research/creative practice website: avatar.com.au

 

         Some music/sonification: on soundcloud

               Youtube videos

 

         New Book: Sonification Design: From data to intelligible

         soundfields

         (Springer)____

 

          ____

 

         *From: *Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE

         <mailto:CSOUND-DEV@LISTSERV.HEANET.IE>> on behalf of Francois

         *Reply-To: *Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE

         *Date: *Thursday, August 1, 2019 at 03:35

         *To: *"CSOUND-DEV@LISTSERV.HEANET.IE

         <CSOUND-DEV@LISTSERV.HEANET.IE

         *Subject: *Re: [Csnd-dev] the ctcsound.setMessageCallback()____

 

          ____

 

         Hi David,____

 

          ____

 

         I didn't implement the setMessageCallback methods in ctcsound

         because actually ctypes cannot translate correctly the varlist

         arg. A workaround is to use the createMessageBuffer(False)

         method of the Csound object. This will redirect all the messages

         generated by Csound in a buffer that you can use as you want

         with the firstMessage(), firstMessageAttr(), popFirstMessage(),

         messageCnt() and destroyMessageBuffer() methods of the Csound

         object.____

 

          ____

 

         Note that you should not use the pydoc version of ctcsound.py.

         ctcsound.py is part of Csound and it is distributed within each

         release of Csound. The reason is that if the API changes in a

         release, those modifications are reflected in the ctcsound.py

         file distributed  with this release. I don't now who uploaded

         ctcsound.py to pydoc, but it wasn't a good idea.____

 

          ____

 

         François____

 

          ____

 

         Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu

         <mailto:dworrall@colum.edu>> a écrit :____

 

             Hello All,____

 

             I searched but couldn’t see a discussion on this so Perhaps

             I’m missing something….____

 

              ____

 

             I’m looking at the ctcsound equivalent or workaround for

             csnd6.SetMessageCallback()____

 

              ____

 

             In François’ documentation (thanks François), it says:____

 

 

             is says (my red)____

 

             |UDPConsole|(/addr/, /port/, /mirror/)____

 

             Turns on the transmission of console messages to UDP on

             addr:port.____

 

             If mirror is one, the messages will continue to be sent to

             the usual destination (see setMessageCallback()) as well as

             to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP

             transmission could not be set up.____

 

             it shows:____

 

             #def setDefaultMessageCallback():____

 

                 ____

 

             #def setMessageCallback():____

 

              ____

 

             Can someone please advise me, what the correct way of

             setting a callback message?____

 

             This is what I used to do using csnd6:____

 

             cs = csnd6.Csound()____

 

             def passCallback():____

 

                 pass                        # suppress all terminal

             output from CS____

 

             TRACE = False____

 

             if not TRACE:____

 

                 cs.SetMessageCallback(passCallback())____

 

              ____

 

             Many thanks,____

 

             David____

 

              ____

 

             ---____

 

             Dr David Worrall____

 

             Professor, Audio Arts and Acoustics____

 

             Columbia College Chicago____

 

             33 E. Ida B. Wells Drive Room 601A____

 

             Chicago, ILLINOIS, USA 60605____

 

             Tel: (1)312.369.8821 Fax: (1)312.369.8427____

 

             Wikipedia: David Worrall

 

             Personal research/creative practice website: avatar.com.au

 

             Some music/sonification: on soundcloud

                   Youtube videos

 

              ____

 

 


Date2019-08-02 19:50
FromVictor Lazzarini
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
I suspect we will need to retire Python 2.x support in Csound 7. 

Not sure whether we can keep backward compatibility if we update the code to 3.x

I am also not sure we should do this update
only to cause more problems in the future.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 16:01
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think th

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
I suspect we will need to retire Python 2.x support in Csound 7. 

Not sure whether we can keep backward compatibility if we update the code to 3.x

I am also not sure we should do this update
only to cause more problems in the future.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 16:04
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. We'd leave csnd6.py too... Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think that, in this particular case, we could make an exception about backward compatibility...

François

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
I suspect we will need to retire Python 2.x support in Csound 7. 

Not sure whether we can keep backward compatibility if we update the code to 3.x

I am also not sure we should do this update
only to cause more problems in the future.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 17:42
FromVictor Lazzarini
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
Yes, the SWIG wrapper goes. I am just wondering how much of job it is to port the opcodes to Python 3, if the python API changed a lot. You probably have a much better idea of the magnitude of the task.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 4 Aug 2019, at 16:05, Francois PINOT <fggpinot@gmail.com> wrote:

Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. We'd leave csnd6.py too... Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think that, in this particular case, we could make an exception about backward compatibility...

François

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
I suspect we will need to retire Python 2.x support in Csound 7. 

Not sure whether we can keep backward compatibility if we update the code to 3.x

I am also not sure we should do this update
only to cause more problems in the future.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 18:02
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
I think that Python 3 has many changes to the C API. I'll have a look.

François

Le dim. 4 août 2019 à 18:42, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
Yes, the SWIG wrapper goes. I am just wondering how much of job it is to port the opcodes to Python 3, if the python API changed a lot. You probably have a much better idea of the magnitude of the task.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 4 Aug 2019, at 16:05, Francois PINOT <fggpinot@gmail.com> wrote:

Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. We'd leave csnd6.py too... Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think that, in this particular case, we could make an exception about backward compatibility...

François

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
I suspect we will need to retire Python 2.x support in Csound 7. 

Not sure whether we can keep backward compatibility if we update the code to 3.x

I am also not sure we should do this update
only to cause more problems in the future.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

You can display the python3 path on your system with this command:
python3 -c "import sys; print(sys.path)"

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

François

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 20:25
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

FWIW, with the exception of print(), I rarely (never?) have Python 2.7.x code that doesn’t run in Python3.

The v2

>>>  print x,y

Can be implemented in v3 as

>>>  print (x,y)

which also works in v2.

 

There is  a problem occurring w. v2  ‘print but don’t linefeed’ :

>>> print x , ; print y    # uses the comma to suspend line feed

 

This can be implemented in v3 as

>>> print (x, end=’’) ; print (y)

 

But the “end=” argument is not available in v2 print().

Which renders print incompatible in that operation.

 

-drw

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Victor Lazzarini <Victor.Lazzarini@MU.IE>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Sunday, August 4, 2019 at 11:42
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Yes, the SWIG wrapper goes. I am just wondering how much of job it is to port the opcodes to Python 3, if the python API changed a lot. You probably have a much better idea of the magnitude of the task.

 

Victor Lazzarini

Dean of Arts, Celtic Studies, and Philosophy

Maynooth University

Ireland


On 4 Aug 2019, at 16:05, Francois PINOT <fggpinot@gmail.com> wrote:

Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. We'd leave csnd6.py too... Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think that, in this particular case, we could make an exception about backward compatibility...

 

François

https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif

 

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :

I suspect we will need to retire Python 2.x support in Csound 7. 

 

Not sure whether we can keep backward compatibility if we update the code to 3.x

 

I am also not sure we should do this update

only to cause more problems in the future.

 

Victor Lazzarini

Dean of Arts, Celtic Studies, and Philosophy

Maynooth University

Ireland


On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

 

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

 

You can display the python3 path on your system with this command:

python3 -c "import sys; print(sys.path)"

 

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

 

François

 

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 20:29
From"Worrall, David"
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

Are you referring to just the embedded python/opcode, or other situations as well?

 

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Victor Lazzarini <Victor.Lazzarini@MU.IE>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Friday, August 2, 2019 at 13:50
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

I suspect we will need to retire Python 2.x support in Csound 7. 

 

Not sure whether we can keep backward compatibility if we update the code to 3.x

 

I am also not sure we should do this update

only to cause more problems in the future.

 

Victor Lazzarini

Dean of Arts, Celtic Studies, and Philosophy

Maynooth University

Ireland


On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

 

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

 

You can display the python3 path on your system with this command:

python3 -c "import sys; print(sys.path)"

 

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

 

François

 

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

 


Date2019-08-04 20:53
FromVictor Lazzarini
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()
I am referring to opcodes. The Csound API access is guaranteed across versions by ctcsound.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 4 Aug 2019, at 20:29, Worrall, David  wrote:
> 
> Are you referring to just the embedded python/opcode, or other situations as well?
>  
>  
> ---
> Dr David Worrall
> Professor, Audio Arts and Acoustics
> Columbia College Chicago
> Wikipedia: David Worrall
> Personal research/creative practice website: avatar.com.au
> Some music/sonification: on soundcloud          Youtube videos
> New Book: Sonification Design: From data to intelligible soundfields (Springer)
>  
> From: Csound-developers  on behalf of Victor Lazzarini 
> Reply-To: Csound-developers 
> Date: Friday, August 2, 2019 at 13:50
> To: "CSOUND-DEV@LISTSERV.HEANET.IE" 
> Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()
>  
> I suspect we will need to retire Python 2.x support in Csound 7. 
>  
> Not sure whether we can keep backward compatibility if we update the code to 3.x
>  
> I am also not sure we should do this update
> only to cause more problems in the future.
>  
> Victor Lazzarini 
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
> 
> On 2 Aug 2019, at 07:41, Francois PINOT  wrote:
> 
>> ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.
>>  
>> Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.
>>  
>> You can display the python3 path on your system with this command:
>> python3 -c "import sys; print(sys.path)"
>>  
>> Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.
>>  
>> François
>>  
>> Le ven. 2 août 2019 à 02:49, Worrall, David  a écrit :
>>> Sorry for the omission: OSX in this case. 
>>> I suspect this is a csound install issue. Maybe not.
>>>  
>>> Is ctcsound the same across platforms for the same version of Csound?
>>>  
>>> Thanks,
>>> David
>>>  
>>>  
>>> From: Csound-developers  on behalf of Francois PINOT 
>>> Reply-To: Csound-developers 
>>> Date: Thursday, August 1, 2019 at 14:47
>>> To: "CSOUND-DEV@LISTSERV.HEANET.IE" 
>>> Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()
>>>  
>>> Which OS on your machines?
>>>  
>>> François
>>>  
>>> Le jeu. 1 août 2019 à 20:25, Worrall, David  a écrit :
>>>> Hi François,
>>>> Thank you for your detailed reply. Much appreciated.
>>>> I will try to implement an alternative, as you suggest.
>>>>  
>>>> I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…
>>>>  
>>>> On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.
>>>> But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.
>>>> To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.
>>>> Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?
>>>>  
>>>> Thank you for your assistance, and your work on this wonderful tool!
>>>>  
>>>> Regards,
>>>>  
>>>> David
>>>>  
>>>> ---
>>>> Dr David Worrall
>>>> Professor, Audio Arts and Acoustics
>>>> Columbia College Chicago
>>>> 33 E. Ida B. Wells Drive Room 601A
>>>> Chicago, ILLINOIS, USA 60605
>>>> Tel: (1)312.369.8821 Fax: (1)312.369.8427
>>>> Wikipedia: David Worrall
>>>> President, International Community for Auditory Display icad.org
>>>> Personal research/creative practice website: avatar.com.au
>>>> Some music/sonification: on soundcloud          Youtube videos
>>>> New Book: Sonification Design: From data to intelligible soundfields (Springer)
>>>>  
>>>> From: Csound-developers  on behalf of Francois PINOT 
>>>> Reply-To: Csound-developers 
>>>> Date: Thursday, August 1, 2019 at 03:35
>>>> To: "CSOUND-DEV@LISTSERV.HEANET.IE" 
>>>> Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()
>>>>  
>>>> Hi David,
>>>>  
>>>> I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.
>>>>  
>>>> Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.
>>>>  
>>>> François
>>>>  
>>>> Le jeu. 1 août 2019 à 02:39, Worrall, David  a écrit :
>>>>> Hello All,
>>>>> I searched but couldn’t see a discussion on this so Perhaps I’m missing something….
>>>>>  
>>>>> I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()
>>>>>  
>>>>> In François’ documentation (thanks François), it says:
>>>>> https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback
>>>>> is says (my red)
>>>>> UDPConsole(addr, port, mirror)
>>>>> Turns on the transmission of console messages to UDP on addr:port.
>>>>> 
>>>>> If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.
>>>>> 
>>>>> and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:
>>>>> 
>>>>> #def setDefaultMessageCallback():
>>>>>     
>>>>> #def setMessageCallback():
>>>>>  
>>>>> Can someone please advise me, what the correct way of setting a callback message?
>>>>> This is what I used to do using csnd6:
>>>>> cs = csnd6.Csound()
>>>>> 
>>>>> def passCallback():
>>>>> 
>>>>>     pass                        # suppress all terminal output from CS
>>>>> 
>>>>> TRACE = False
>>>>> 
>>>>> if not TRACE:
>>>>> 
>>>>>     cs.SetMessageCallback(passCallback())
>>>>> 
>>>>>  
>>>>> Many thanks,
>>>>> David
>>>>>  
>>>>> ---
>>>>> Dr David Worrall
>>>>> Professor, Audio Arts and Acoustics
>>>>> Columbia College Chicago
>>>>> 33 E. Ida B. Wells Drive Room 601A
>>>>> Chicago, ILLINOIS, USA 60605
>>>>> Tel: (1)312.369.8821 Fax: (1)312.369.8427
>>>>> Wikipedia: David Worrall
>>>>> Personal research/creative practice website: avatar.com.au
>>>>> Some music/sonification: on soundcloud          Youtube videos


Date2019-08-04 20:57
FromFrancois PINOT
SubjectRe: [Csnd-dev] the ctcsound.setMessageCallback()

If we move the python opcodes to Python3, some orchestra using these opcodes might need a lot of changes depending on the way they use Python...

François

Le dim. 4 août 2019 à 21:26, Worrall, David <dworrall@colum.edu> a écrit :

FWIW, with the exception of print(), I rarely (never?) have Python 2.7.x code that doesn’t run in Python3.

The v2

>>>  print x,y

Can be implemented in v3 as

>>>  print (x,y)

which also works in v2.

 

There is  a problem occurring w. v2  ‘print but don’t linefeed’ :

>>> print x , ; print y    # uses the comma to suspend line feed

 

This can be implemented in v3 as

>>> print (x, end=’’) ; print (y)

 

But the “end=” argument is not available in v2 print().

Which renders print incompatible in that operation.

 

-drw

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Victor Lazzarini <Victor.Lazzarini@MU.IE>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Sunday, August 4, 2019 at 11:42
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Yes, the SWIG wrapper goes. I am just wondering how much of job it is to port the opcodes to Python 3, if the python API changed a lot. You probably have a much better idea of the magnitude of the task.

 

Victor Lazzarini

Dean of Arts, Celtic Studies, and Philosophy

Maynooth University

Ireland


On 4 Aug 2019, at 16:05, Francois PINOT <fggpinot@gmail.com> wrote:

Actually most of the Python libraries have been updated for Python3 (see https://pythonclock.org/). We'd need to refactor the Python opcodes for Python3, the syntax of these opcodes remaining the same. We'd leave csnd6.py too... Of course this would break backward compatibility. But adapting Python2 code to Python3 is not that hard. So I think that, in this particular case, we could make an exception about backward compatibility...

 

François

https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif

 

Le ven. 2 août 2019 à 20:50, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :

I suspect we will need to retire Python 2.x support in Csound 7. 

 

Not sure whether we can keep backward compatibility if we update the code to 3.x

 

I am also not sure we should do this update

only to cause more problems in the future.

 

Victor Lazzarini

Dean of Arts, Celtic Studies, and Philosophy

Maynooth University

Ireland


On 2 Aug 2019, at 07:41, Francois PINOT <fggpinot@gmail.com> wrote:

ctcsound is a pure Python library. It detects the platform where it is loaded (lines 38 to 45 in ctcsound.py) so that it can bind to the correct dynamic library. So it is effectively the same ctcsound.py  file that is used on linux, window, and OSX.

 

Actually Csound is built with Python 2.7.x due to the compilation of the Python opcodes. I recommend to use ctcsound with Python 3.x. On my linux system, I copy manually the ctcsound.py file into ~/.local/lib/python3.6/site-pacakages which is the user directory for Python3.6 packages, because the Csound build system put ctcsound.py into ~/.local/lib/python2.7/site-pacakages.

 

You can display the python3 path on your system with this command:

python3 -c "import sys; print(sys.path)"

 

Then it is easy to write a script for copying ctcsound.py from the directory where the Csound installer put it into the python3 path.

 

François

 

Le ven. 2 août 2019 à 02:49, Worrall, David <dworrall@colum.edu> a écrit :

Sorry for the omission: OSX in this case.

I suspect this is a csound install issue. Maybe not.

 

Is ctcsound the same across platforms for the same version of Csound?

 

Thanks,

David

 

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 14:47
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Which OS on your machines?

 

François

 

Le jeu. 1 août 2019 à 20:25, Worrall, David <dworrall@colum.edu> a écrit :

Hi François,

Thank you for your detailed reply. Much appreciated.

I will try to implement an alternative, as you suggest.

 

I AM aware of the need to use the version of ctcsound that comes with the csound installer. Yesterday I was just searching quickly for online documentation…

 

On a related matter – should be a different post, I know :-) – I’m doing installations on many machines. I always install anaconda python first – and the csound installer picks it up OK.

But somehow, access to ctcsound is not automatic.: following installation, sometimes python import it, othertimes not and I have to manually copy it to a general place.

To make it a bit more complicated, Anaconda python does not use $PYTHONPATH.

Do you have a suggestion/mod for how to ensure that, following installation, ctcsound will be available to the  python used during the install?

 

Thank you for your assistance, and your work on this wonderful tool!

 

Regards,

 

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

President, International Community for Auditory Display icad.org

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos

New Book: Sonification Design: From data to intelligible soundfields (Springer)

 

From: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE> on behalf of Francois PINOT <fggpinot@GMAIL.COM>
Reply-To: Csound-developers <CSOUND-DEV@LISTSERV.HEANET.IE>
Date: Thursday, August 1, 2019 at 03:35
To: "CSOUND-DEV@LISTSERV.HEANET.IE" <CSOUND-DEV@LISTSERV.HEANET.IE>
Subject: Re: [Csnd-dev] the ctcsound.setMessageCallback()

 

Hi David,

 

I didn't implement the setMessageCallback methods in ctcsound because actually ctypes cannot translate correctly the varlist arg. A workaround is to use the createMessageBuffer(False) method of the Csound object. This will redirect all the messages generated by Csound in a buffer that you can use as you want with the firstMessage(), firstMessageAttr(), popFirstMessage(), messageCnt() and destroyMessageBuffer() methods of the Csound object.

 

Note that you should not use the pydoc version of ctcsound.py. ctcsound.py is part of Csound and it is distributed within each release of Csound. The reason is that if the API changes in a release, those modifications are reflected in the ctcsound.py file distributed  with this release. I don't now who uploaded ctcsound.py to pydoc, but it wasn't a good idea.

 

François

 

Le jeu. 1 août 2019 à 02:39, Worrall, David <dworrall@colum.edu> a écrit :

Hello All,

I searched but couldn’t see a discussion on this so Perhaps I’m missing something….

 

I’m looking at the ctcsound equivalent or workaround for csnd6.SetMessageCallback()

 

In François’ documentation (thanks François), it says:

https://csound.com/docs/ctcsound/ctcsound-API.html?highlight=setmessagecallback

is says (my red)

UDPConsole(addr, port, mirror)

Turns on the transmission of console messages to UDP on addr:port.

If mirror is one, the messages will continue to be sent to the usual destination (see setMessageCallback()) as well as to UDP. Returns CSOUND_SUCCESS or CSOUND_ERROR if the UDP transmission could not be set up.

and at http://pydoc.net/ctcsound/0.0.2/ctcsound/ it shows:

#def setDefaultMessageCallback():

   

#def setMessageCallback():

 

Can someone please advise me, what the correct way of setting a callback message?

This is what I used to do using csnd6:

cs = csnd6.Csound()

def passCallback():

    pass                        # suppress all terminal output from CS

TRACE = False

if not TRACE:

    cs.SetMessageCallback(passCallback())

 

Many thanks,

David

 

---

Dr David Worrall

Professor, Audio Arts and Acoustics

Columbia College Chicago

33 E. Ida B. Wells Drive Room 601A

Chicago, ILLINOIS, USA 60605

Tel: (1)312.369.8821 Fax: (1)312.369.8427

Wikipedia: David Worrall

Personal research/creative practice website: avatar.com.au

Some music/sonification: on soundcloud          Youtube videos