Scale parameters in a generalized normal distribution

Lets say that I have variable $$X$$ which follows a generalized normal distribution with parameters $$(\beta, \mu, \sigma)$$ and I wish to change it so that it has parameters $$(\beta, \tilde{\mu}, \tilde{\sigma})$$

I thought that I could define

$$Y = \tilde{\sigma}\frac{X- \mu}{\sigma} + \tilde{\mu}$$

then

$$\mathbb{E}[Y] = \mathbb{E} \left[ \tilde{\sigma}\frac{X- \mu}{\sigma} + \tilde{\mu} \right] = \frac{\tilde{\sigma}}{\sigma} \mathbb{E}[X-\mu] + \tilde{\mu} = \tilde{\mu} \\ \mathbb{V}[Y] = \mathbb{V}\left[ \tilde{\sigma}\frac{X- \mu}{\sigma} + \tilde{\mu} \right] = \frac{\tilde{\sigma}^2}{\sigma ^2} \mathbb{V}[X- \mu] = \tilde{\sigma}^2$$ But after I implemented in python and tried, this doesnt seem to be correct. I get the desired beta, and mean $$\beta, \tilde{\mu}$$. But the standard deviation $$\tilde{\sigma}$$ is way off.

What is the correct approach?

In the generalized normal distribution, we have a pdf of the form:

$$p_X(x) \sim \exp\left(-\left(\frac{|x-\mu|}{\alpha}\right)^\beta\right)$$

If $$\beta=2$$ then this is exactly the normal distribution and $$\alpha^2$$ corresponds to $$2\sigma^2$$. The transform you give is also correct in general, except that $$\sigma$$ should be changed to $$\alpha$$:

$$Y = \tilde \alpha \left( \frac{X-\mu}{\alpha} \right) + \tilde \mu$$.

I suspect you are confused about the difference between $$\alpha$$ and the standard deviation $$\sigma$$. They are closely related, but the ratio between them changes with $$\beta$$.

In general the variance will be (see https://en.wikipedia.org/wiki/Generalized_normal_distribution)

$$\sigma^2 = \frac{\alpha^2 \Gamma(3/\beta)}{\Gamma(1/\beta)}$$