Open sgoshaye opened 3 years ago
@sgoshaye try to reshape an arr : size = 44100 arr = np.repeat(arr.reshape(size, 1), 2, axis = 1)
You can try the following code:
import numpy as np
import pygame, pygame.sndarray
pygame.mixer.init(frequency=44100, size=-16, channels=1)
arr = np.random.randint(-10000, 10000, size=44100, dtype='int16') #set `dtype` to `int16`
sound = pygame.sndarray.make_sound(arr)
sound.play()
When I run this cell:
I get this error:
I am using Python 3.7.9 on Ubuntu 20.04 LTS.