Csound Csound-dev Csound-tekno Search About

[Cs-dev] tclcsound and tcl 8.5

Date2008-02-13 15:24
FromFelipe Sateler
Subject[Cs-dev] tclcsound and tcl 8.5
AttachmentsNone  None  None  

Date2008-02-14 06:29
FromGreg Thompson
Subject[Cs-dev] Csound Python module for X11/pygtk on OS X
Hi

I have been able to use macports/darwinports to install pygtk and  
develop pygtk apps in X11 (in OS X).

I've got the python module working on OS X, however, I'm trying to  
use pygtk at the same time.

The problem I'm having is determining how to install the python  
csound module such that it fits into the macports structure.   
Macports only seems to have version 4.23 of csound available  
otherwise I would able to port install it.

Any suggestions are welcome.

Thanks in advance
greg


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

Date2008-02-14 10:09
FromGreg Thompson
Subject[Cs-dev] Potential Bug in python csnd module
AttachmentsNone  None  
Below is a python app written to run in Fedora (Linux).  Basically, it performs whatever csd is in the textview.  If I click play more than once it always crashes (seg faults).  I attached the output and trace after the source.  

The relevant crash point seems to be in Csound::~Csound  -- It appears to freeing an invalid pointer (object not initialized properly ..?).

#3  0x00174fa4 in Csound::~Csound$delete () from /usr/lib/python2.5/site-packages/_csnd.so
#4  0x001400a6 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so

Also, I should point out it crashes in the same function if I use Perform or CsoundPerformanceThread

If anyone has any idea on how to get around this crash let me know.  Otherwise ... I guess you could call this a bug report.   I've tried to locate this in the sources and I cannot seem to find the destructor... 



import csnd
import time

import pygtk
pygtk.require('2.0')
import gtk

str = """
<CsoundSynthesizer>

    <CsOptions>
        -odac -d -B4096 -b1024 -+rtaudio=alsa
    </CsOptions>

    

    <CsInstruments>
        nchnls = 2

        

        instr 1
            a1      oscili 30000, 220, 1

            

            outs    a1, a1
        endin
    </CsInstruments>

    <CsScore>
        f1 0 8192 10 1

        i1 0 3
    </CsScore>

</CsoundSynthesizer>
"""

class Example:
    def close_application(self, widget):
        gtk.main_quit()

    def __init__(self):
        global str

        

        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_resizable(True)  
        window.connect("destroy", self.close_application)
        window.set_title("Title")
        window.set_border_width(0)
        window.set_size_request(800, 600)

        

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        textview = gtk.TextView()
        textbuffer = textview.get_buffer()
        textbuffer.set_text(str)

        sw.add(textview)
        sw.show()
        textview.show()

        button = gtk.Button('play')
        button.connect("clicked", self.play, 'play')

        box1 = gtk.VBox(False, 0)
        box1.pack_start(sw, True, True, 0)
        box1.pack_start(button, False, True, 0)

        

        window.add(box1)
        window.show_all()

        


    def play(self, widget, data = None):
        global str

        

        f = file("test.csd", 'w')
        f.write(str)
        f.close()

        # create & compile instance
        self.cs = csnd.Csound()
        self.cs.Compile("test.csd")

        #self.cs.Perform()

        

        self.perf = csnd.CsoundPerformanceThread(self.cs)
        self.perf.Play()

        # print "ksmps=", cs.GetKsmps()


if __name__ == "__main__":
    Example()
    gtk.main()





Backtrace

0dBFS level = 32768.0
Csound version 5.03.1 beta (float samples) Apr  4 2007
libsndfile-1.0.17
UnifiedCSD:  test.csd
STARTING FILE
Creating options
Creating orchestra
Creating score
orchname:  /tmp/fileZ9OvB1.orc
scorename: /tmp/file2RiPDk.sco
rtaudio: ALSA module enabled
orch compiler:
7 lines read
        instr   1
Elapsed time at end of orchestra compile: real: 0.048s, CPU: 0.010s
sorting score ...
        ... done
