40 Hz Square wave with 8kHz tone

@wdunne welcome to the forum.
All these messages where we ask what you want is normal. It is not easy to describe exactly what you want, and we would like to know that because there are so many ways to make that signal.

Do you want the 8kHz in sync with the blinking light ? I assume you do.
How accurate do you want the 40 Hz ?
Can you add additional hardware ? A logic AND gate could create perfectly timed signals.
Which Arduino board do you want to use ? The most basic Arduino board is a Arduino Uno, and that one is perfect for these timing things.

For a not-so-accurate solution, I see the Arduino tone() function and a millis-timer for 40Hz.
For a reasonable accuracy, I see two hardware timers. One at 40Hz with a interrupt that turns on and off the light and the 8kHz timer. Since 40Hz is 200 times slower than 8kHz, perhaps it can be done with a single timer.
For a top-accurate solution, I see two hardware timers and a extra hardware AND logic chip.

That's not all ! Do you want a full pulse of the 8kHz or is it okay if that pulse it cut off in the middle.