ArtskydJ / node-sox-stream

:mega: A stream-friendly wrapper around SoX
53 stars 14 forks source link

Why write to temp file? #16

Closed tasinet closed 5 years ago

tasinet commented 5 years ago

Why the piping though the temporary file? It seems to be a wasteful write to disk.

ArtskydJ commented 5 years ago

Good question. I wish it worked consistently without the temp file. However, sox has issues reading from a piped stream sometimes. I think certain formats just didn't work without a temp file.

If I recall correctly, FLAC or MP3 had issues when being piped in w/o a temp file.

tasinet commented 5 years ago

Thanks! I realised this yesterday: I added buffers on another implementation that works with in-memory streams and hit the same problem (FLAC corruption). WAV works thankfully, so I can still use it. Any idea what the underlying cause may be?

ArtskydJ commented 5 years ago

I don't think there's a good way for sox to handle streams in all cases.

For efficiency/performance reasons, sox can't buffer the entire file.

These are just guesses.