[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] PV_Copy, LocalBuf problem



Some more testing. Surprising result (at least for myself).
SynthDef called "copy-test-local" below fails, but "copy-test-local-2" is good again! Only difference: Both LocalBufs are defined before putting into the chains.


(
~s = Stethoscope.defaultServer.waitForBoot {
	
	a = Buffer.alloc(~s, 2048);
	b = Buffer.alloc(~s, 2048);	
	
		// okay
	SynthDef("copy-test", { |bufA, bufB, out = 0|
		var sig, chainA, chainB, ifftA, ifftB;
		sig = Dust2.ar(10);
		chainA = FFT(bufA, sig);
		chainB = PV_Copy(chainA, bufB);
		ifftA = IFFT(chainA);
		ifftB = IFFT(chainB);
		Out.ar(out, [ifftA, ifftB]);
	}).send(~s);
	
		// not okay
	SynthDef("copy-test-local", { |out = 0, i_size = 2048|
		var sig, chainA, chainB, ifftA, ifftB;
		sig = Dust2.ar(10);
		chainA = FFT(LocalBuf(i_size), sig);
		chainB = PV_Copy(chainA, LocalBuf(i_size));
		ifftA = IFFT(chainA);
		ifftB = IFFT(chainB);
		Out.ar(out, [ifftA, ifftB]);
	}).send(~s);
		
		// okay !
	SynthDef("copy-test-local-2", { |out = 0, i_size = 2048|
		var sig, chainA, chainB, ifftA, ifftB;
		var bufA, bufB;
		bufA = LocalBuf(i_size); // defined before usage
		bufB = LocalBuf(i_size); //
		sig = Dust2.ar(10);
		chainA = FFT(bufA, sig);
		chainB = PV_Copy(chainA, bufB);
		ifftA = IFFT(chainA);
		ifftB = IFFT(chainB);
		Out.ar(out, [ifftA, ifftB]);
	}).send(~s);
};
)

y = Synth("copy-test", ["bufA", a, "bufB", b], ~s); // good, in phase mono
y.free;

y = Synth("copy-test-local", [], ~s); // bad, left channel only
y.free;

y = Synth("copy-test-local-2", [], ~s); // good, in phase mono
y.free;

a.free; b.free;

///////////////////////////////////////////////// PS:
For testing I also used the Lissajous mode of scoping.
I got a crash there. Report:


Process:         SuperCollider [437]
Path: /Applications/SuperCollider/SuperCollider.app/ Contents/MacOS/SuperCollider
Identifier:      net.sourceforge.supercollider
Version:         ??? (2009-06-16 (Revision 9218))
Code Type:       PPC (Native)
Parent Process:  launchd [102]

Interval Since Last Report:          45391 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  39475 sec
Per-App Crashes Since Last Report:   2

Date/Time:       2009-06-22 13:03:27.578 +0200
OS Version:      Mac OS X 10.5.7 (9J61)
Report Version:  6
Anonymous UUID:  5A708F4F-3FCC-4071-A249-E11F7901489A

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000007465736c
Crashed Thread:  20

Thread 0:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812 3 com.apple.AppKit 0x932aaa58 _NSUnhighlightCarbonMenu + 128 4 com.apple.AppKit 0x931fef1c -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 260 5 com.apple.AppKit 0x931febc4 -[NSMenu performKeyEquivalent:] + 744 6 com.apple.AppKit 0x931fd6a8 -[NSApplication _handleKeyEquivalent:] + 456 7 com.apple.AppKit 0x93133d80 -[NSApplication sendEvent:] + 3676
8   com.apple.AppKit              	0x930a0e40 -[NSApplication run] + 776
9   com.apple.AppKit              	0x9307181c NSApplicationMain + 440
10  net.sourceforge.supercollider 	0x00002868 _start + 756
11  net.sourceforge.supercollider 	0x0000256c start + 44
12  ???                           	0xbffffb80 0 + 3221224320

