Sampled sound function

My code sucks but it works.

I'll agree with the first part, and take your word for the second part.
In this code

while(arrayc < len){
long arrayc=0;
unsigned char s = pgm_read_byte_near(array + arrayc);
for(unsigned char bs = 1;bs < 128;bs *= 2){
  digitalWrite(soundpin, s & bs);
  delayMicroseconds(250);
}
arrayc++;
}

arrayc is both a global variable and a local variable. It is also not an array.

There are no comments to explain what is going on, and the (lack of) indenting makes it very hard to follow.

There is nothing in your post defining how to get the data into PROGMEM.

But, the concept is neat. Thank you for taking time to post this.