Csound Csound-dev Csound-tekno Search About

[Csnd] python3.7 and ctcsound osx 10.12.6

Date2018-12-12 15:35
Fromluis antunes pena
Subject[Csnd] python3.7 and ctcsound osx 10.12.6

Hi all,

I'm trying the csoundAPI examples from Steven Yi and adapt them to new ctcsound using python3.7. I got stuck on example 4. The error seams to be with CsoundPerformanceThread. Bellow the python code and the terminal output.

Thank you in advance for any help.

Luis


Tutorial from Steven Yi: https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

Here's the python adapted to the new ctcsound:

import ctcsound
from ctcsound import Csound, CsoundPerformanceThread
# Our Orchestra for our project
orc = """
sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin"""

# Our Score for our project
sco = "i1 0 1"
c = ctcsound.Csound()    # create an instance of Csound
c.setOption("-odac")  # Set option for Csound
c.compileOrc(orc)     # Compile Orchestra from String
c.readScore(sco)      # Read in Score from String
c.start()             # When compiling from strings, this call is necessary before doing any performing

t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
t.play()              # starts the thread, which is now running separately from the main thread. This
                      # call is asynchronous and will immediately return back here to continue code
                      # execution.
t.join()              # Join will wait for the other thread to complete. If we did not call Join(),
                      # after t.Play() returns we would immediate move to the next line, c.Stop().
                      # That would stop Csound without really giving it time to run.

c.stop()              # stops Csound
c.cleanup()           # clean up Csound; this is useful if you're going to reuse a Csound instance

and here's the output of the terminal:

0dBFS level = 32768.0
--Csound version 6.12 (double samples) Nov  3 2018
[commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
libsndfile-1.0.28
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (Pro Tools Aggregate I/O [Core Audio])
   2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:
Traceback (most recent call last):
  File "example04_ctcsound.py", line 26, in <module>
    t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2596, in __init__
    self.cpt = libcspt.NewCsoundPT(csp)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Exception ignored in: <function CsoundPerformanceThread.__del__ at 0x1129247b8>
Traceback (most recent call last):
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2599, in __del__
    libcspt.DeleteCsoundPT(self.cpt)
AttributeError: 'CsoundPerformanceThread' object has no attribute 'cpt'
inactive allocs returned to freespace
end of score.           overall amps:  0.00000  0.00000
       overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
closing device
0 2048 sample blks of 64-bit floats written to dac



Date2018-12-12 16:08
FromFrancois PINOT
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6
It seems that libcsnd6 is not found by ctcsound on your system. In ctcsound.py, line 2556, we have libcspt = CDLL("libcsnd6.6.0.dylib"). You should replace "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.

François

Le mer. 12 déc. 2018 à 16:36, luis antunes pena <antunespena@web.de> a écrit :

Hi all,

I'm trying the csoundAPI examples from Steven Yi and adapt them to new ctcsound using python3.7. I got stuck on example 4. The error seams to be with CsoundPerformanceThread. Bellow the python code and the terminal output.

Thank you in advance for any help.

Luis


Tutorial from Steven Yi: https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

Here's the python adapted to the new ctcsound:

import ctcsound
from ctcsound import Csound, CsoundPerformanceThread
# Our Orchestra for our project
orc = """
sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin"""

# Our Score for our project
sco = "i1 0 1"
c = ctcsound.Csound()    # create an instance of Csound
c.setOption("-odac")  # Set option for Csound
c.compileOrc(orc)     # Compile Orchestra from String
c.readScore(sco)      # Read in Score from String
c.start()             # When compiling from strings, this call is necessary before doing any performing

t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
t.play()              # starts the thread, which is now running separately from the main thread. This
                      # call is asynchronous and will immediately return back here to continue code
                      # execution.
t.join()              # Join will wait for the other thread to complete. If we did not call Join(),
                      # after t.Play() returns we would immediate move to the next line, c.Stop().
                      # That would stop Csound without really giving it time to run.

c.stop()              # stops Csound
c.cleanup()           # clean up Csound; this is useful if you're going to reuse a Csound instance

and here's the output of the terminal:

0dBFS level = 32768.0
--Csound version 6.12 (double samples) Nov  3 2018
[commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
libsndfile-1.0.28
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (Pro Tools Aggregate I/O [Core Audio])
   2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:
Traceback (most recent call last):
  File "example04_ctcsound.py", line 26, in <module>
    t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2596, in __init__
    self.cpt = libcspt.NewCsoundPT(csp)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Exception ignored in: <function CsoundPerformanceThread.__del__ at 0x1129247b8>
Traceback (most recent call last):
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2599, in __del__
    libcspt.DeleteCsoundPT(self.cpt)
AttributeError: 'CsoundPerformanceThread' object has no attribute 'cpt'
inactive allocs returned to freespace
end of score.           overall amps:  0.00000  0.00000
       overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
closing device
0 2048 sample blks of 64-bit floats written to dac


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-12-13 22:27
Fromluis antunes pena
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6

Thanks for your quick answer.

I have changed the line you said to

"/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib" which is the place I have the libcsnd but still the same error. I'm not sure what could be the problem.


Am 12.12.18 um 17:08 schrieb Francois PINOT:
It seems that libcsnd6 is not found by ctcsound on your system. In ctcsound.py, line 2556, we have libcspt = CDLL("libcsnd6.6.0.dylib"). You should replace "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.

François

Le mer. 12 déc. 2018 à 16:36, luis antunes pena <antunespena@web.de> a écrit :

Hi all,

I'm trying the csoundAPI examples from Steven Yi and adapt them to new ctcsound using python3.7. I got stuck on example 4. The error seams to be with CsoundPerformanceThread. Bellow the python code and the terminal output.

Thank you in advance for any help.

Luis


Tutorial from Steven Yi: https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

Here's the python adapted to the new ctcsound:

import ctcsound
from ctcsound import Csound, CsoundPerformanceThread
# Our Orchestra for our project
orc = """
sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin"""

# Our Score for our project
sco = "i1 0 1"
c = ctcsound.Csound()    # create an instance of Csound
c.setOption("-odac")  # Set option for Csound
c.compileOrc(orc)     # Compile Orchestra from String
c.readScore(sco)      # Read in Score from String
c.start()             # When compiling from strings, this call is necessary before doing any performing

t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
t.play()              # starts the thread, which is now running separately from the main thread. This
                      # call is asynchronous and will immediately return back here to continue code
                      # execution.
t.join()              # Join will wait for the other thread to complete. If we did not call Join(),
                      # after t.Play() returns we would immediate move to the next line, c.Stop().
                      # That would stop Csound without really giving it time to run.

c.stop()              # stops Csound
c.cleanup()           # clean up Csound; this is useful if you're going to reuse a Csound instance

and here's the output of the terminal:

0dBFS level = 32768.0
--Csound version 6.12 (double samples) Nov  3 2018
[commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
libsndfile-1.0.28
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (Pro Tools Aggregate I/O [Core Audio])
   2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:
Traceback (most recent call last):
  File "example04_ctcsound.py", line 26, in <module>
    t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2596, in __init__
    self.cpt = libcspt.NewCsoundPT(csp)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Exception ignored in: <function CsoundPerformanceThread.__del__ at 0x1129247b8>
Traceback (most recent call last):
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2599, in __del__
    libcspt.DeleteCsoundPT(self.cpt)
AttributeError: 'CsoundPerformanceThread' object has no attribute 'cpt'
inactive allocs returned to freespace
end of score.           overall amps:  0.00000  0.00000
       overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
closing device
0 2048 sample blks of 64-bit floats written to dac


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Date2018-12-14 15:02
FromFrancois PINOT
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6
The path to libcnsd6 was right. In fact, the constructor of the CsoundPerformanceThread class needs an opaque pointer to the csound instance, not a reference to the ctcsound.Csound your. This opaque pointer is given by the csound() getter method of the ctcsound.Csound class. So you should write this in your program:

t = CsoundPerformanceThread(c.csound())

François

Le jeu. 13 déc. 2018 à 23:27, luis antunes pena <antunespena@web.de> a écrit :

Thanks for your quick answer.

I have changed the line you said to

"/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib" which is the place I have the libcsnd but still the same error. I'm not sure what could be the problem.


Am 12.12.18 um 17:08 schrieb Francois PINOT:
It seems that libcsnd6 is not found by ctcsound on your system. In ctcsound.py, line 2556, we have libcspt = CDLL("libcsnd6.6.0.dylib"). You should replace "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.

François

Le mer. 12 déc. 2018 à 16:36, luis antunes pena <antunespena@web.de> a écrit :

Hi all,

I'm trying the csoundAPI examples from Steven Yi and adapt them to new ctcsound using python3.7. I got stuck on example 4. The error seams to be with CsoundPerformanceThread. Bellow the python code and the terminal output.

Thank you in advance for any help.

Luis


Tutorial from Steven Yi: https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

Here's the python adapted to the new ctcsound:

import ctcsound
from ctcsound import Csound, CsoundPerformanceThread
# Our Orchestra for our project
orc = """
sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin"""

# Our Score for our project
sco = "i1 0 1"
c = ctcsound.Csound()    # create an instance of Csound
c.setOption("-odac")  # Set option for Csound
c.compileOrc(orc)     # Compile Orchestra from String
c.readScore(sco)      # Read in Score from String
c.start()             # When compiling from strings, this call is necessary before doing any performing

t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
t.play()              # starts the thread, which is now running separately from the main thread. This
                      # call is asynchronous and will immediately return back here to continue code
                      # execution.
t.join()              # Join will wait for the other thread to complete. If we did not call Join(),
                      # after t.Play() returns we would immediate move to the next line, c.Stop().
                      # That would stop Csound without really giving it time to run.

c.stop()              # stops Csound
c.cleanup()           # clean up Csound; this is useful if you're going to reuse a Csound instance

and here's the output of the terminal:

0dBFS level = 32768.0
--Csound version 6.12 (double samples) Nov  3 2018
[commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
libsndfile-1.0.28
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (Pro Tools Aggregate I/O [Core Audio])
   2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:
Traceback (most recent call last):
  File "example04_ctcsound.py", line 26, in <module>
    t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2596, in __init__
    self.cpt = libcspt.NewCsoundPT(csp)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Exception ignored in: <function CsoundPerformanceThread.__del__ at 0x1129247b8>
Traceback (most recent call last):
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2599, in __del__
    libcspt.DeleteCsoundPT(self.cpt)
AttributeError: 'CsoundPerformanceThread' object has no attribute 'cpt'
inactive allocs returned to freespace
end of score.           overall amps:  0.00000  0.00000
       overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
closing device
0 2048 sample blks of 64-bit floats written to dac


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-12-14 20:54
Fromluis antunes pena
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6

François, that's it. It works now. Thank you very much!

Am 14.12.18 um 16:02 schrieb Francois PINOT:
The path to libcnsd6 was right. In fact, the constructor of the CsoundPerformanceThread class needs an opaque pointer to the csound instance, not a reference to the ctcsound.Csound your. This opaque pointer is given by the csound() getter method of the ctcsound.Csound class. So you should write this in your program:

t = CsoundPerformanceThread(c.csound())

François

Le jeu. 13 déc. 2018 à 23:27, luis antunes pena <antunespena@web.de> a écrit :

Thanks for your quick answer.

I have changed the line you said to

"/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib" which is the place I have the libcsnd but still the same error. I'm not sure what could be the problem.


Am 12.12.18 um 17:08 schrieb Francois PINOT:
It seems that libcsnd6 is not found by ctcsound on your system. In ctcsound.py, line 2556, we have libcspt = CDLL("libcsnd6.6.0.dylib"). You should replace "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.

François

Le mer. 12 déc. 2018 à 16:36, luis antunes pena <antunespena@web.de> a écrit :

Hi all,

I'm trying the csoundAPI examples from Steven Yi and adapt them to new ctcsound using python3.7. I got stuck on example 4. The error seams to be with CsoundPerformanceThread. Bellow the python code and the terminal output.

Thank you in advance for any help.

Luis


Tutorial from Steven Yi: https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

Here's the python adapted to the new ctcsound:

import ctcsound
from ctcsound import Csound, CsoundPerformanceThread
# Our Orchestra for our project
orc = """
sr=44100
ksmps=32
nchnls=2
0dbfs=1
instr 1
aout vco2 0.5, 440
outs aout, aout
endin"""

# Our Score for our project
sco = "i1 0 1"
c = ctcsound.Csound()    # create an instance of Csound
c.setOption("-odac")  # Set option for Csound
c.compileOrc(orc)     # Compile Orchestra from String
c.readScore(sco)      # Read in Score from String
c.start()             # When compiling from strings, this call is necessary before doing any performing

t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
t.play()              # starts the thread, which is now running separately from the main thread. This
                      # call is asynchronous and will immediately return back here to continue code
                      # execution.
t.join()              # Join will wait for the other thread to complete. If we did not call Join(),
                      # after t.Play() returns we would immediate move to the next line, c.Stop().
                      # That would stop Csound without really giving it time to run.

c.stop()              # stops Csound
c.cleanup()           # clean up Csound; this is useful if you're going to reuse a Csound instance

and here's the output of the terminal:

0dBFS level = 32768.0
--Csound version 6.12 (double samples) Nov  3 2018
[commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
libsndfile-1.0.28
rtaudio: PortAudio module enabled ...
using callback interface
rtmidi: PortMIDI module enabled
graphics suppressed, ascii substituted
0dBFS level = 1.0
orch now loaded
audio buffered in 1024 sample-frame blocks
PortAudio V19-devel (built Feb 12 2010 09:42:54)
   0: dac0 (Built-in Output [Core Audio])
   1: dac1 (Pro Tools Aggregate I/O [Core Audio])
   2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
writing 2048 sample blks of 64-bit floats to dac
SECTION 1:
Traceback (most recent call last):
  File "example04_ctcsound.py", line 26, in <module>
    t = CsoundPerformanceThread(c)  # Create a new CsoundPerformanceThread, passing in the Csound object
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2596, in __init__
    self.cpt = libcspt.NewCsoundPT(csp)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Exception ignored in: <function CsoundPerformanceThread.__del__ at 0x1129247b8>
Traceback (most recent call last):
  File "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py", line 2599, in __del__
    libcspt.DeleteCsoundPT(self.cpt)
AttributeError: 'CsoundPerformanceThread' object has no attribute 'cpt'
inactive allocs returned to freespace
end of score.           overall amps:  0.00000  0.00000
       overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
closing device
0 2048 sample blks of 64-bit floats written to dac


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Date2018-12-15 08:12
Fromjoachim heintz
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6
hi luis -

would you mind to add the differences when using ctcsound in the python 
API?  i think this would be very useful for others, too.

ciao -
	joachim



On 14/12/18 21:54, luis antunes pena wrote:
> François, that's it. It works now. Thank you very much!
>
> Am 14.12.18 um 16:02 schrieb Francois PINOT:
>> The path to libcnsd6 was right. In fact, the constructor of the
>> CsoundPerformanceThread class needs an opaque pointer to the csound
>> instance, not a reference to the ctcsound.Csound your. This opaque
>> pointer is given by the csound() getter method of the ctcsound.Csound
>> class. So you should write this in your program:
>>
>> t = CsoundPerformanceThread(c.csound())
>>
>> François
>>
>> Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
>> > a écrit :
>>
>>     Thanks for your quick answer.
>>
>>     I have changed the line you said to
>>
>>     "/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
>>     which is the place I have the libcsndbut still the same error. I'm
>>     not sure what could be the problem.
>>
>>
>>     Am 12.12.18 um 17:08 schrieb Francois PINOT:
>>>     It seems that libcsnd6 is not found by ctcsound on your system.
>>>     In ctcsound.py, line 2556, we have libcspt =
>>>     CDLL("libcsnd6.6.0.dylib"). You should replace
>>>     "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.
>>>
>>>     François
>>>
>>>     Le mer. 12 déc. 2018 à 16:36, luis antunes pena
>>>     > a écrit :
>>>
>>>         Hi all,
>>>
>>>         I'm trying the csoundAPI examples from Steven Yi and adapt
>>>         them to new ctcsound using python3.7. I got stuck on example
>>>         4. The error seams to be with CsoundPerformanceThread. Bellow
>>>         the python code and the terminal output.
>>>
>>>         Thank you in advance for any help.
>>>
>>>         Luis
>>>
>>>
>>>         Tutorial from Steven Yi:
>>>         https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py
>>>
>>>         Here's the python adapted to the new ctcsound:
>>>
>>>         import ctcsound
>>>         from ctcsound import Csound, CsoundPerformanceThread
>>>         # Our Orchestra for our project
>>>         orc = """
>>>         sr=44100
>>>         ksmps=32
>>>         nchnls=2
>>>         0dbfs=1
>>>         instr 1
>>>         aout vco2 0.5, 440
>>>         outs aout, aout
>>>         endin"""
>>>
>>>         # Our Score for our project
>>>         sco = "i1 0 1"
>>>         c = ctcsound.Csound()    # create an instance of Csound
>>>         c.setOption("-odac")  # Set option for Csound
>>>         c.compileOrc(orc)     # Compile Orchestra from String
>>>         c.readScore(sco)      # Read in Score from String
>>>         c.start()             #
>>>         When compiling from strings, this call is necessary before
>>>         doing any performing
>>>
>>>         t = CsoundPerformanceThread(c)  # Create a new
>>>         CsoundPerformanceThread, passing in the Csound object
>>>         t.play()            ÂÂ
>>>         # starts the thread, which is now running separately from the
>>>         main thread. This
>>>                             ÂÂ
>>>         # call is asynchronous and will immediately return back here
>>>         to continue code
>>>                             ÂÂ
>>>         # execution.
>>>         t.join()            ÂÂ
>>>         # Join will wait for the other thread to complete. If we did
>>>         not call Join(),
>>>                             ÂÂ
>>>         # after t.Play() returns we would immediate move to the next
>>>         line, c.Stop().
>>>                             ÂÂ
>>>         # That would stop Csound without really giving it time to run.
>>>
>>>         c.stop()            ÂÂ
>>>         # stops Csound
>>>         c.cleanup()           # clean
>>>         up Csound; this is useful if you're going to reuse a Csound
>>>         instance
>>>
>>>         and here's the output of the terminal:
>>>
>>>         0dBFS level = 32768.0
>>>         --Csound version 6.12 (double samples) Nov  3 2018
>>>         [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
>>>         libsndfile-1.0.28
>>>         rtaudio: PortAudio module enabled ...
>>>         using callback interface
>>>         rtmidi: PortMIDI module enabled
>>>         graphics suppressed, ascii substituted
>>>         0dBFS level = 1.0
>>>         orch now loaded
>>>         audio buffered in 1024 sample-frame blocks
>>>         PortAudio V19-devel (built Feb 12 2010 09:42:54)
>>>            0: dac0 (Built-in Output [Core Audio])
>>>            1: dac1 (Pro Tools Aggregate I/O [Core Audio])
>>>            2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
>>>         PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
>>>         writing 2048 sample blks of 64-bit floats to dac
>>>         SECTION 1:
>>>         Traceback (most recent call last):
>>>           File "example04_ctcsound.py", line 26, in 
>>>             t = CsoundPerformanceThread(c)  # Create a
>>>         new CsoundPerformanceThread, passing in the Csound object
>>>           File
>>>         "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>         line 2596, in __init__
>>>             self.cpt = libcspt.NewCsoundPT(csp)
>>>         ctypes.ArgumentError: argument 1: : wrong type
>>>         Exception ignored in: >>         CsoundPerformanceThread.__del__ at 0x1129247b8>
>>>         Traceback (most recent call last):
>>>           File
>>>         "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>         line 2599, in __del__
>>>             libcspt.DeleteCsoundPT(self.cpt)
>>>         AttributeError: 'CsoundPerformanceThread' object has no
>>>         attribute 'cpt'
>>>         inactive allocs returned to freespace
>>>         end of score.           overall
>>>         amps:  0.00000  0.00000
>>>                overall samples out of
>>>         range:      ÂÂ
>>>         0        0
>>>         0 errors in performance
>>>         Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
>>>         closing device
>>>         0 2048 sample blks of 64-bit floats written to dac
>>>
>>>
>>>
>>>         ------------------------------------------------------------------------
>>>         http://luisantunespena.eu
>>>         http://sumtone.com 
>>>         Csound mailing list Csound@listserv.heanet.ie
>>>         
>>>         https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
>>>         reports to https://github.com/csound/csound/issues
>>>         Discussions of bugs and features can be posted here
>>>
>>>     Csound mailing list Csound@listserv.heanet.ie
>>>     
>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>>     to https://github.com/csound/csound/issues Discussions of bugs
>>>     and features can be posted here
>>
>>     --
>>
>>     ------------------------------------------------------------------------
>>     http://luisantunespena.eu
>>     http://sumtone.com 
>>     Csound mailing list Csound@listserv.heanet.ie
>>     
>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>     to https://github.com/csound/csound/issues Discussions of bugs and
>>     features can be posted here
>>
>> Csound mailing list Csound@listserv.heanet.ie
>> 
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> https://github.com/csound/csound/issues Discussions of bugs and
>> features can be posted here
>
> --
>
> ------------------------------------------------------------------------
> http://luisantunespena.eu
> http://sumtone.com 
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-15 09:44
FromFrancois PINOT
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6

François

Le sam. 15 déc. 2018 à 09:12, joachim heintz <jh@joachimheintz.de> a écrit :
hi luis -

would you mind to add the differences when using ctcsound in the python
API?  i think this would be very useful for others, too.

ciao -
        joachim



On 14/12/18 21:54, luis antunes pena wrote:
> François, that's it. It works now. Thank you very much!
>
> Am 14.12.18 um 16:02 schrieb Francois PINOT:
>> The path to libcnsd6 was right. In fact, the constructor of the
>> CsoundPerformanceThread class needs an opaque pointer to the csound
>> instance, not a reference to the ctcsound.Csound your. This opaque
>> pointer is given by the csound() getter method of the ctcsound.Csound
>> class. So you should write this in your program:
>>
>> t = CsoundPerformanceThread(c.csound())
>>
>> François
>>
>> Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
>> <antunespena@web.de <mailto:antunespena@web.de>> a écrit :
>>
>>     Thanks for your quick answer.
>>
>>     I have changed the line you said to
>>
>>     "/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
>>     which is the place I have the libcsndbut still the same error. I'm
>>     not sure what could be the problem.
>>
>>
>>     Am 12.12.18 um 17:08 schrieb Francois PINOT:
>>>     It seems that libcsnd6 is not found by ctcsound on your system.
>>>     In ctcsound.py, line 2556, we have libcspt =
>>>     CDLL("libcsnd6.6.0.dylib"). You should replace
>>>     "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.
>>>
>>>     François
>>>
>>>     Le mer. 12 déc. 2018 à 16:36, luis antunes pena
>>>     <antunespena@web.de <mailto:antunespena@web.de>> a écrit :
>>>
>>>         Hi all,
>>>
>>>         I'm trying the csoundAPI examples from Steven Yi and adapt
>>>         them to new ctcsound using python3.7. I got stuck on example
>>>         4. The error seams to be with CsoundPerformanceThread. Bellow
>>>         the python code and the terminal output.
>>>
>>>         Thank you in advance for any help.
>>>
>>>         Luis
>>>
>>>
>>>         Tutorial from Steven Yi:
>>>         https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py
>>>
>>>         Here's the python adapted to the new ctcsound:
>>>
>>>         import ctcsound
>>>         from ctcsound import Csound, CsoundPerformanceThread
>>>         # Our Orchestra for our project
>>>         orc = """
>>>         sr=44100
>>>         ksmps=32
>>>         nchnls=2
>>>         0dbfs=1
>>>         instr 1
>>>         aout vco2 0.5, 440
>>>         outs aout, aout
>>>         endin"""
>>>
>>>         # Our Score for our project
>>>         sco = "i1 0 1"
>>>         c = ctcsound.Csound()    # create an instance of Csound
>>>         c.setOption("-odac")  # Set option for Csound
>>>         c.compileOrc(orc)     # Compile Orchestra from String
>>>         c.readScore(sco)      # Read in Score from String
>>>         c.start()             #
>>>         When compiling from strings, this call is necessary before
>>>         doing any performing
>>>
>>>         t = CsoundPerformanceThread(c)  # Create a new
>>>         CsoundPerformanceThread, passing in the Csound object
>>>         t.play()            ÂÂ
>>>         # starts the thread, which is now running separately from the
>>>         main thread. This
>>>         Ã‚ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ
>>>         # call is asynchronous and will immediately return back here
>>>         to continue code
>>>         Ã‚ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ
>>>         # execution.
>>>         t.join()            ÂÂ
>>>         # Join will wait for the other thread to complete. If we did
>>>         not call Join(),
>>>         Ã‚ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ
>>>         # after t.Play() returns we would immediate move to the next
>>>         line, c.Stop().
>>>         Ã‚ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ
>>>         # That would stop Csound without really giving it time to run.
>>>
>>>         c.stop()            ÂÂ
>>>         # stops Csound
>>>         c.cleanup()           # clean
>>>         up Csound; this is useful if you're going to reuse a Csound
>>>         instance
>>>
>>>         and here's the output of the terminal:
>>>
>>>         0dBFS level = 32768.0
>>>         --Csound version 6.12 (double samples) Nov  3 2018
>>>         [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
>>>         libsndfile-1.0.28
>>>         rtaudio: PortAudio module enabled ...
>>>         using callback interface
>>>         rtmidi: PortMIDI module enabled
>>>         graphics suppressed, ascii substituted
>>>         0dBFS level = 1.0
>>>         orch now loaded
>>>         audio buffered in 1024 sample-frame blocks
>>>         PortAudio V19-devel (built Feb 12 2010 09:42:54)
>>>         Ã‚ Â  0: dac0 (Built-in Output [Core Audio])
>>>         Ã‚ Â  1: dac1 (Pro Tools Aggregate I/O [Core Audio])
>>>         Ã‚ Â  2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
>>>         PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
>>>         writing 2048 sample blks of 64-bit floats to dac
>>>         SECTION 1:
>>>         Traceback (most recent call last):
>>>         Ã‚  File "example04_ctcsound.py", line 26, in <module>
>>>         Ã‚ Â Â  t = CsoundPerformanceThread(c)  # Create a
>>>         new CsoundPerformanceThread, passing in the Csound object
>>>         Ã‚  File
>>>         "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>         line 2596, in __init__
>>>         Ã‚ Â Â  self.cpt = libcspt.NewCsoundPT(csp)
>>>         ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
>>>         Exception ignored in: <function
>>>         CsoundPerformanceThread.__del__ at 0x1129247b8>
>>>         Traceback (most recent call last):
>>>         Ã‚  File
>>>         "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>         line 2599, in __del__
>>>         Ã‚ Â Â  libcspt.DeleteCsoundPT(self.cpt)
>>>         AttributeError: 'CsoundPerformanceThread' object has no
>>>         attribute 'cpt'
>>>         inactive allocs returned to freespace
>>>         end of score.           overall
>>>         amps:  0.00000  0.00000
>>>         Ã‚ Â Â     overall samples out of
>>>         range:      ÂÂ
>>>         0        0
>>>         0 errors in performance
>>>         Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
>>>         closing device
>>>         0 2048 sample blks of 64-bit floats written to dac
>>>
>>>
>>>
>>>         ------------------------------------------------------------------------
>>>         http://luisantunespena.eu
>>>         http://sumtone.com <http://sumtone.com/composer.php?id=15>
>>>         Csound mailing list Csound@listserv.heanet.ie
>>>         <mailto:Csound@listserv.heanet.ie>
>>>         https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
>>>         reports to https://github.com/csound/csound/issues
>>>         Discussions of bugs and features can be posted here
>>>
>>>     Csound mailing list Csound@listserv.heanet.ie
>>>     <mailto:Csound@listserv.heanet.ie>
>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>>     to https://github.com/csound/csound/issues Discussions of bugs
>>>     and features can be posted here
>>
>>     --
>>
>>     ------------------------------------------------------------------------
>>     http://luisantunespena.eu
>>     http://sumtone.com <http://sumtone.com/composer.php?id=15>
>>     Csound mailing list Csound@listserv.heanet.ie
>>     <mailto:Csound@listserv.heanet.ie>
>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>     to https://github.com/csound/csound/issues Discussions of bugs and
>>     features can be posted here
>>
>> Csound mailing list Csound@listserv.heanet.ie
>> <mailto:Csound@listserv.heanet.ie>
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> https://github.com/csound/csound/issues Discussions of bugs and
>> features can be posted here
>
> --
>
> ------------------------------------------------------------------------
> http://luisantunespena.eu
> http://sumtone.com <http://sumtone.com/composer.php?id=15>
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2018-12-19 19:56
Fromluis antunes pena
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6

Hi Joachim,

sorry I didn't read this before. Sure I could do this but as Franois pointed out, this is already actualized. I didn't know about this. Maybe it would be good to write a small note to link to the newest version

https://github.com/csound/csoundAPI_examples/blob/master/python/CtcsoundAPIExamples.ipynb

Best,
Luís

Am 15.12.18 um 09:12 schrieb joachim heintz:
hi luis -

would you mind to add the differences when using ctcsound in the python API?  i think this would be very useful for others, too.

ciao -
    joachim



On 14/12/18 21:54, luis antunes pena wrote:
François, that's it. It works now. Thank you very much!

Am 14.12.18 um 16:02 schrieb Francois PINOT:
The path to libcnsd6 was right. In fact, the constructor of the
CsoundPerformanceThread class needs an opaque pointer to the csound
instance, not a reference to the ctcsound.Csound your. This opaque
pointer is given by the csound() getter method of the ctcsound.Csound
class. So you should write this in your program:

t = CsoundPerformanceThread(c.csound())

François

Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
<antunespena@web.de <mailto:antunespena@web.de>> a écrit :

    Thanks for your quick answer.

    I have changed the line you said to

    "/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
    which is the place I have the libcsndbut still the same error. I'm
    not sure what could be the problem.


    Am 12.12.18 um 17:08 schrieb Francois PINOT:
    It seems that libcsnd6 is not found by ctcsound on your system.
    In ctcsound.py, line 2556, we have libcspt =
    CDLL("libcsnd6.6.0.dylib"). You should replace
    "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your system.

    François

    LeÂÂ mer. 12 déc. 2018 ÃÂ ÂÂ 16:36, luis antunes pena
    <antunespena@web.de <mailto:antunespena@web.de>> a écritÂÂ :

        Hi all,

        I'm trying the csoundAPI examples from Steven Yi and adapt
        them to new ctcsound using python3.7. I got stuck on example
        4. The error seams to be with CsoundPerformanceThread. Bellow
        the python code and the terminal output.

        Thank you in advance for any help.

        Luis


        Tutorial from Steven Yi:
        https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

        Here's the python adapted to the new ctcsound:

        import ctcsound
        from ctcsound import Csound, CsoundPerformanceThread
        # Our Orchestra for our project
        orc = """
        sr=44100
        ksmps=32
        nchnls=2
        0dbfs=1
        instr 1
        aout vco2 0.5, 440
        outs aout, aout
        endin"""

        # Our Score for our project
        sco = "i1 0 1"
        c = ctcsound.Csound()    # create an instance of Csound
        c.setOption("-odac")  # Set option for Csound
        c.compileOrc(orc)     # Compile Orchestra from String
        c.readScore(sco)      # Read in Score from String
        c.start()             #
        When compiling from strings, this call is necessary before
        doing any performing

        t = CsoundPerformanceThread(c)  # Create a new
        CsoundPerformanceThread, passing in the Csound object
        t.play()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # starts the thread, which is now running separately from the
        main thread. This
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # call is asynchronous and will immediately return back here
        to continue code
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # execution.
        t.join()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # Join will wait for the other thread to complete. If we did
        not call Join(),
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # after t.Play() returns we would immediate move to the next
        line, c.Stop().
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # That would stop Csound without really giving it time to run.

        c.stop()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        # stops Csound
        c.cleanup()           # clean
        up Csound; this is useful if you're going to reuse a Csound
        instance

        and here's the output of the terminal:

        0dBFS level = 32768.0
        --Csound version 6.12 (double samples) Nov  3 2018
        [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
        libsndfile-1.0.28
        rtaudio: PortAudio module enabled ...
        using callback interface
        rtmidi: PortMIDI module enabled
        graphics suppressed, ascii substituted
        0dBFS level = 1.0
        orch now loaded
        audio buffered in 1024 sample-frame blocks
        PortAudio V19-devel (built Feb 12 2010 09:42:54)
           0: dac0 (Built-in Output [Core Audio])
           1: dac1 (Pro Tools Aggregate I/O [Core Audio])
           2: dac2 (MOTU UltraLite mk3 Hybrid [Core Audio])
        PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
        writing 2048 sample blks of 64-bit floats to dac
        SECTION 1:
        Traceback (most recent call last):
          File "example04_ctcsound.py", line 26, in <module>
            t = CsoundPerformanceThread(c)  # Create a
        new CsoundPerformanceThread, passing in the Csound object
          File
        "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
        line 2596, in __init__
            self.cpt = libcspt.NewCsoundPT(csp)
        ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
        Exception ignored in: <function
        CsoundPerformanceThread.__del__ at 0x1129247b8>
        Traceback (most recent call last):
          File
        "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
        line 2599, in __del__
            libcspt.DeleteCsoundPT(self.cpt)
        AttributeError: 'CsoundPerformanceThread' object has no
        attribute 'cpt'
        inactive allocs returned to freespace
        end of score.           overall
        amps:  0.00000  0.00000
               overall samples out of
        range:ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        0        0
        0 errors in performance
        Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
        closing device
        0 2048 sample blks of 64-bit floats written to dac



        ------------------------------------------------------------------------
        http://luisantunespena.eu
        http://sumtone.com <http://sumtone.com/composer.php?id=15>
        Csound mailing list Csound@listserv.heanet.ie
        <mailto:Csound@listserv.heanet.ie>
        https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
        reports to https://github.com/csound/csound/issues
        Discussions of bugs and features can be posted here

    Csound mailing list Csound@listserv.heanet.ie
    <mailto:Csound@listserv.heanet.ie>
    https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
    to https://github.com/csound/csound/issues Discussions of bugs
    and features can be posted here

    --

    ------------------------------------------------------------------------
    http://luisantunespena.eu
    http://sumtone.com <http://sumtone.com/composer.php?id=15>
    Csound mailing list Csound@listserv.heanet.ie
    <mailto:Csound@listserv.heanet.ie>
    https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
    to https://github.com/csound/csound/issues Discussions of bugs and
    features can be posted here

Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and
features can be posted here

--

------------------------------------------------------------------------
http://luisantunespena.eu
http://sumtone.com <http://sumtone.com/composer.php?id=15>
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2018-12-19 19:59
Fromjoachim heintz
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6
where would you suggest to write this note?



On 19/12/18 20:56, luis antunes pena wrote:
> Hi Joachim,
>
> sorry I didn't read this before. Sure I could do this but as Franois
> pointed out, this is already actualized. I didn't know about this. Maybe
> it would be good to write a small note to link to the newest version
>
> https://github.com/csound/csoundAPI_examples/blob/master/python/CtcsoundAPIExamples.ipynb
>
> Best,
> Luís
>
> Am 15.12.18 um 09:12 schrieb joachim heintz:
>> hi luis -
>>
>> would you mind to add the differences when using ctcsound in the
>> python API?  i think this would be very useful for others, too.
>>
>> ciao -
>>     joachim
>>
>>
>>
>> On 14/12/18 21:54, luis antunes pena wrote:
>>> François, that's it. It works now. Thank you very much!
>>>
>>> Am 14.12.18 um 16:02 schrieb Francois PINOT:
>>>> The path to libcnsd6 was right. In fact, the constructor of the
>>>> CsoundPerformanceThread class needs an opaque pointer to the csound
>>>> instance, not a reference to the ctcsound.Csound your. This opaque
>>>> pointer is given by the csound() getter method of the ctcsound.Csound
>>>> class. So you should write this in your program:
>>>>
>>>> t = CsoundPerformanceThread(c.csound())
>>>>
>>>> François
>>>>
>>>> Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
>>>> > a écrit :
>>>>
>>>>     Thanks for your quick answer.
>>>>
>>>>     I have changed the line you said to
>>>>
>>>>
>>>> "/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
>>>>     which is the place I have the libcsndbut still the same error. I'm
>>>>     not sure what could be the problem.
>>>>
>>>>
>>>>     Am 12.12.18 um 17:08 schrieb Francois PINOT:
>>>>>     It seems that libcsnd6 is not found by ctcsound on your system.
>>>>>     In ctcsound.py, line 2556, we have libcspt =
>>>>>     CDLL("libcsnd6.6.0.dylib"). You should replace
>>>>>     "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your
>>>>> system.
>>>>>
>>>>>     François
>>>>>
>>>>>     Le mer. 12 déc. 2018 à 16:36, luis
>>>>> antunes pena
>>>>>     > a
>>>>> écrit :
>>>>>
>>>>>         Hi all,
>>>>>
>>>>>         I'm trying the csoundAPI examples from Steven Yi and adapt
>>>>>         them to new ctcsound using python3.7. I got stuck on example
>>>>>         4. The error seams to be with CsoundPerformanceThread. Bellow
>>>>>         the python code and the terminal output.
>>>>>
>>>>>         Thank you in advance for any help.
>>>>>
>>>>>         Luis
>>>>>
>>>>>
>>>>>         Tutorial from Steven Yi:
>>>>>
>>>>> https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py
>>>>>
>>>>>         Here's the python adapted to the new ctcsound:
>>>>>
>>>>>         import ctcsound
>>>>>         from ctcsound import Csound, CsoundPerformanceThread
>>>>>         # Our Orchestra for our project
>>>>>         orc = """
>>>>>         sr=44100
>>>>>         ksmps=32
>>>>>         nchnls=2
>>>>>         0dbfs=1
>>>>>         instr 1
>>>>>         aout vco2 0.5, 440
>>>>>         outs aout, aout
>>>>>         endin"""
>>>>>
>>>>>         # Our Score for our project
>>>>>         sco = "i1 0 1"
>>>>>         c = ctcsound.Csound()    # create an
>>>>> instance of Csound
>>>>>         c.setOption("-odac")  # Set option for Csound
>>>>>         c.compileOrc(orc)     # Compile
>>>>> Orchestra from String
>>>>>         c.readScore(sco)      #
>>>>> Read in Score from String
>>>>>         c.start()     ÂÂ
>>>>>        #
>>>>>         When compiling from strings, this call is necessary before
>>>>>         doing any performing
>>>>>
>>>>>         t = CsoundPerformanceThread(c)  # Create a new
>>>>>         CsoundPerformanceThread, passing in the Csound object
>>>>>         t.play()     ÂÂ
>>>>>       ÂÂ
>>>>>         # starts the thread, which is now running separately from the
>>>>>         main thread. This
>>>>>               ÂÂ
>>>>>        ÂÂ
>>>>>      ÂÂ
>>>>>         # call is asynchronous and will immediately return back here
>>>>>         to continue code
>>>>>               ÂÂ
>>>>>        ÂÂ
>>>>>      ÂÂ
>>>>>         # execution.
>>>>>         t.join()     ÂÂ
>>>>>       ÂÂ
>>>>>         # Join will wait for the other thread to complete. If we did
>>>>>         not call Join(),
>>>>>               ÂÂ
>>>>>        ÂÂ
>>>>>      ÂÂ
>>>>>         # after t.Play() returns we would immediate move to the next
>>>>>         line, c.Stop().
>>>>>               ÂÂ
>>>>>        ÂÂ
>>>>>      ÂÂ
>>>>>         # That would stop Csound without really giving it time to run.
>>>>>
>>>>>         c.stop()     ÂÂ
>>>>>       ÂÂ
>>>>>         # stops Csound
>>>>>         c.cleanup()     ÂÂ
>>>>>      # clean
>>>>>         up Csound; this is useful if you're going to reuse a Csound
>>>>>         instance
>>>>>
>>>>>         and here's the output of the terminal:
>>>>>
>>>>>         0dBFS level = 32768.0
>>>>>         --Csound version 6.12 (double samples) Nov  3 2018
>>>>>         [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
>>>>>         libsndfile-1.0.28
>>>>>         rtaudio: PortAudio module enabled ...
>>>>>         using callback interface
>>>>>         rtmidi: PortMIDI module enabled
>>>>>         graphics suppressed, ascii substituted
>>>>>         0dBFS level = 1.0
>>>>>         orch now loaded
>>>>>         audio buffered in 1024 sample-frame blocks
>>>>>         PortAudio V19-devel (built Feb 12 2010 09:42:54)
>>>>>            0: dac0 (Built-in Output [Core Audio])
>>>>>            1: dac1 (Pro Tools Aggregate I/O [Core
>>>>> Audio])
>>>>>            2: dac2 (MOTU UltraLite mk3 Hybrid [Core
>>>>> Audio])
>>>>>         PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
>>>>>         writing 2048 sample blks of 64-bit floats to dac
>>>>>         SECTION 1:
>>>>>         Traceback (most recent call last):
>>>>>           File "example04_ctcsound.py", line 26, in 
>>>>>             t =
>>>>> CsoundPerformanceThread(c)  # Create a
>>>>>         new CsoundPerformanceThread, passing in the Csound object
>>>>>           File
>>>>>
>>>>> "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>>>         line 2596, in __init__
>>>>>             self.cpt = libcspt.NewCsoundPT(csp)
>>>>>         ctypes.ArgumentError: argument 1: :
>>>>> wrong type
>>>>>         Exception ignored in: >>>>         CsoundPerformanceThread.__del__ at 0x1129247b8>
>>>>>         Traceback (most recent call last):
>>>>>           File
>>>>>
>>>>> "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>>>         line 2599, in __del__
>>>>>             libcspt.DeleteCsoundPT(self.cpt)
>>>>>         AttributeError: 'CsoundPerformanceThread' object has no
>>>>>         attribute 'cpt'
>>>>>         inactive allocs returned to freespace
>>>>>         end of score.     ÂÂ
>>>>>      overall
>>>>>         amps:  0.00000  0.00000
>>>>>                overall samples
>>>>> out of
>>>>>         range:      ÂÂ
>>>>>         0        0
>>>>>         0 errors in performance
>>>>>         Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
>>>>>         closing device
>>>>>         0 2048 sample blks of 64-bit floats written to dac
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>         http://luisantunespena.eu
>>>>>         http://sumtone.com 
>>>>>         Csound mailing list Csound@listserv.heanet.ie
>>>>>         
>>>>>         https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
>>>>>         reports to https://github.com/csound/csound/issues
>>>>>         Discussions of bugs and features can be posted here
>>>>>
>>>>>     Csound mailing list Csound@listserv.heanet.ie
>>>>>     
>>>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>>>>     to https://github.com/csound/csound/issues Discussions of bugs
>>>>>     and features can be posted here
>>>>
>>>>     --
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>     http://luisantunespena.eu
>>>>     http://sumtone.com 
>>>>     Csound mailing list Csound@listserv.heanet.ie
>>>>     
>>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>>>     to https://github.com/csound/csound/issues Discussions of bugs and
>>>>     features can be posted here
>>>>
>>>> Csound mailing list Csound@listserv.heanet.ie
>>>> 
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>>> https://github.com/csound/csound/issues Discussions of bugs and
>>>> features can be posted here
>>>
>>> --
>>>
>>> ------------------------------------------------------------------------
>>> http://luisantunespena.eu
>>> http://sumtone.com 
>>> Csound mailing list Csound@listserv.heanet.ie
>>> 
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>> https://github.com/csound/csound/issues Discussions of bugs and features
>>> can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>> --
>>
>> ------------------------------------------------------------------------
>> http://luisantunespena.eu
>> http://sumtone.com 
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-12-19 20:24
Fromluis antunes pena
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6

I would suggest here: https://github.com/csound/csoundAPI_examples/tree/master/python This is where I started working on Python and Csound. As far as I know, there is one example example13.py that works with ctcsound and Python3.X but all others work only with Python 2.X.

Am 19.12.18 um 20:59 schrieb joachim heintz:
where would you suggest to write this note?



On 19/12/18 20:56, luis antunes pena wrote:
Hi Joachim,

sorry I didn't read this before. Sure I could do this but as Franois
pointed out, this is already actualized. I didn't know about this. Maybe
it would be good to write a small note to link to the newest version

https://github.com/csound/csoundAPI_examples/blob/master/python/CtcsoundAPIExamples.ipynb

Best,
Luís

Am 15.12.18 um 09:12 schrieb joachim heintz:
hi luis -

would you mind to add the differences when using ctcsound in the
python API?  i think this would be very useful for others, too.

ciao -
    joachim



On 14/12/18 21:54, luis antunes pena wrote:
François, that's it. It works now. Thank you very much!

Am 14.12.18 um 16:02 schrieb Francois PINOT:
The path to libcnsd6 was right. In fact, the constructor of the
CsoundPerformanceThread class needs an opaque pointer to the csound
instance, not a reference to the ctcsound.Csound your. This opaque
pointer is given by the csound() getter method of the ctcsound.Csound
class. So you should write this in your program:

t = CsoundPerformanceThread(c.csound())

François

Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
<antunespena@web.de <mailto:antunespena@web.de>> a écrit :

    Thanks for your quick answer.

    I have changed the line you said to


"/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
    which is the place I have the libcsndbut still the same error. I'm
    not sure what could be the problem.


    Am 12.12.18 um 17:08 schrieb Francois PINOT:
    It seems that libcsnd6 is not found by ctcsound on your system.
    In ctcsound.py, line 2556, we have libcspt =
    CDLL("libcsnd6.6.0.dylib"). You should replace
    "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your
system.

    François

    LeÂÂ mer. 12 déc. 2018 ÃÂ ÂÂ 16:36, luis
antunes pena
    <antunespena@web.de <mailto:antunespena@web.de>> a
écrit :

        Hi all,

        I'm trying the csoundAPI examples from Steven Yi and adapt
        them to new ctcsound using python3.7. I got stuck on example
        4. The error seams to be with CsoundPerformanceThread. Bellow
        the python code and the terminal output.

        Thank you in advance for any help.

        Luis


        Tutorial from Steven Yi:

https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py

        Here's the python adapted to the new ctcsound:

        import ctcsound
        from ctcsound import Csound, CsoundPerformanceThread
        # Our Orchestra for our project
        orc = """
        sr=44100
        ksmps=32
        nchnls=2
        0dbfs=1
        instr 1
        aout vco2 0.5, 440
        outs aout, aout
        endin"""

        # Our Score for our project
        sco = "i1 0 1"
        c = ctcsound.Csound()    # create an
instance of Csound
        c.setOption("-odac")  # Set option for Csound
        c.compileOrc(orc)     # Compile
Orchestra from String
        c.readScore(sco)      #
Read in Score from String
        c.start()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
       #
        When compiling from strings, this call is necessary before
        doing any performing

        t = CsoundPerformanceThread(c)  # Create a new
        CsoundPerformanceThread, passing in the Csound object
        t.play()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
      ÂÂ
        # starts the thread, which is now running separately from the
        main thread. This
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
       ÂÂ
     ÂÂ
        # call is asynchronous and will immediately return back here
        to continue code
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
       ÂÂ
     ÂÂ
        # execution.
        t.join()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
      ÂÂ
        # Join will wait for the other thread to complete. If we did
        not call Join(),
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
       ÂÂ
     ÂÂ
        # after t.Play() returns we would immediate move to the next
        line, c.Stop().
        ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
       ÂÂ
     ÂÂ
        # That would stop Csound without really giving it time to run.

        c.stop()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
      ÂÂ
        # stops Csound
        c.cleanup()ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
     # clean
        up Csound; this is useful if you're going to reuse a Csound
        instance

        and here's the output of the terminal:

        0dBFS level = 32768.0
        --Csound version 6.12 (double samples) Nov  3 2018
        [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
        libsndfile-1.0.28
        rtaudio: PortAudio module enabled ...
        using callback interface
        rtmidi: PortMIDI module enabled
        graphics suppressed, ascii substituted
        0dBFS level = 1.0
        orch now loaded
        audio buffered in 1024 sample-frame blocks
        PortAudio V19-devel (built Feb 12 2010 09:42:54)
           0: dac0 (Built-in Output [Core Audio])
           1: dac1 (Pro Tools Aggregate I/O [Core
Audio])
           2: dac2 (MOTU UltraLite mk3 Hybrid [Core
Audio])
        PortAudio: selected output device 'MOTU UltraLite mk3 Hybrid'
        writing 2048 sample blks of 64-bit floats to dac
        SECTION 1:
        Traceback (most recent call last):
          File "example04_ctcsound.py", line 26, in <module>
            t =
CsoundPerformanceThread(c)  # Create a
        new CsoundPerformanceThread, passing in the Csound object
          File

"/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
        line 2596, in __init__
            self.cpt = libcspt.NewCsoundPT(csp)
        ctypes.ArgumentError: argument 1: <class 'TypeError'>:
wrong type
        Exception ignored in: <function
        CsoundPerformanceThread.__del__ at 0x1129247b8>
        Traceback (most recent call last):
          File

"/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
        line 2599, in __del__
            libcspt.DeleteCsoundPT(self.cpt)
        AttributeError: 'CsoundPerformanceThread' object has no
        attribute 'cpt'
        inactive allocs returned to freespace
        end of score.     ÂÂ
     overall
        amps:  0.00000  0.00000
               overall samples
out of
        range:ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ
        0        0
        0 errors in performance
        Elapsed time at end of performance: real: 0.047s, CPU: 0.033s
        closing device
        0 2048 sample blks of 64-bit floats written to dac




------------------------------------------------------------------------

        http://luisantunespena.eu
        http://sumtone.com <http://sumtone.com/composer.php?id=15>
        Csound mailing list Csound@listserv.heanet.ie
        <mailto:Csound@listserv.heanet.ie>
        https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
        reports to https://github.com/csound/csound/issues
        Discussions of bugs and features can be posted here

    Csound mailing list Csound@listserv.heanet.ie
    <mailto:Csound@listserv.heanet.ie>
    https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
    to https://github.com/csound/csound/issues Discussions of bugs
    and features can be posted here

    --


------------------------------------------------------------------------

    http://luisantunespena.eu
    http://sumtone.com <http://sumtone.com/composer.php?id=15>
    Csound mailing list Csound@listserv.heanet.ie
    <mailto:Csound@listserv.heanet.ie>
    https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
    to https://github.com/csound/csound/issues Discussions of bugs and
    features can be posted here

Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and
features can be posted here

--

------------------------------------------------------------------------
http://luisantunespena.eu
http://sumtone.com <http://sumtone.com/composer.php?id=15>
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

--

------------------------------------------------------------------------
http://luisantunespena.eu
http://sumtone.com <http://sumtone.com/composer.php?id=15>
Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



Date2018-12-19 20:56
Fromjoachim heintz
SubjectRe: [Csnd] python3.7 and ctcsound osx 10.12.6
ok i will do this (actually already did but could not push yet).
ciao -
	joachim



On 19/12/18 21:24, luis antunes pena wrote:
> I would suggest here:
> https://github.com/csound/csoundAPI_examples/tree/master/python This is
> where I started working on Python and Csound. As far as I know, there is
> one example example13.py that works with ctcsound and Python3.X but all
> others work only with Python 2.X.
>
> Am 19.12.18 um 20:59 schrieb joachim heintz:
>> where would you suggest to write this note?
>>
>>
>>
>> On 19/12/18 20:56, luis antunes pena wrote:
>>> Hi Joachim,
>>>
>>> sorry I didn't read this before. Sure I could do this but as Franois
>>> pointed out, this is already actualized. I didn't know about this. Maybe
>>> it would be good to write a small note to link to the newest version
>>>
>>> https://github.com/csound/csoundAPI_examples/blob/master/python/CtcsoundAPIExamples.ipynb
>>>
>>>
>>> Best,
>>> Luís
>>>
>>> Am 15.12.18 um 09:12 schrieb joachim heintz:
>>>> hi luis -
>>>>
>>>> would you mind to add the differences when using ctcsound in the
>>>> python API?  i think this would be very useful for others, too.
>>>>
>>>> ciao -
>>>>     joachim
>>>>
>>>>
>>>>
>>>> On 14/12/18 21:54, luis antunes pena wrote:
>>>>> François, that's it. It works now. Thank you very much!
>>>>>
>>>>> Am 14.12.18 um 16:02 schrieb Francois PINOT:
>>>>>> The path to libcnsd6 was right. In fact, the constructor of the
>>>>>> CsoundPerformanceThread class needs an opaque pointer to the csound
>>>>>> instance, not a reference to the ctcsound.Csound your. This opaque
>>>>>> pointer is given by the csound() getter method of the ctcsound.Csound
>>>>>> class. So you should write this in your program:
>>>>>>
>>>>>> t = CsoundPerformanceThread(c.csound())
>>>>>>
>>>>>> François
>>>>>>
>>>>>> Le jeu. 13 déc. 2018 à  23:27, luis antunes pena
>>>>>> > a
>>>>>> écrit :
>>>>>>
>>>>>>     Thanks for your quick answer.
>>>>>>
>>>>>>     I have changed the line you said to
>>>>>>
>>>>>>
>>>>>> "/Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib"
>>>>>>
>>>>>>     which is the place I have the libcsndbut still the same error.
>>>>>> I'm
>>>>>>     not sure what could be the problem.
>>>>>>
>>>>>>
>>>>>>     Am 12.12.18 um 17:08 schrieb Francois PINOT:
>>>>>>>     It seems that libcsnd6 is not found by ctcsound on your system.
>>>>>>>     In ctcsound.py, line 2556, we have libcspt =
>>>>>>>     CDLL("libcsnd6.6.0.dylib"). You should replace
>>>>>>>     "libcsnd6.6.0.dylib" by the correct path to libcsnd6 on your
>>>>>>> system.
>>>>>>>
>>>>>>>     François
>>>>>>>
>>>>>>>     Le mer. 12 déc. 2018
>>>>>>> à 16:36, luis
>>>>>>> antunes pena
>>>>>>>     > a
>>>>>>> écrit :
>>>>>>>
>>>>>>>         Hi all,
>>>>>>>
>>>>>>>         I'm trying the csoundAPI examples from Steven Yi and adapt
>>>>>>>         them to new ctcsound using python3.7. I got stuck on example
>>>>>>>         4. The error seams to be with CsoundPerformanceThread.
>>>>>>> Bellow
>>>>>>>         the python code and the terminal output.
>>>>>>>
>>>>>>>         Thank you in advance for any help.
>>>>>>>
>>>>>>>         Luis
>>>>>>>
>>>>>>>
>>>>>>>         Tutorial from Steven Yi:
>>>>>>>
>>>>>>> https://github.com/csound/csoundAPI_examples/blob/master/python/example4.py
>>>>>>>
>>>>>>>
>>>>>>>         Here's the python adapted to the new ctcsound:
>>>>>>>
>>>>>>>         import ctcsound
>>>>>>>         from ctcsound import Csound, CsoundPerformanceThread
>>>>>>>         # Our Orchestra for our project
>>>>>>>         orc = """
>>>>>>>         sr=44100
>>>>>>>         ksmps=32
>>>>>>>         nchnls=2
>>>>>>>         0dbfs=1
>>>>>>>         instr 1
>>>>>>>         aout vco2 0.5, 440
>>>>>>>         outs aout, aout
>>>>>>>         endin"""
>>>>>>>
>>>>>>>         # Our Score for our project
>>>>>>>         sco = "i1 0 1"
>>>>>>>         c = ctcsound.Csound() ÂÂ
>>>>>>>   # create an
>>>>>>> instance of Csound
>>>>>>>         c.setOption("-odac")  # Set option for
>>>>>>> Csound
>>>>>>>         c.compileOrc(orc) ÂÂ
>>>>>>>    # Compile
>>>>>>> Orchestra from String
>>>>>>>         c.readScore(sco) ÂÂ
>>>>>>>     #
>>>>>>> Read in Score from String
>>>>>>>         c.start() ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>     #
>>>>>>>         When compiling from strings, this call is necessary before
>>>>>>>         doing any performing
>>>>>>>
>>>>>>>         t = CsoundPerformanceThread(c)  # Create
>>>>>>> a new
>>>>>>>         CsoundPerformanceThread, passing in the Csound object
>>>>>>>         t.play() ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>    ÂÂ
>>>>>>>         # starts the thread, which is now running separately from
>>>>>>> the
>>>>>>>         main thread. This
>>>>>>>           ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>  ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>         # call is asynchronous and will immediately return back here
>>>>>>>         to continue code
>>>>>>>           ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>  ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>         # execution.
>>>>>>>         t.join() ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>    ÂÂ
>>>>>>>         # Join will wait for the other thread to complete. If we did
>>>>>>>         not call Join(),
>>>>>>>           ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>  ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>         # after t.Play() returns we would immediate move to the next
>>>>>>>         line, c.Stop().
>>>>>>>           ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>  ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   ÂÂ
>>>>>>>         # That would stop Csound without really giving it time to
>>>>>>> run.
>>>>>>>
>>>>>>>         c.stop() ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>    ÂÂ
>>>>>>>         # stops Csound
>>>>>>>         c.cleanup() ÂÂ
>>>>>>>    ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   # clean
>>>>>>>         up Csound; this is useful if you're going to reuse a Csound
>>>>>>>         instance
>>>>>>>
>>>>>>>         and here's the output of the terminal:
>>>>>>>
>>>>>>>         0dBFS level = 32768.0
>>>>>>>         --Csound version 6.12 (double samples)
>>>>>>> Nov  3 2018
>>>>>>>         [commit: bc81dfb2877c7302d7f4849c098a1f88cf3f60d7]
>>>>>>>         libsndfile-1.0.28
>>>>>>>         rtaudio: PortAudio module enabled ...
>>>>>>>         using callback interface
>>>>>>>         rtmidi: PortMIDI module enabled
>>>>>>>         graphics suppressed, ascii substituted
>>>>>>>         0dBFS level = 1.0
>>>>>>>         orch now loaded
>>>>>>>         audio buffered in 1024 sample-frame blocks
>>>>>>>         PortAudio V19-devel (built Feb 12 2010 09:42:54)
>>>>>>>            0: dac0 (Built-in
>>>>>>> Output [Core Audio])
>>>>>>>            1: dac1 (Pro Tools
>>>>>>> Aggregate I/O [Core
>>>>>>> Audio])
>>>>>>>            2: dac2 (MOTU
>>>>>>> UltraLite mk3 Hybrid [Core
>>>>>>> Audio])
>>>>>>>         PortAudio: selected output device 'MOTU UltraLite mk3
>>>>>>> Hybrid'
>>>>>>>         writing 2048 sample blks of 64-bit floats to dac
>>>>>>>         SECTION 1:
>>>>>>>         Traceback (most recent call last):
>>>>>>>           File "example04_ctcsound.py", line 26,
>>>>>>> in 
>>>>>>>             t =
>>>>>>> CsoundPerformanceThread(c)  # Create a
>>>>>>>         new CsoundPerformanceThread, passing in the Csound object
>>>>>>>           File
>>>>>>>
>>>>>>> "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>>>>>
>>>>>>>         line 2596, in __init__
>>>>>>>           ÂÂ
>>>>>>> self.cpt = libcspt.NewCsoundPT(csp)
>>>>>>>         ctypes.ArgumentError: argument 1: :
>>>>>>> wrong type
>>>>>>>         Exception ignored in: >>>>>>         CsoundPerformanceThread.__del__ at 0x1129247b8>
>>>>>>>         Traceback (most recent call last):
>>>>>>>           File
>>>>>>>
>>>>>>> "/Users/luis/arbeit/komp/2018-05_TrackingReality/python/treal/lib/python3.7/site-packages/ctcsound.py",
>>>>>>>
>>>>>>>         line 2599, in __del__
>>>>>>>           ÂÂ
>>>>>>> libcspt.DeleteCsoundPT(self.cpt)
>>>>>>>         AttributeError: 'CsoundPerformanceThread' object has no
>>>>>>>         attribute 'cpt'
>>>>>>>         inactive allocs returned to freespace
>>>>>>>         end of score. ÂÂ
>>>>>>>    ÂÂ
>>>>>>>      overall
>>>>>>>         amps:  0.00000  0.00000
>>>>>>>           ÂÂ
>>>>>>>    overall samples
>>>>>>> out of
>>>>>>>         range:  ÂÂ
>>>>>>>    ÂÂ
>>>>>>>         0  ÂÂ
>>>>>>>   ÂÂ
>>>>>>>   0
>>>>>>>         0 errors in performance
>>>>>>>         Elapsed time at end of performance: real: 0.047s, CPU:
>>>>>>> 0.033s
>>>>>>>         closing device
>>>>>>>         0 2048 sample blks of 64-bit floats written to dac
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>         http://luisantunespena.eu
>>>>>>>         http://sumtone.com 
>>>>>>>         Csound mailing list Csound@listserv.heanet.ie
>>>>>>>         
>>>>>>>         https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
>>>>>>>         reports to https://github.com/csound/csound/issues
>>>>>>>         Discussions of bugs and features can be posted here
>>>>>>>
>>>>>>>     Csound mailing list Csound@listserv.heanet.ie
>>>>>>>     
>>>>>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs
>>>>>>> reports
>>>>>>>     to https://github.com/csound/csound/issues Discussions of bugs
>>>>>>>     and features can be posted here
>>>>>>
>>>>>>     --
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>>     http://luisantunespena.eu
>>>>>>     http://sumtone.com 
>>>>>>     Csound mailing list Csound@listserv.heanet.ie
>>>>>>     
>>>>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports
>>>>>>     to https://github.com/csound/csound/issues Discussions of bugs
>>>>>> and
>>>>>>     features can be posted here
>>>>>>
>>>>>> Csound mailing list Csound@listserv.heanet.ie
>>>>>> 
>>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>>>>> https://github.com/csound/csound/issues Discussions of bugs and
>>>>>> features can be posted here
>>>>>
>>>>> --
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> http://luisantunespena.eu
>>>>> http://sumtone.com 
>>>>> Csound mailing list Csound@listserv.heanet.ie
>>>>> 
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>>>> https://github.com/csound/csound/issues Discussions of bugs and
>>>>> features
>>>>> can be posted here
>>>>
>>>> Csound mailing list
>>>> Csound@listserv.heanet.ie
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>        https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>>>
>>>> --
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> http://luisantunespena.eu
>>>> http://sumtone.com 
>>> Csound mailing list Csound@listserv.heanet.ie
>>> 
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>> https://github.com/csound/csound/issues Discussions of bugs and features
>>> can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> --
>
> ------------------------------------------------------------------------
> http://luisantunespena.eu
> http://sumtone.com 
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here