I am working on a source separation problem and I have a logical mask that when applied to the STFT matrix, gives me expected results. The problem here, is that the mask is based on a spectral feature, so it is a vector mask either 1xN or Nx1, filled with either 0 or 1. I need to create a 2 dimensional logical mask in both directions of the spectral feature.

For example, if my STFT size is 1025 x 920, and I have two masks in each direction, it will give me one mask of 1 x 920 and one mask of 1025 x 1. If I apply them separately, it separates the STFT content based on 1 or 0, that is all fine. Now the problem is when I try to create a 2 dimensional mask with these separate vector masks. Because I can do (1025 x 1) x (1 x 920) and will give me a 2d mask of the correct size to fit the STFT (1025 x 920), but the problem is the shared properties, they will be lost in that operation.

When a 1 multiplies another 1, the result is 1 in the 2d mask, that is fine. When a 0 multiplies a 0, it will give me a 0 in the 2d mask, that is fine. The problem now is when either you multiply a 1 by 0 or a 0 by 1, it will give me 0, but that wouldn't make too much sense for a 2d mask, since in the end, it will have way too many zeros compared to ones, instead of perhaps giving me half (shared properties between the two vector masks), so 0.5.

Is there any way to create a 2d logical mask so that every time the operations 1 x 0 or 0 x 1 happen, the result is 0.5 and not 0? because I want to share the spectral feature properties, otherwise the whole idea doesn't make sense.

I was thinking about a way to maybe fix this, instead of 0 in each directions, put a slightly higher value, like maybe 0.50 instead of a 0, so that when 0.5 multiplies by 1 or vice versa, it gives me 0.5 and only when a 0.5 multiplies by itself, it will give me 0.25, this is when I will know that 0.25 is the actual meant 0 for the 2d mask and I get 3 possible values for the final mask, 0, 0.5 or 1. Would this make sense or is there another way of doing this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.