Thread 1:
0 libSystem.B.dylib 0x9580b62c recvfrom$NOCANCEL $UNIX2003 + 12
1   libSystem.B.dylib             	0x957b026c malloc + 64
2   net.sourceforge.supercollider 	0x000dfcfc SC_UdpInPort::Run() + 84
3   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 2:
0   libSystem.B.dylib             	0x957af378 mach_wait_until + 8
1   libSystem.B.dylib             	0x9583a6ec nanosleep + 324
2   libSystem.B.dylib             	0x958514c8 sleep + 72
3   net.sourceforge.supercollider 	0x0007fe84 resyncThread(void*) + 56
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 3:
0 libSystem.B.dylib 0x957af278 semaphore_timedwait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2368 _pthread_cond_wait + 1320
2   net.sourceforge.supercollider 	0x000817c0 TempoClock::Run() + 256
3   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 4:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812
3   com.apple.CoreFoundation      	0x90396dac CFRunLoopRun + 60
4 com.apple.DVCPROHDMuxer 0x16fb1e3c AVS::DestroyAVCDeviceController(AVS::AVCDeviceController*) + 428
5   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 5:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812 3 com.apple.audio.CoreAudio 0x9556efa8 HALRunLoop::OwnThread(void*) + 212 4 com.apple.audio.CoreAudio 0x9556ede4 CAPThread::Entry(CAPThread*) + 104
5   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 6:
0 libSystem.B.dylib 0x957af258 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2378 _pthread_cond_wait + 1336
2   net.sourceforge.supercollider 	0x000814bc schedRunFunc(void*) + 88
3   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 7:
0   libSystem.B.dylib             	0x95812d74 select$DARWIN_EXTSN + 12
1   com.apple.CoreFoundation      	0x903a1998 __CFSocketManager + 764

