How can I make noise stimuli louder?

I’m trying to create a masking stimulus right now. However, I can create stimuli like the first image, but I don’t know how to create stimuli like the second image. Could you please tell me how?

Here is the code I used.

noise = round(rand(500));
noiseTex = Screen('MakeTexture', w, noise);
Screen('DrawTexture', w, noiseTex, [], []);


To change the “size” of each pixel in the noise the easiest way is to use ScaleRect to just make the drawn texture bigger.

scale = 10
x = [0,1;1,0]; % 1px checkerboard
tx = Screen('MakeTexture', win, x);
rect = Screen('Rect',tx);
rect = ScaleRect(rect, scale, scale);
Screen('DrawTexture', win, tx, [], rect);

To create a circular mask there are several options, but the one I use is with a procedural smoothed disc. see ProceduralSmoothedDiscMaskDemo.m which creates a circular window within which smaller stimuli are seen.

maskMethod = 2; %this is an inverse window so center is transparent
[masktex, maskrect] = CreateProceduralSmoothedDisc(win,...
    width, height, [], maskRadius, maskSigma, useAlpha, maskMethod);

You draw the mask after the noise. You will need to use something like CenterRectOnPointd to make sure both the noise and mask are drawn at the same position on screen.

For bonus points, there is a procedural noise texture, see: CreateProceduralNoise.m and ProceduralNoiseDemo.m