This image allow you to generate audio from a numpy array: it exposes a POST API so just pass it an array as input and it will return the audio represented by it!
Container exposed port: 2865.
Endpoint url: "/send_array"
You only need to have Pulseaudio running on your pc. PulseAudio is a sound server system for Unix-like operating systems but you can use it also on Windows.
Pulseaudio for Windows instructions:
Congratulations! Now you should have pulseaudio running on your pc and you are ready to use this image.
Open the command prompt and launch the container:
docker run -p 2865:2865 alessio21/play-numpy-array
Send your array to http://localhost:2865/send_array :
import numpy as np
import requests
API_URL = "http://localhost:2865/send_array"
#create the audio array
fs = 16000 # Hz
T = 1. # second, arbitrary length of tone
t = np.arange(0, T, 1/fs)
x = 0.5 * np.sin(2*np.pi*1000*t)
x = (x*32768).astype(np.float32)
#send the array to the container
payload = {"audio_array":x.tolist()}
resp = requests.post(API_URL, json=payload)
response = resp.json()
print(response)
In this repository the image is used to generate audio for a voice chatbot (see the docker-compose.yml file).
Content type
Image
Digest
sha256:55b1eca3f…
Size
71.6 MB
Last updated
over 2 years ago
docker pull alessio21/play-numpy-array