Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: add client for NMFMorphing from live input #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elgiano
Copy link
Contributor

@elgiano elgiano commented May 12, 2021

Hi and thanks for this amazing library, I'm really into it and reading some of your papers too! Great work!
I wanted to do NMF morphing on some live input, after having pretrained bases for both source and target. Here I wrote an additional client that combines NMFMatch and NMFMorph, so that it can get activations live from an audio input and multiply them with interpolated bases from source and target.

I thought it could be useful to share it, so here it is. If you like it and you want to pull it I could write a SuperCollider help file for it as well.

@g-roma
Copy link
Member

g-roma commented May 13, 2021

Hello @elgiano , thanks for the PR! It looks like a cool idea, so we will review shortly. I take it you have tested this in SuperCollider?

@elgiano
Copy link
Contributor Author

elgiano commented May 13, 2021

Yes, I tested it in SuperCollider and it works beautifully.

By the way, one thing that I found also for NMFMorph is that to have good results (aka not so much crackle which I guess comes from phase estimation) I need a hopSize of at least fftSize/8.

And another thing, here is the sc class, which I based on FluidNMFMorph, with two comments:

FluidNMFMorphIn : FluidRTUGen {

	*ar { arg in, source = -1, target = -1, autoassign = 1, interp = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
                // 1. here I use .asUGenInput so that I can pass Buffer objects directly, for instance when using Ndefs for quick testing
                // MultiOutUGen subclasses do it by default on all arguments in *multiNew, normal UGen doesn't
		source = source.asUGenInput ?? {-1};
		target = target.asUGenInput ?? {-1};

		^this.new1('audio', in.asAudioRateInput(this), source, target, autoassign, interp, windowSize, hopSize, fftSize, maxFFTSize);
	}

	init {arg ...theInputs;
		inputs = theInputs;
                // 2. I don't really know what specialIndex is for, but setting it to -1 wouldn't work here (all parameters would be shifted)
		// specialIndex = -1;
	}

	checkInputs {
		if(inputs.last.rate != 'scalar') {
			^(": maxFFTSize cannot be modulated.");
		};
		^this.checkValidInputs;
	}
}

@g-roma
Copy link
Member

g-roma commented May 13, 2021

Nice, thanks. Yes, the phase synthesis works better with a lot of overlap, although so far we tend to have uniform defaults for all spectral processing.

@elgiano
Copy link
Contributor Author

elgiano commented May 13, 2021

Fair enough! But I would consider mentioning it in the help files / examples :)

@tremblap
Copy link
Member

Thanks indeed for this @elgiano - and yes, optimal FFT settings for each algo, with their trade-offs, for various signal types, is something on our radar for the next year where we try to get these concepts across in creative ways.

@elgiano
Copy link
Contributor Author

elgiano commented May 15, 2021

@tremblap
OT:
For next year you mean 2022 or next academic year? Because I'm studying sound and music computing in Copenhagen and I need to do an internship next semester (sep 2021)... and to work on creative applications with flucoma sounds like a great project for me :)

@tremblap
Copy link
Member

Oh this idea of internship has a lot of potential indeed! I'll need to speak to the team first, but feel free to contact me on my academic email ([email protected]) with what you have in mind.

Adds a new client to do NMF Morphing on live audio input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants