Using buses as FluidMFCC input - Supercollider

Hello everyone,

I am a new user of the discourse forum but I have tried to integrate FluCoMa for a few weeks.
I’m trying to read from a Bus (audio-rate) and using it as input of the FluidMFCC method but it seems to not working.
I’m working at 192 kHz of sampling rate as I want to analyze signals from 40 to 50 kHz.

Thanks in advance for your help.

This is a very simple example:

{(
	Out.ar(0, LPF.ar(SinOsc.ar!2, 220, 0.5) ); 
)}.play

(
b = Bus.new(\control,0,13);
w = Window("MFCCs Monitor", Rect(10, 10, 420, 320)).front;
a = MultiSliderView(w,Rect(10, 10, 400, 300)).elasticMode_(1).isFilled_(1);
a.reference_(Array.fill(13,{0.5})); //make a center line to show 0
)

(
~winRange = 40;

r = Routine {
    {
        b.get({ arg val;
            {
                if(w.isClosed.not) {
                    a.value = val.linlin(~winRange.neg,~winRange,0,1);
                }
            }.defer
        });
        0.01.wait;
    }.loop
}.play
)

(
x = {arg bands = 20, low = 40000, high = 50000;
	var source = In.ar(0,2);
	Out.kr(b,FluidMFCC.kr(source, 40, bands, low, high, 4096));
	source.dup;
}.play;
)
1 Like

Hi @alberto.rizzo and welcome!

As far as I can tell, reading from an audio bus does work!

For the low-numbered audio-buses that map to hardware channels, I don’t think it’s possible to use In.ar to read from Out.ar like that, unless your sound card has some sort of loopback. Even using a private bus, I found I needed to use InFeedback rather than In to pick up the signal. Then, on the output, I think the multichannel expansion was complicating things; in the working example below, I’m just reading mono from the input bus, and capping the MFCC outputs to 13 to keep things simple.

This seems to work for me. I’ve used pink noise as a test signal instead, because a 220Hz sine wave isn’t going to yield anything useful between 40-50k:

(
s.options.sampleRate = 192000;
s.reboot; 
)

(
b = Bus.new(\control,0,13);
c = Bus.audio(s,2);
w = Window("MFCCs Monitor", Rect(10, 10, 420, 320)).front;
a = MultiSliderView(w,Rect(10, 10, 400, 300)).elasticMode_(1).isFilled_(1);
a.reference_(Array.fill(13,{0.5})); //make a center line to show 0
)

(
~winRange = 40;

r = Routine {
    {
        b.get({ arg val;
            {
                if(w.isClosed.not) {
                    a.value = val.linlin(~winRange.neg,~winRange,0,1);
                }
            }.defer
        });
        0.01.wait;
    }.loop
}.play
)

(
{	Out.ar(c, PinkNoise.ar!2 ); }.play; 

x = {arg bands = 40, low = 40000, high = 50000;
    var source = InFeedback.ar(c,1);
    var mfcc = FluidMFCC.kr(source, 13, bands, low, high, 4096,maxNumCoeffs:13);
    Out.kr(b,mfcc);
}.play;
)
2 Likes

Thank you for your reply, really appreciated!

Using the InFeedback Ugen definitely did the job, and of course, working with a mono channel is correct.
I used to use In when I need to work in a ProxySpace, but this is a different context.
Apologies for the bad example, I have pasted an incorrect chunk of code.

2 Likes