MedianSeparation crashing scsynth
SuperCollider 3.8.0 Built from branch 'HEAD' [0947edd] Mac OS 10.12.6
Running the minimal example from the MedianSeparation helpfile always crashes the server here
//minimal example
(
{
var harmonic, percussive;
var source = SoundIn.ar;
var fft = FFT(LocalBuf(1024),source);
#harmonic,percussive = MedianSeparation(fft,FFTTrigger(LocalBuf(1024)),FFTTrigger(LocalBuf(1024)),1024,17);
[IFFT(harmonic),IFFT(percussive)] //reconstruct harmonic to left ear, percussive to right
}.play
)
A bit confusingly (for me), the culprit given in the crash report is different in the 3.8.0 release build of the plugins downloaded from github, and in my own build from the 3.8.0 tag in the repo (692f92f).
Release build:
Thread 9 Crashed:: com.apple.audio.IOThread.client
0 NCAnalysisUGens.scx 0x0000000100f8a818 cmp(void const*, void const*) + 8
1 libsystem_c.dylib 0x00007fffa395a6e4 _qsort + 244
2 NCAnalysisUGens.scx 0x0000000100f8ad0b MedianSeparation_next + 843
...
My build:
Thread 7 Crashed:: com.apple.audio.IOThread.client
0 NCAnalysisUGens.scx 0x0000000103c52ec5 detail::Complex::ToPolarApx() + 341
1 NCAnalysisUGens.scx 0x0000000103c52d48 detail::Complex::ToPolarApxInPlace() + 24
2 NCAnalysisUGens.scx 0x0000000103c52ca4 ToPolarApx(SndBuf*) + 100
3 NCAnalysisUGens.scx 0x0000000103c5240d MedianSeparation_next + 2589
...
I can reproduce on linux with recent 3.9dev.
I've played around with this UGen a month ago. It worked back them. Not certain if I tried this particular example however.
Some observations:
- ~the first example from
MedianSeparation's Help file works, after running the second example.~ The example seems to work, but doesn't produce sound when run after the second example in theMedianSeparationhelp file. - this example doesn't work when rewritten as a
SynthDef. - the first example works if you use
PV_Copyinstead ofFFTTriggerlike so:
(
{
var source = SoundIn.ar;
var fft = FFT(LocalBuf(1024),source);
var harmonic = PV_Copy(fft, LocalBuf(1024));
var percussive = PV_Copy(fft, LocalBuf(1024));
# harmonic, percussive = MedianSeparation(fft,harmonic,percussive,1024,17);
[IFFT(harmonic),IFFT(percussive)]
}.play
)
(deleted referenced to other issues)
I haven't been able to get any sound out of this example using FFTTrigger. The only way MedianSeparation seems to work is if you use PV_Copy.
At this point, I'd say the Help file should be written to suggests this. It may be the case that SC changed in a way that breaks this example. I wouldn't say that MedianSeparation or FFTTrigger are broken. They simply don't seem to work together.
@sicklincoln do you have anything to add to this issue?