Audio volume does not change

I tested your script now on Linux, Windows-10 and macOS 10.15.7.
Your script works just fine on Linux and Windows.

It’s yet another macOS screwup. I get the same, essentially almost no perceptible change in loudness. I think macOS is normalizing whatever signal amplitude it gets from our driver to some standard amplitude, rescaling the signal accordingly, thereby undoing the volume change. You can hear it if you set Volume to zero, where it indeed turns silent.

Or if you use BasicAMAndMixScheduleDemo(), at the end you hear a mix of AM modulates beep tones and some white-noise. If you use the cursor keys to crank up the amplitude of the beep tone, you won’t hear a louder beep tone, but instead attenuation of the white-noise whenever the beep tone happens, because the signal as a whole is scaled down by the operating system to keep peak amplitude (== amplitude of the beep tone) constant.

So i guess auditory stimulation is another area where modern macOS fails us by default. Maybe the signal processing is good for something else, like regular music playback, or maybe using something else (external speakes? Headphones? External soundcard?) but the internal MacBookPro speakers would avoid the auto-rescaling.

Not sure with which OS version or edition of Macs this behaviour was introduced or changed for the worse, but not a bug in PTB or your script.

Edit: Related thread of other people noticing this effect:

Also, if you change the sound vector to white noise, you’ll hear quite different behaviour, hinting that the dynamic amplification/dampening by the OS may be frequency specific.

Best,
-mario

[Time spent so far: 73 Minutes, priority support used up]