if I do:
import numpy as np
arr1=np.tile(0.75, 32)
I get a 32 element array of float64 initialized with the value 0.75.
How to do the same but get a float32 array?
if I do:
import numpy as np
arr1=np.tile(0.75, 32)
I get a 32 element array of float64 initialized with the value 0.75.
How to do the same but get a float32 array?
All suggestion work but my program clearly was not related to this but to the soundfile library. Anyway:
Solutions are:
np.tile(0.75, 32).astype(np.float32)
or
np.full(32, 0.75, dtype=np.float32) # **FASTEST**
or
np.ones(32)*0.75