How does setting the upper bound to 1024 change things, as pot1=max 1023??

Look at the map function:

```
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
```

in_min and out_min are both 0 in your initial map call, so map looks like:
return (x) * (out_max) / (in_max);
With out_max equal 3 and in_max = 1023, the map function looks like:
return x * 3 / 1023;
The only value for x that results in returning 3 is 1023. If you change in_max and out_max to 4 and 1024, the function looks like
return x * 4 / 1024;
Now, any value of x over 767 will return 3. The maximum input value, 1023, will return 3.

So, if you want values from 0 to 3 to be returned, you need to call map:
waveSelect = map(pot1, 0, 1024, 0, 4);

If you want values from 1 to 4:
waveSelect = map(pot1, 0, 1024, 1, 5);

(Yes, I had the wrong to range).