问题
I don't know if it is legal on SOF to access such a specific question, but here I go:
I've found this wonderful piece of code which takes all the samples from a WAV file and passes it into an array.
The code compiles, but I can't seem to figure out where to pass the argument of where the file is and what its name is.
Any help?
PS If this code does what it says it does, I think it could be useful to a lot of people.
Thanks!
回答1:
If you look at the code it's reading from stdin
(and it even says in the description above the code: "It reads from stdin"). Evidently it's designed to be used as a command line tool (or "filter") which can be piped with other tools, or standalone using I/O redirection.
回答2:
You should be able to pipe output from wget or curl.
wget -O - http://www.whatever.com/somefile.wav | yourpieceofcode
来源:https://stackoverflow.com/questions/4946916/passing-a-url-to-a-specific-piece-of-example-code-which-extracts-samples-from-a