Elapsed time at end of score sort: real: 0.048s, CPU: 0.010s
Csound version 5.03.1 beta (float samples) Apr  4 2007
displays suppressed
0dBFS level = 32768.0
orch now loaded
audio buffered in 1024 sample-frame blocks
ALSA output: total buffer size: 4096, period size: 1024
writing 4096-byte blks of shorts to dac
SECTION 1:
[New Thread -1213006960 (LWP 3060)]
ftable 1:
new alloc for instr 1:
B  0.000 ..  3.000 T  3.000 TT  3.000 M:  30000.0  30000.0
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.              overall amps:  30000.0  30000.0
           overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 4.041s, CPU: 0.040s
130 4096-byte soundblks of shorts written to dac
[Thread -1213006960 (LWP 3060) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208924480 (LWP 3057)]
0x004d73ec in free () from /lib/libc.so.6
(gdb) bt
#0  0x004d73ec in free () from /lib/libc.so.6
#1  0x05d4e091 in operator delete () from /usr/lib/libstdc++.so.6
#2  0x05d4e0ed in operator delete[] () from /usr/lib/libstdc++.so.6
#3  0x00174fa4 in Csound::~Csound$delete () from /usr/lib/python2.5/site-packages/_csnd.so
#4  0x001400a6 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so
#5  0x0568e18d in PyCFunction_Call () from /usr/lib/libpython2.5.so.1.0
#6  0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
#7  0x0565d0c1 in PyObject_CallFunctionObjArgs () from /usr/lib/libpython2.5.so.1.0
#8  0x0012afd7 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so
#9  0x0568bc12 in ?? () from /usr/lib/libpython2.5.so.1.0
#10 0x056ab5ac in ?? () from /usr/lib/libpython2.5.so.1.0
#11 0x0568a529 in ?? () from /usr/lib/libpython2.5.so.1.0
#12 0x0568c474 in PyDict_SetItem () from /usr/lib/libpython2.5.so.1.0
#13 0x05665900 in ?? () from /usr/lib/libpython2.5.so.1.0
#14 0x0568feab in PyObject_SetAttr () from /usr/lib/libpython2.5.so.1.0
#15 0x056d5602 in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
#16 0x056dbb7f in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0
#17 0x0567aeea in ?? () from /usr/lib/libpython2.5.so.1.0
#18 0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
#19 0x05663428 in ?? () from /usr/lib/libpython2.5.so.1.0
#20 0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
#21 0x056d3d3c in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.5.so.1.0
#22 0x0565d56c in PyObject_CallObject () from /usr/lib/libpython2.5.so.1.0
#23 0x001ea067 in ?? () from /usr/lib/python2.5/site-packages/gtk-2.0/gobject/_gobject.so
#24 0x001feda2 in g_closure_invoke () from /lib/libgobject-2.0.so.0
#25 0x0020f4d3 in ?? () from /lib/libgobject-2.0.so.0
#26 0x002109f7 in g_signal_emit_valist () from /lib/libgobject-2.0.so.0
#27 0x00210bb9 in g_signal_emit () from /lib/libgobject-2.0.so.0
#28 0x0595bda3 in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0
#29 0x0595da1e in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#30 0x0020c199 in g_cclosure_marshal_VOID__VOID () from /lib/libgobject-2.0.so.0
#31 0x001fd599 in ?? () from /lib/libgobject-2.0.so.0
#32 0x001feda2 in g_closure_invoke () from /lib/libgobject-2.0.so.0



greg

Date2008-02-14 10:40
Fromroot
SubjectRe: [Cs-dev] Potential Bug in python csnd module
Could you runyour example with a version of malloc line electric fence ? 
Or run under valgrind? That shoudl give the problem area fast(ish)
==John ff



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

Date2008-02-14 10:55
FromVictor Lazzarini
SubjectRe: [Cs-dev] Potential Bug in python csnd module
It does not crash here (windows). Will test later on Linux.

Also on another matter: if you are working with PyGTK aiming to develop
for sugar, would consider joining forces with myself and Cesare Marilungo,
in using/developing csndsugui?


Victor

