This isn’t tested, but in principle this should do the job
SYSTEM_THREAD(ENABLED);
#include "speaker.h"
const uint16_t wave_data[] = {
....
};
uint16_t audioFrequency = 22050; // Hz
Speaker speaker(sizeof(wave_data));
void setup() {
memcpy(speaker.getBuffer(), wave_data, sizeof(wave_data));
speaker.begin(audioFrequency);
}