I'm trying to play back an audio stream with the sounddevice module, ive tried many ways but they all don't make much sense and don't seem to work for me at all, the data 100% is valid and if saved to a file it plays back perfectly so i know the data isnt corrupted in any way.
import requests
import numpy as np
import sounddevice as sd
url = 'https://audio10.broadcastify.com/dbhq0jtm96yrs78.mp3?nocache=7847116&xan=xtf9912b'
#creates a varable for the url
chunk_size = 256 *4
#chunk size
r = requests.get(url, stream = True)
#uses requests.get to get data from link
for chunk in r.iter_content(chunk_size=chunk_size):
#grabs the audio content of the web page with the r varable and putting it into the chunk varable as byte data
chunk = np.frombuffer(chunk, dtype=np.int8)
#turns the chunk byte data into an array
print(chunk)
#prints the chunk data to show the result
#somehow use the soundevice module to play back the audio stream? but i dont know how?
#the only clue that i have is that i cant use sd.play(chunk) because the play function isnt
#able to play stream data like that