At 10:09 14/02/2008, you wrote:
>Below is a python app written to run in Fedora (Linux).  Basically, it 
>performs whatever csd is in the textview.  If I click play more than once 
>it always crashes (seg faults).  I attached the output and trace after the 
>source.
>
>The relevant crash point seems to be in Csound::~Csound  -- It appears to 
>freeing an invalid pointer (object not initialized properly ..?).
>
>#3  0x00174fa4 in Csound::~Csound$delete () from 
>/usr/lib/python2.5/site-packages/_csnd.so
>#4  0x001400a6 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so
>
>Also, I should point out it crashes in the same function if I use Perform 
>or CsoundPerformanceThread
>
>If anyone has any idea on how to get around this crash let me 
>know.  Otherwise ... I guess you could call this a bug report.   I've 
>tried to locate this in the sources and I cannot seem to find the 
>destructor...
>
>
>
>import csnd
>import time
>
>import pygtk
>pygtk.require('2.0')
>import gtk
>
>str = """
>
>
>     
>         -odac -d -B4096 -b1024 -+rtaudio=alsa
>     
>
>
>     
>         nchnls = 2
>
>
>         instr 1
>             a1      oscili 30000, 220, 1
>
>
>             outs    a1, a1
>         endin
>     
>
>     
>         f1 0 8192 10 1
>
>         i1 0 3
>     
>
>
>"""
>
>class Example:
>     def close_application(self, widget):
>         gtk.main_quit()
>
>     def __init__(self):
>         global str
>
>
>         window = gtk.Window(gtk.WINDOW_TOPLEVEL)
>         window.set_resizable(True)
>         window.connect("destroy", self.close_application)
>         window.set_title("Title")
>         window.set_border_width(0)
>         window.set_size_request(800, 600)
>
>
>         sw = gtk.ScrolledWindow()
>         sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
>
>         textview = gtk.TextView()
>         textbuffer = textview.get_buffer()
>         textbuffer.set_text(str)
>
>         sw.add(textview)
>         sw.show()
>         textview.show()
>
>         button = gtk.Button('play')
>         button.connect("clicked", self.play, 'play')
>
>         box1 = gtk.VBox(False, 0)
>         box1.pack_start(sw, True, True, 0)
>         box1.pack_start(button, False, True, 0)
>
>
>         window.add(box1)
>         window.show_all()
>
>
>
>     def play(self, widget, data = None):
>         global str
>
>
>         f = file("test.csd", 'w')
>         f.write(str)
>         f.close()
>
>         # create & compile instance
>         self.cs = csnd.Csound()
>         self.cs.Compile("test.csd")
>
>         #self.cs.Perform()
>
>
>         self.perf = csnd.CsoundPerformanceThread(self.cs)
>         self.perf.Play()
>
>         # print "ksmps=", cs.GetKsmps()
>
>
>if __name__ == "__main__":
>     Example()
>     gtk.main()
>
>
>
>
>
>Backtrace
>
>0dBFS level = 32768.0
>Csound version 5.03.1 beta (float samples) Apr  4 2007
>libsndfile-1.0.17
>UnifiedCSD:  test.csd
>STARTING FILE
>Creating options
>Creating orchestra
>Creating score
>orchname:  /tmp/fileZ9OvB1.orc
>scorename: /tmp/file2RiPDk.sco
>rtaudio: ALSA module enabled
>orch compiler:
>7 lines read
>         instr   1
>Elapsed time at end of orchestra compile: real: 0.048s, CPU: 0.010s
>sorting score ...
>         ... done
>Elapsed time at end of score sort: real: 0.048s, CPU: 0.010s
>Csound version 5.03.1 beta (float samples) Apr  4 2007
>displays suppressed
>0dBFS level = 32768.0
>orch now loaded
>audio buffered in 1024 sample-frame blocks
>ALSA output: total buffer size: 4096, period size: 1024
>writing 4096-byte blks of shorts to dac
>SECTION 1:
>[New Thread -1213006960 (LWP 3060)]
>ftable 1:
>new alloc for instr 1:
>B  0.000 ..  3.000 T  3.000 TT  3.000 M:  30000.0  30000.0
>Score finished in csoundPerformKsmps().
>inactive allocs returned to freespace
>end of score.              overall amps:  30000.0  30000.0
>            overall samples out of range:        0        0
>0 errors in performance
>Elapsed time at end of performance: real: 4.041s, CPU: 0.040s
>130 4096-byte soundblks of shorts written to dac
>[Thread -1213006960 (LWP 3060) exited]
>
>Program received signal SIGSEGV, Segmentation fault.
>[Switching to Thread -1208924480 (LWP 3057)]
>0x004d73ec in free () from /lib/libc.so.6
>(gdb) bt
>#0  0x004d73ec in free () from /lib/libc.so.6
>#1  0x05d4e091 in operator delete () from /usr/lib/libstdc++.so.6
>#2  0x05d4e0ed in operator delete[] () from /usr/lib/libstdc++.so.6
>#3  0x00174fa4 in Csound::~Csound$delete () from 
>/usr/lib/python2.5/site-packages/_csnd.so
>#4  0x001400a6 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so
>#5  0x0568e18d in PyCFunction_Call () from /usr/lib/libpython2.5.so.1.0
>#6  0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
>#7  0x0565d0c1 in PyObject_CallFunctionObjArgs () from 
>/usr/lib/libpython2.5.so.1.0
>#8  0x0012afd7 in ?? () from /usr/lib/python2.5/site-packages/_csnd.so
>#9  0x0568bc12 in ?? () from /usr/lib/libpython2.5.so.1.0
>#10 0x056ab5ac in ?? () from /usr/lib/libpython2.5.so.1.0
>#11 0x0568a529 in ?? () from /usr/lib/libpython2.5.so.1.0
>#12 0x0568c474 in PyDict_SetItem () from /usr/lib/libpython2.5.so.1.0
>#13 0x05665900 in ?? () from /usr/lib/libpython2.5.so.1.0
>#14 0x0568feab in PyObject_SetAttr () from /usr/lib/libpython2.5.so.1.0
>#15 0x056d5602 in PyEval_EvalFrameEx () from /usr/lib/libpython2.5.so.1.0
>#16 0x056dbb7f in PyEval_EvalCodeEx () from /usr/lib/libpython2.5.so.1.0
>#17 0x0567aeea in ?? () from /usr/lib/libpython2.5.so.1.0
>#18 0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
>#19 0x05663428 in ?? () from /usr/lib/libpython2.5.so.1.0
>#20 0x0565bf27 in PyObject_Call () from /usr/lib/libpython2.5.so.1.0
>#21 0x056d3d3c in PyEval_CallObjectWithKeywords () from 
>/usr/lib/libpython2.5.so.1.0
>#22 0x0565d56c in PyObject_CallObject () from /usr/lib/libpython2.5.so.1.0
>#23 0x001ea067 in ?? () from 
>/usr/lib/python2.5/site-packages/gtk-2.0/gobject/_gobject.so
>#24 0x001feda2 in g_closure_invoke () from /lib/libgobject-2.0.so.0
>#25 0x0020f4d3 in ?? () from /lib/libgobject-2.0.so.0
>#26 0x002109f7 in g_signal_emit_valist () from /lib/libgobject-2.0.so.0
>#27 0x00210bb9 in g_signal_emit () from /lib/libgobject-2.0.so.0
>#28 0x0595bda3 in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0
>#29 0x0595da1e in ?? () from /usr/lib/libgtk-x11-2.0.so.0
>#30 0x0020c199 in g_cclosure_marshal_VOID__VOID () from 
>/lib/libgobject-2.0.so.0
>#31 0x001fd599 in ?? () from /lib/libgobject-2.0.so.0
>#32 0x001feda2 in g_closure_invoke () from /lib/libgobject-2.0.so.0
>
>
>
>greg
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2008.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth


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

Date2008-02-14 20:21
FromAnthony Kozar
SubjectRe: [Cs-dev] Csound Python module for X11/pygtk on OS X
Usually, custom additions to your Python library go in a sub-directory of
the Python installation:

Lib/site-packages/

It looks like you can put both the .py and the .dylib (or links to them) in
there.  It also seems to be possible to put the .dylib in Lib/lib-dynload/

Anthony Kozar
mailing-lists-1001 AT anthonykozar DOT net
http://anthonykozar.net/

Greg Thompson wrote on 2/14/08 1:29 AM:

> The problem I'm having is determining how to install the python
> csound module such that it fits into the macports structure.
> Macports only seems to have version 4.23 of csound available
> otherwise I would able to port install it.


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