Thread 8:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812 3 com.apple.CFNetwork 0x96af49b4 CFURLCacheWorkerThread(void*) + 288
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 9:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812 3 com.apple.Foundation 0x95a8fd38 + [NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 280
4   com.apple.Foundation          	0x95a38d6c __NSThread__main__ + 1004
5   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 10:
0 libSystem.B.dylib 0x957af278 semaphore_timedwait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2368 _pthread_cond_wait + 1320
2 com.apple.Foundation 0x95a76188 -[NSCondition waitUntilDate:] + 384 3 com.apple.Foundation 0x95a75fb4 -[NSConditionLock lockWhenCondition:beforeDate:] + 268 4 com.apple.AppKit 0x93102f2c -[NSUIHeartBeat _heartBeatThread:] + 664
5   com.apple.Foundation          	0x95a38d6c __NSThread__main__ + 1004
6   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 11:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812
3   com.apple.CoreFoundation      	0x90396dac CFRunLoopRun + 60
4 com.apple.DesktopServices 0x90dc8520 TSystemNotificationTask::SystemNotificationTaskProc(void*) + 104
5   ...ple.CoreServices.CarbonCore	0x91b7a428 PrivateMPEntryPoint + 76
6   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 12:
0   libSystem.B.dylib             	0x957af1f8 mach_msg_trap + 8
1   libSystem.B.dylib             	0x957b611c mach_msg + 56
2 com.apple.CoreFoundation 0x90396524 CFRunLoopRunSpecific + 1812
3   com.apple.CoreFoundation      	0x90396dac CFRunLoopRun + 60
4 com.apple.DesktopServices 0x90dc869c TFSEventsNotificationTask::FSEventsNotificationTaskProc(void*) + 176
5   ...ple.CoreServices.CarbonCore	0x91b7a428 PrivateMPEntryPoint + 76
6   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 13:
0   libSystem.B.dylib             	0x957b5c0c __semwait_signal + 12
1   libSystem.B.dylib             	0x957f246c _pthread_cond_wait + 1580
2   ...ple.CoreServices.CarbonCore	0x91b7c644 TSWaitOnCondition + 132
3 ...ple.CoreServices.CarbonCore 0x91b5aa94 TSWaitOnConditionTimedRelative + 204
4   ...ple.CoreServices.CarbonCore	0x91b7c200 MPWaitOnQueue + 272
5 com.apple.DesktopServices 0x90dd3bf4 TNodeSyncTask::SyncTaskProc(void*) + 88
6   ...ple.CoreServices.CarbonCore	0x91b7a428 PrivateMPEntryPoint + 76
7   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 14:
0 libSystem.B.dylib 0x957af258 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2378 _pthread_cond_wait + 1336
2 DiskIOUGens.scx 0x1a831a34 SC_SyncCondition::WaitEach() + 44 (SC_SyncCondition.cpp:46) 3 DiskIOUGens.scx 0x1a833b40 disk_io_thread_func(void*) + 36
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 15:
0   libSystem.B.dylib             	0x957af378 mach_wait_until + 8
1   libSystem.B.dylib             	0x9583a6ec nanosleep + 324
2   libSystem.B.dylib             	0x9583a594 usleep + 68
3 KeyboardUGens.scx 0x156208fc gstate_update_func(void*) + 40
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 16:
0   libSystem.B.dylib             	0x957af378 mach_wait_until + 8
1   libSystem.B.dylib             	0x9583a6ec nanosleep + 324
2   libSystem.B.dylib             	0x9583a594 usleep + 68
3 MouseUGens.scx 0x15658ba0 gstate_update_func(void*) + 264
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 17:
0 libSystem.B.dylib 0x957af258 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2378 _pthread_cond_wait + 1336
2 BEASTMulchSendIndex.scx 0x1a9674d4 SC_SyncCondition::WaitEach() + 56 (SC_SyncCondition.cpp:46) 3 BEASTMulchSendIndex.scx 0x1a9680a8 disk_io_thread_func(void*) + 44 (BEASTMulchSendIndex.cpp:128)
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 18:
0   libSystem.B.dylib             	0x957af378 mach_wait_until + 8
1   libSystem.B.dylib             	0x9583a6ec nanosleep + 324
2   libSystem.B.dylib             	0x958514c8 sleep + 72
3 net.sourceforge.supercollider 0x000fbbb4 resyncThreadFunc(void*) + 16
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 19:
0 libSystem.B.dylib 0x957af258 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib             	0x957f2378 _pthread_cond_wait + 1336
2 net.sourceforge.supercollider 0x0011c0bc SC_SyncCondition::WaitNext() + 48 3 net.sourceforge.supercollider 0x000fe4ec SC_AudioDriver::RunThread() + 72
4   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 20 Crashed:
0 net.sourceforge.supercollider 0x00127e38 AllocPool::Free(void*) + 12 1 FFT_UGens.scx 0x12fcaa0c IFFT_Dtor + 120 (FFT_UGens.cpp:283) 2 net.sourceforge.supercollider 0x00104a54 Group_DeleteAll(Group*) + 60 3 net.sourceforge.supercollider 0x0010a090 meth_g_freeAll(World*, int, char*, ReplyAddress*) + 156 4 net.sourceforge.supercollider 0x00106260 SC_LibCmd::Perform(World*, int, char*, ReplyAddress*) + 64 5 net.sourceforge.supercollider 0x000ff4b4 Perform_ToEngine_Msg(FifoMsg*) + 80 6 net.sourceforge.supercollider 0x000feb04 SC_CoreAudioDriver::Run(AudioBufferList const*, AudioBufferList*, long long) + 332 7 net.sourceforge.supercollider 0x000ff43c appIOProc(unsigned long, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*) + 484 8 com.apple.audio.CoreAudio 0x95582620 HP_IOProc::Call(AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioTimeStamp const&, AudioBufferList*) + 324 9 com.apple.audio.CoreAudio 0x955822ac IOA_Device::CallIOProcs(AudioTimeStamp const&, AudioTimeStamp const&, AudioTimeStamp const&) + 300 10 com.apple.audio.CoreAudio 0x95582160 HP_IOThread::PerformIO(AudioTimeStamp const&) + 548 11 com.apple.audio.CoreAudio 0x95580b30 HP_IOThread::WorkLoop() + 808 12 com.apple.audio.CoreAudio 0x955807f0 HP_IOThread::ThreadEntry(HP_IOThread*) + 12 13 com.apple.audio.CoreAudio 0x9556ede4 CAPThread::Entry(CAPThread*) + 104
14  libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 21:
0   libSystem.B.dylib             	0x957f0904 kevent + 12
1 com.apple.CoreFoundation 0x9036db40 __monitor_file_descriptor__ + 88

Thread 22:
0   libSystem.B.dylib             	0x957afeb4 read + 12
1   libSystem.B.dylib             	0x957f91e0 _sread + 44
2   libSystem.B.dylib             	0x957f914c __srefill + 376
3   libSystem.B.dylib             	0x957f8ec8 fgets + 124
4 net.sourceforge.supercollider 0x00087d74 string_popen_thread_func(void*) + 44
5   libSystem.B.dylib             	0x957f10c4 _pthread_start + 316

Thread 20 crashed with PPC Thread State 32:
srr0: 0x00127e38 srr1: 0x0200f030 dar: 0x7465736c dsisr: 0x00200000 r0: 0x0011d0a4 r1: 0xf0aa8690 r2: 0x19959000 r3: 0x009a2000 r4: 0x74657364 r5: 0x19965058 r6: 0x00000000 r7: 0x00000032 r8: 0x009a26c0 r9: 0x0021db80 r10: 0x009a26c0 r11: 0x80000000 r12: 0x0011d0a4 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000 r16: 0x1bb83000 r17: 0xcde9e37f r18: 0x6c1e064c r19: 0x00000000 r20: 0x955d081c r21: 0xf0aa8cec r22: 0x43300000 r23: 0x1867f8e0 r24: 0x1867ccf0 r25: 0x1bb7e844 r26: 0x1b3560b0 r27: 0x1867ccf0 r28: 0x00000007 r29: 0x00000004 r30: 0x1b3563d8 r31: 0x12fca9a0 cr: 0x44000444 xer: 0x00000000 lr: 0x12fcaa10 ctr: 0x0011d0a4
vrsave: 0x00000000

Binary Images:

[...]

/////////////////////////////////////////////////

Am 20.06.2009 um 20:17 schrieb Stephan Wittwer:

Hi,

First a slightly modified example from PV_Copy help file, showing subtraction.
It works fine, output is zero.
But doing the same (?) with LocalBufs doesn't work.

Any ideas? Thanks.
Stephan



(
s.waitForBoot {
	b = Buffer.alloc(s, 2048, 1);
	c = Buffer.alloc(s, 2048, 1);
}
)

(
x = { var sig, chainA, chainB, ifftA, ifftB;
	sig = LFClipNoise.ar(100);
	chainA = FFT(b, sig); // bufs from context
	chainB = PV_Copy(chainA, c);
	ifftA = IFFT(chainA);
	ifftB = IFFT(chainB);
	[ifftA, ifftB].poll; // channels equal
	ifftA - ifftB; // cancels to zero so silent!
}.play(s);
)

x.free;
// IFFTed frames contain the same windowed output data
b.plot(\b, Rect(200, 430, 700, 300)); c.plot(\c, Rect(200, 100, 700, 300));

b.free; c.free;




(
	// CAUTION: LOUD, dangereous !
	
	// trying the same as above w/ LocalBufs

	
x = { var sig, chainA, chainB, ifftA, ifftB;
	sig = LFClipNoise.ar(100);
	chainA = FFT(LocalBuf(2048), sig);
	chainB = PV_Copy(chainA, LocalBuf(2048));
	ifftA = IFFT(chainA);
	ifftB = IFFT(chainB);
	[ifftA, ifftB].poll; // channels different
	ifftA - ifftB; // LOUD
}.play(s);
)

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/