A spectrogram in Jitter to click and select seeding bases for nmf

Hello

This example of nmf use was exciting, and @groma dared me to implement it. As I had other boring things to do yesterday, I did that instead :wink:

It is a big patch, not super well documented but enough to get anyone going. It is fun I think. The selection and the visualisation are not remotly as good as the example, but the principle under the hood is similar I think… or maybe not but it is nevertheless fun. It is sort of the opposite of the bird finding nmfmatch example, where we divide randomly first, then classify. Here we spectrogram, then select conditionally graphically, then run an nmf.

I hope you like it. I can comment a bit more if that helps

pa

===


----------begin_max5_patcher----------
5505.3oc28rsiiiqbOOyWghQBP2yocOh2zkCPBlDj7vBjaODj7vNCZHaK2s1
QVRPRd5Y1CNy2dHYQoVxMkMsMocum8haKIKwpJV2XUEK8Wd+6lsn76oMy79y
d+p26d2e48u6cxSINw6TG+tYaR99x7jF4Oa1xxMaRKZmcGbs1zu2JOexsdKy
yV9UuxBu1mR8ZKq7xSW25sXaaq3bkdKKq9g7ZKRZRaDmIwqIMcUVwi7e050o
0etXQ2igeU4OEt6Eo4kOKNW8V3wWrYsWUc4xzllOWr7Vu7rl1T4n77SYKeJ8
ao07waSUYAGX8dNq8I4sUkm7C9UD.Wc1iO0iF4YEoKK2VHwEh5jYqjXV4hea
NBw59oEa2jUjm1JIGnWNY411ty5qNaS6OxSkOitatJoc4Sb78g5zks.YGGFe
O6Nu3X78924QhHh+PCu226Kh64u992K93NCmdJRelCuuZ1IuLY0FNsxaNJxe
lN7irW7qpNsgSHSZyJKF.6HT.S.twH4e7Ue38EsjEzwPVP9j.4iFKezQwhOw
3AOb3I29ipT3NlM6jnXSwP29bZxWAV4m3X+SdIEq7xKK+pWRq7zMUbfst7w5
jMbFrhUkOaN2D1UbSHVHVvNgXQBBFh4eVrS6QZuIskK+J+odb.dAWr5FDeJx
qr1ibqTRF9I.4qLeE+abR2yka4esfK2KjVWj5sQ7q.RpTzWnNnpLiK1JzPzz
j8XAbmKxJ.0B7uKGWojOntH44je7pYnkk4kaqazNsvzMs36toEwT.e9vOTJe
iIx+DRs77Rutyk4oI0d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Eyj2olrp425ta
wxYa3PeVWbFFN4NBgkaGz8gxi.IJlvvwxsPYHlQkeCGRYHaCVi5qB5ArimFu
3QQWbtGgF1fP65F.ydrNYU1K8.LE9i5mSB3+S3cZ+1n1Xu71vc2VXTDmxcm1
u85ayjst5n6R29fU2NZs+2ussrGQ6hDUeGHU+z2XoCylEG1ufMf6RNmQ4rU9
X4233LGlOUNK987We++u+imFZ
-----------end_max5_patcher-----------

I like the idea, but I’m not sure how this patch is supposed to work.

I load the Nicol audio file and then…nothing happens. If I bang the info~, nothing happens either. (I also tried saving it and reopening it, in case it’s a loadbang issue, but still nothing).

To be fair, it could also just be me, because I never understood the “bird finder” patch either.

edit: Ok, I see you have to manually tweak the spectrogram thresholds (even though there is a default audio file to correspond with it). Still couldn’t get any color action though.

colour: you select a class, and a threshold, and you click in the spectrogram a place. If the threshold is met, it will colour that frequency.

To colour about everywhere, just select a class (1) and keep the threshold to -180 and click on a white bit.

I know, not the best UI but this is proof of concept and fun code, no?

I see, it’s more like a click+drag kind of thing. Clicking on individual things didn’t really seem to do anything because (I guess) I was clicking on specific tiny bins that were empty, or missing the things altogether.

It seems cool, but, like the bird patch, I think I’m not really getting what is supposed to be happening. (I wouldn’t have understood your JIT nmf patch either, had you not showed me it in person)

hmmmm… maybe I’m now too much in-the-know… anyway @weefuzzy will pick up the ownership of help/doc/examples/tutorials so it is important you keep telling us when you get or not get something!

thanks for the feedback

Like this idea and all seems to be working fine for me (bases buffer populated, resynth too) but no audio (nan coming out of play for all components). Ideas?

Hello!

I’ve just tried it, and you might get NaNs if you do not put at least a little something in all 3 ranks… @groma and I are thinking of a way to deal with empty bases but at the moment it is a division by 0 so the machine is not too happy…

1 Like

gotcha. thanks will try again shortly!

1 Like