Csound Csound-dev Csound-tekno Search About

[Cs-dev] [ csound-Bugs-2959788 ] STKShakers not stable in real time on UBUNTU

Date2011-01-10 18:59
From"SourceForge.net"
Subject[Cs-dev] [ csound-Bugs-2959788 ] STKShakers not stable in real time on UBUNTU
Bugs item #2959788, was opened at 2010-02-26 18:54
Message generated for change (Comment added) made by jpff
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=564599&aid=2959788&group_id=81968

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: csound
Group: csound5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Rene Djack (rene-djack)
Assigned to: Michael Gogins (gogins)
Summary: STKShakers not stable in real time on UBUNTU

Initial Comment:
Below csd give seg fault on Ubuntu 32b when playing in RT with midi.
Problem occurs when playing around midi keys 57 to 61. 

(all other STK opcodes are OK in real time)



-fdhnm0 -odac:plughw -b16 -B512 --expression-opt -+rtaudio=alsa -+rtmidi=alsa -Mhw:1,0 --midi-key=4



; MESSAGE : not stable; seg fault with midi-key 57 to 61

sr	= 44100
ksmps	= 16
nchnls	= 1
0dbfs	= 2.0

instr	1	; STK Shakers

		print p4
iHz		= cpsmidinn(p4)

asig		STKShakers	iHz, 1.0, 1071, 22, 11, 1, 128, 100, 1, 30
		out		asig
endin


f 0 300



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

>Comment By: John ffitch (jpff)
Date: 2011-01-10 18:59

Message:
OK found a real problem  There re 24 instruments declared but this program
writes to instr 28 and hence overwrites something
798     void Shakers :: noteOn( StkFloat frequency, StkFloat amplitude )
799     {
800       // Yep ... pretty kludgey, but it works!
801       int noteNum = (int) ((12*log(frequency/220.0)/log(2.0)) + 57.01)
% 32;
802       if (instType_ !=  noteNum) instType_ = this->setupNum(noteNum);
803       shakeEnergy_ += amplitude * MAX_SHAKE * 0.1;
804       if (shakeEnergy_ > MAX_SHAKE) shakeEnergy_ = MAX_SHAKE;
805       if (instType_==10 || instType_==3) ratchetPos_ += 1;

can writ eoff array.

So a Perry Cook error and not csound

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

Comment By: John ffitch (jpff)
Date: 2011-01-10 18:38

Message:
Seems to be a memory problem .  Running under gdb I see an illegal memory
acces in clenup in csoundDestroy.
Under valgrind I see much earier  an Invalid write of size 8 in
stk::Shakers::setupNum(int) (Shakers.cpp:786)
which suggests unallocated array?
  Either way looks lik eth estk interface or the stk code


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

Comment By: John ffitch (jpff)
Date: 2010-09-01 09:14

Message:
Thanks; that does indeed shed some light.  Wll investigate further.


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

Comment By: Rene Djack (rene-djack)
Date: 2010-08-30 20:57

Message:
Have tested with gdb, here the result:


	gdb csound
 
	(gdb) r "/home/moi/csd/0_Files/Bugs/STK_Shakers_score.csd"
	Starting program: /home/moi/csound5-f-debug/csound
"/home/moi/csd/0_Files/Bugs/STK_Shakers_score.csd"
	[Thread debugging using libthread_db enabled]
	time resolution is 0.416 ns
	virtual_keyboard real time MIDI plugin for Csound
	0dBFS level = 32768.0
	Csound version 5.12 beta (float samples) Aug 30 2010
	libsndfile-1.0.21
	UnifiedCSD:  /home/moi/csd/0_Files/Bugs/STK_Shakers_score.csd
	STARTING FILE
	Creating options
	Creating orchestra
	Creating score
	orchname:  /tmp/csound-UG7iFe.orc
	scorename: /tmp/csound-0DEwzU.sco
	RAWWAVE_PATH: /home/moi/csound5-f-debug/Opcodes/stk/rawwaves/
	orch compiler:
	11 (12) lines read
		instr	1	
	Elapsed time at end of orchestra compile: real: 0.002s, CPU: 0.000s
	sorting score ...
		... done
	Elapsed time at end of score sort: real: 0.003s, CPU: 0.000s
	Csound version 5.12 beta (float samples) Aug 30 2010
	displays suppressed
	0dBFS level = 32768.0
	orch now loaded
	audio buffered in 256 sample-frame blocks
	writing 1024-byte blks of floats to /home/moi/Tempo/test.wav (WAV)
	SECTION 1:
	new alloc for instr 1:
	B  0.000 ..  0.300 T  0.300 TT  0.300 M:   5494.4
	new alloc for instr 1:
	B  0.300 ..  0.700 T  0.700 TT  0.700 M:   6186.5
	B  0.700 ..  1.100 T  1.100 TT  1.100 M:   5512.2
	B  1.100 ..  1.500 T  1.500 TT  1.500 M:   6164.7

	Program received signal SIGSEGV, Segmentation fault.
	0x0065a944 in insert (csound=0x804dbc0, insno=1, newevtp=0x8050240)
	    at Engine/insert.c:126
	126	      if (ip->actflg && ip->offtim < 0.0 && ip->p1 == newevtp->p[1])
{
	(gdb) 

	(gdb) where
	#0  0x0065a944 in insert (csound=0x804dbc0, insno=1, newevtp=0x8050240)
	    at Engine/insert.c:126
	#1  0x00666abc in process_score_event (csound=0x804dbc0, evt=0x8050240, 
	    rtEvt=0) at Engine/musmon.c:689
	#2  0x00667440 in sensevents (csound=0x804dbc0) at Engine/musmon.c:874
	#3  0x006eebab in csoundPerform (csound=0x804dbc0) at Top/csound.c:1459
	#4  0x08049ac1 in main (argc=2, argv=0xbffff444)
	    at frontends/csound/csound_main.c:136
	(gdb) 

All other STK opcodes works well.
My system is ubuntu 10.04, csound cvs float and double.
But i  have seen this "problem" since about 2 years (file CsoundVST.csd in
csound examples).

First time i use gdb, hope this help.

Cheers,
René



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

Comment By: John ffitch (jpff)
Date: 2010-08-30 18:49

Message:
I have managed to build STK and it runs with no errors on my Linux system
Suggested that this is an Ubuntu error.  From whence came your system?

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

Comment By: John ffitch (jpff)
Date: 2010-08-30 18:02

Message:
 Is thi sin Csound or in the STK system?  Can you run under gdb and then
with the where command isolate the function involved?  I still do not seem
to be able to build the STK code due to many C++ errors, and my knowledge
of C++ is insufficient to understand it

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

Comment By: John ffitch (jpff)
Date: 2010-03-05 18:31

Message:
I am having trouble building the STK code, so it may be a while before I
can help

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

Comment By: Rene Djack (rene-djack)
Date: 2010-03-05 17:49

Message:
I'have done:
rt-midi play -> midi record -> midi file -> score file --->score
instrument 

and isolate a faulty section as below, i have changed the frequency to the
same values.



-Wfd -+rtaudio=null -+rtmidi=null --expression-opt


sr	= 44100
ksmps	= 16

instr	1	; STK Shakers

asig		STKShakers	p4, 1.0, 1071, 22, 11, 1, 128, 100, 1, 30
		out		asig*100000
endin


i 1	10.0	0.45	261.626
i 1	10.3	0.29	261.626
i 1	10.7	0.48	261.626
i 1	11.1	0.27	261.626
i 1	11.5	0.63	261.626



This give seg fault every time i run it.




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

Comment By: Nobody/Anonymous (nobody)
Date: 2010-03-04 16:49

Message:
I have tried with score activated (without midi), but i don't success to
have any seg fault.

Seg fault appears if i play "fast" on my midi keyboard.
Below midi note 57 no problem
Higher midi note 61 no problem
Between 57 and 61 seg fault
Note 57 and 59 played at the same time give seg fault, most of the time
but not always!!!

I will record a midi file to test with score.
Thanks
René 




  

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

Comment By: John ffitch (jpff)
Date: 2010-03-04 16:05

Message:
Does this fail without MIDI?  That is, is it the high frequency?

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

Comment By: John ffitch (jpff)
Date: 2010-02-28 17:30

Message:
This is Michael's code; referred to him

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=564599&aid=2959788&group_id=81968

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/l