A software engineer looks from a larger distance at the problem. You have buttons and frequencies with code that glues it together.
Let's put the data in arrays:
const int buttonPins[] = { 2, 3, 4, 5, 6, 7 };
const int freqList[] = {264, 297, 352, 396, 440, 495 }; // 330 and 528 are missing ?
Then you can use the array. The array starts at index 0.
for (i = 0; i < 6; i++) {
if (digitalRead( buttonPins[i] ) == HIGH) {
switch (i) {
case 0: do {
tone(speaker, freqList[i] );
...
Then you can get rid of the switch-case statement.
The moment that a button is pressed, a tone is started.
The moment that a button is released, the tone is stopped.
That is the State Change Detection: https://www.arduino.cc/en/Tutorial/StateChangeDetection
To add the State Change Detection to your sketch, you have to reorganize your sketch.
For some fun: the toneAC library.
It uses fixed pins 9 and 10 for the speaker.
It is louder and it has a basic volume control. That makes it possible to create others sounds, even a fading out sound. A piano sound instead of a boring beep !
If you think that is fun, there is also a Mozzi library. That is for advanced Arduino users, and you need an amplifier. The sounds on that website are the sounds that a Arduino Uno can make.
Do you have a resistor with the speaker ?
You have now a working sketch. I suggest to keep that sketch. When you want to change things, you can create a new sketch, for example with version2 in its name.