audioread icon indicating copy to clipboard operation
audioread copied to clipboard

Do not use hardcoded scheme in GstAudioFile

Open sjappig opened this issue 9 years ago • 1 comments

GStreamer supports e.g. http-audiostreams, but the current implementation in gstdec.py prefixes everything with file://; if that prefix would be added only when there isn't any scheme already provided, GstAudioFile could be used for example with Internet radio streams (which was my original goal when I came across this library, since this nicely abstracts the gory details of GStreamer):

radio_stream = 'http://mp3channels.webradio.antenne.de/chillout'
with audioread.gstdec.GstAudioFile(radio_stream) as f:
  process_stream(f)

Obviously, it would be even nicer if the user of this library wouldn't even need to know what backend is used in the above case, and could just pass the URL in audioread.audio_open (unless this library is wanted to kept file-only for some reason).

sjappig avatar Sep 18 '16 10:09 sjappig

This does seem useful! Although I'd prefer a separate constructor argument to doing URL detection with one parameter. For example, GstAudioFile(url=...) or GstAudioFile.from_url(...).

In general, reading files from the network is out of scope for this library. An interesting extension, however, would be able to read data from a stream for all backends! Then you could hook this library up to your favorite URL-loading library, such as requests.

sampsyo avatar Sep 20 '16 21:09 sampsyo