Smartelectronix Alex Antti Bram DestroyFX dmi dunk ioplong Jaha Jason Koen Magnus mda mdsp Sean

Tuesday, November 15, 2005

Simple demixing


This is a commandline program that lets you decompose a sound into additive components in the spectral domain.

what it does is:
1) generate the sound's spectrogram
2) decompose the spectrogram into N layers
3) resynthesize each layer and the residual to a separate soundfile

usage:
nmfdemix [-m] [-s] [-o long] [-c double] [-i long] [-f long] [--] [-v] [-h] filename #components

where:
-o , --overlap overlap factor (default 4)
-c , --criteria stopping criteria (default 0.001)
-i , --maxiterations max number of iterations (default 1000)
-f , --fftsize fftsize (default 4096)
-m, --matrixout output W and H matrices
-s, --silent don't be verbose

download
nmfdemix for windows XP
nmfdemix for mac OSX

warning:
this tool takes some time to converge to a good solution and can be very heavy on CPU.
I only have tested it with files containing a few bars and less than 10 components/layers.

31 Comments:

At Saturday, 26 November, 2005, Anonymous said...

Just a simple question:
How is it working ?

 
At Saturday, 26 November, 2005, mdsp said...

you give it a soundfile and the number of layers and let it do its job.

if you want some maths, here's an article:

http://www.merl.com/reports/docs/TR2004-094.pdf

 
At Monday, 28 November, 2005, cron said...

Cheers for this mdsp. Got some useful sounds out of it. Works really well on guitar harmonics.

 
At Thursday, 01 December, 2005, Peter said...

Am I missing something? It doesn't seem to be working. It just bleeps up on the screen for a moment and then disappears.

 
At Thursday, 01 December, 2005, mdsp said...

ok let's explain it a bit.

we have file test.wav in directory c:\soundfiles\ and we want ot to generate 5 layers.

launch a commandline shell
then type the following commands:
cd c:\soundfiles\
nmfdemix test.wav 5

it displays numbers on the screen until it converge to a solution.

now you have files test-0.wav,...,test-4.wav and test-residual.wav in directory c:\soundfiles\

is that clearer?

 
At Thursday, 01 December, 2005, mdsp said...

another tip fo winXP:

launch notepad
paste these lines:

@echo off
set /p args=nmfdemix %1
nmfdemix %1 %args%
set _name=

save it as nmfdemixWithArgs.bat where you want, for me its in C:\Program Files\nmfdemix

then when you right-click on a sound file choose Open-with -> choose program
browse to where you just saved the file (for me C:\Program Files\nmfdemix\nmfdemixWithArgs.bat)

now you are able to launch nmfdemix on any soundfiles from the right-click contextual menu. It will ask for additionnal arguments, only the number of layers is mandatory.

best

 
At Saturday, 03 December, 2005, Anonymous said...

hi

just downloaded and started playing with nmfdemix...it's a great tool, like you say quite CPU intensive but the results so far have been very good. thanks! paul

 
At Monday, 05 December, 2005, egnouf said...

Hello,

i am creating a Java interface for this tool. I would just need more info on the different potion especially the Matrix option :
// -m, --matrixout
// output W and H matrices

Can you help ?

Cheers.

Ps: I can give you an email adress if you want ....

 
At Monday, 05 December, 2005, mdsp said...

hi,

you can contact me directly by email http://www.smartelectronix.com/contact.php?selected=email
if you want more precisions or if you need some modifications.

for the -m flag:

if you have an imput file test.wav you'll get 2 text files test.wav-W.txt and test.wav-H.txt containing the matrices W and H in the following format:

rows cols
a00 ... a0cols
... ... ...
arows0 ... arowscols

but this is still subject to change.

 
At Thursday, 08 December, 2005, Peter said...

DUDE! I got it to work. Thanks so much for your help. This is so friggin' cool.

 
At Wednesday, 14 December, 2005, Anonymous said...

help!
I installed the thing and now i would like to know where on earth (or better where on my computer) are the files?

thanks!

 
At Wednesday, 14 December, 2005, mdsp said...

if you run windows, it's installed in $(WINDOWSDIR)\system32\

and if you run MacOSX it's installed in /usr/local/bin/

either way you just have to type the name to use the tool,

IT'S NOT A PLUGIN, it's a COMMANDLINE TOOL.

 
At Thursday, 22 December, 2005, Anonymous said...

Nice (nothing new though - NMF methods have been around in bioinformatics and other areas for quite some time). How about incorporating uncertainty estimates into the update rules to make it more stable over the possible noise in the data sets? Which NMF library did you use anyway?

Btw. the Mac version doesn't seem to install anything under 10.4.3 except the package receipt. At least I can't seem to find the application anywhere (command line or not).

Keep it up!
--nn

 
At Thursday, 22 December, 2005, Anonymous said...

Forget the complaint - I found it.

--nn

 
At Friday, 23 December, 2005, mdsp said...

I know and NMF is not the best method for Blind Source Separation.

It's just that I implemented an NMF decomposition class for work and that It was 1 hour work to have the demixing program from it.

BTW if you know some good and efficient C/C++ libraries for NMF, I'm interrested, all the one I know are matlab toolboxes.

We did it using TNT (Template Numerical Toolkit) for matrix representation.

in this version, I'm using multiplicative updates with euclidian norm between the 2 matrices. but we also have diversgence and sparse decomposition.

 
At Friday, 23 December, 2005, Anonymous said...

I've been using my own libraries when I was working with NMF for source separation but that's been quite a while now. I remember that Shiro Ikeda did some work on a C/C++ library but I don't remember if it ever was finished. I could look through my old projects though if you're interested. Maybe we should do this via email - you can contact me through the form at http://www.dspdimension.com if you like (I don't like posting an email address here).

Btw. I agree with your comment on BSS and NMF, but NMF methods are quite good for computer vision (I've seen impressive results from tools using it).

Cheers,
--nn (=Neuronaut)

 
At Friday, 23 December, 2005, Anonymous said...

Give a freshman an errand.
i'm jealous of these comments
ok , it's a commandline prog? where do i type? there is no aplication (is that obvious?) so i go where, to use it; "console"?
mac osx 10.4.3
within 1 minute of a reply, i'll be flying!

 
At Friday, 23 December, 2005, Anonymous said...

After installing the app launch the console window on OS X then type "/usr/local/bin/nmfdemix " without the quotes and with the trailing blank. Then drag any sound file to the console window - its path will be appended to the line. Then type in another blank and the number of "layers". By now your command line should look something like this:

/usr/local/bin/nmfdemix /Volumes/Kram/change.aif 8

Hit return and off you go. Make sure you use a high enough number for complex material. The results will be in the same directory as the original sound file. Don't expect too much, the results will vary greatly depending on the source material.

Regards
--nn

 
At Wednesday, 28 December, 2005, Joakim Lindén said...

Ah, now I get it... This can actually be very very useful when trying to get moods out of certain tracks.

I've tried a few samples now and so far I've had bad results with beats/percussions, but soft loops and melodies are being separated into it's individual notes. Nice if you want to hint at some references/influences in your tracks. Say, a Miles Davis solo, but you don't want to use an actual full mix loop...

I'll enjoy this tool, thanks!

 
At Saturday, 31 December, 2005, Minim said...

Very interesting tool. I've had no problems or hiccups so far. I've even gotten some really long samples to process. Takes awhile, but worth the wait.

Thanks

 
At Sunday, 01 January, 2006, Anonymous said...

hey mdsp - this is some really cool software! i can easily imagine using it more and more often.
one question though... when i assemble all parts together, they form a fade-in and fade-out at the endpoints of the decomposed sample - is that normal?
imagine this..

1. buffer up a short loop real-time and decompose it to, say, 8 parts. then set levels of each with sliders. it could work quickly for short loops, quickly enough for live use.

2. (something i could definitely use!)
gui for this app. something like the screenshot on your page - simply the decomposed tracks laid one on top of the other.
you start with the track you want to decompose. then you tell the app what settings to decompose it with. if you're unhappy with the result you can rollback. if you think you might want to decompose a track further, you just right-click it again. i noticed that the tracks often decompose into pieces which are logically one part, but the algorithm thinks they're separate parts. so the app could have a (destructive) mix - just drag one piece that is part of another and they are added.

now, why i would love a tool like 2? because i love to use ableton live... it's not a tool for serious music :P but it's fun and it's nice for mixing around! and it has many great possibilities you can usually only take advantage of when making your own tracks: you can individually manipulate percussion, synths, blah blah blah.

if you could do this with other people's tracks, it could be the next best thing to come after milk - you could do "live act"-style stuff with cool tracks you like....! i'd definitely dig it!!!

to finish this off, i'm just gonna say please^100 ;)

 
At Monday, 02 January, 2006, mdsp said...

hi,

nice ideas, but it does represent a large amount of work :)

for the fades, it's not a bug, as the frames are windowed, there's a fade on the first and last one.

To be more correct I should process some extra frames before and after the signal and then cut the resulting audio to the right size, dropping the fades.

 
At Monday, 02 January, 2006, mdsp said...

for the screenshot,
it's audacity.
very useful for importing several files at once and stacking them.

I think you can achive most of what you want to do manually with it.

 
At Thursday, 12 January, 2006, Dano said...

mdsp

very very cool routine, thanks

one question: sometimes I get a message saying "abort trap", and it seems like the software gives up at that point. What causes this error? Is there a way I can avoid it?

cheers,
Dano

 
At Sunday, 05 February, 2006, musikexperience news said...

fucking genious !!!!!BRAVO!!

 
At Tuesday, 21 February, 2006, Anonymous said...

Alritey!

I downloaded the application (Win XP version) and I figured out the file location (in Windows System 32). I tried copying those tags into notepad (those 4 lines from previous blogs, Dec 1st, 2005) and running it, but it doesn't seem to work.

Can you please give me a step by step procedure on running this?

Thanks!

 
At Tuesday, 21 February, 2006, Anonymous said...

Hey!!

I just got it to work!! Awesome stuff!

Once your command line window opens, it displays nmfdemix followed by your sound file name. Alll you need to do is, type the number of layers at the blinking cursor and your components are generated!!

NEAT!

 
At Tuesday, 07 March, 2006, Anonymous said...

will this work on a mac? How do I get it to work? I cannot find it anywhere after it was installed! Thanks

 
At Tuesday, 28 March, 2006, Anonymous said...

congrats ,the first app to take my phase change cooled machine above 0 degrees!.

 
At Tuesday, 16 May, 2006, madcap said...

I do not understand the usage of the -c criteria stopping criteria command. Can you explain the usage of the parameters?

I got a nice seperation just going nmfdemix 4 layers. But I don't really understand the usage syntax of the other variables.

 
At Wednesday, 17 May, 2006, mdsp said...

the -c stopping criteria is the minimum amount between to successive updates which is necessary to continue improving the results. if the difference is not significant the algorithm will stop.

in some cases you can see that the algorithm has almost converged but it doesn't stop. in that case you can raise the stopping criteria to make it finish faster.

in other cases it stops too fast and doesn't converge to an interresting solution, raising it can improve the results.

most command line options are for advanced users who know what they want to do and know what happening behind the scene.

 

Post a Comment

<< Home