From: "meta ." <0x0meta@gmail.com> To: sox-users@lists.sourceforge.net Subject: Forcing SoX to process remaining input/flush buffered output without EOF Date: Fri, 14 Jun 2019 22:44:20 +1200 Message-ID: <CAGy6UqpFgGt-4o5UGChX2LtRgWE6SYCNYrunc7mgL_gnenzh2A@mail.gmail.com> (raw) [-- Attachment #1.1: Type: text/plain, Size: 1043 bytes --] I want to use a sox instance that reads from stdin and writes to stdout to process a continuous and potentially endless stream of audio blocks. The only problem is that it seems sox doesn't write to stdout until its buffer is filled. As a result, output blocks smaller than the buffer length are not accessible. Is there a way to alter this behavior using command line flags? I'm aware that sending an eof would result in the remaining output being flushed, but that's not the behavior I'm looking for. I'd like to keep the sox instance alive to process blocks as needed. Here's some example python code demonstrating whats happening. Note the output displaying the missing bytes in the comments at the end. https://pastebin.com/Ejt6EW21 To run, this snippet requires the soundfile and pexpect packages to be installed, which can be done by using the commands 'pip install soundfile' and 'pip install pexpect' in a terminal. You'll also need to replace the path in 'file = sf.SoundFile(...)' on line 30 with one of your own, ideally a wav. [-- Attachment #1.2: Type: text/html, Size: 1209 bytes --] <div dir="ltr">I want to use a sox instance that reads from stdin and writes to stdout to process a continuous and potentially endless stream of audio blocks. The only problem is that it seems sox doesn't write to stdout until its buffer is filled. As a result, output blocks smaller than the buffer length are not accessible. Is there a way to alter this behavior using command line flags?<br><br>I'm aware that sending an eof would result in the remaining output being flushed, but that's not the behavior I'm looking for. I'd like to keep the sox instance alive to process blocks as needed.<br><div><br></div><div>Here's some example python code demonstrating whats happening. Note the output displaying the missing bytes in the comments at the end.<br><a href="https://pastebin.com/Ejt6EW21">https://pastebin.com/Ejt6EW21</a> <br><br>To run, this snippet requires the soundfile and pexpect packages to be installed, which can be done by using the commands 'pip install soundfile' and 'pip install pexpect' in a terminal.<br>You'll also need to replace the path in 'file = sf.SoundFile(...)' on line 30 with one of your own, ideally a wav.</div></div> [-- Attachment #2: Type: text/plain, Size: 0 bytes --] [-- Attachment #3: Type: text/plain, Size: 158 bytes --] _______________________________________________ Sox-users mailing list Sox-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users
reply index Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publically to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-list from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://lists.sourceforge.net/lists/listinfo/sox-users * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAGy6UqpFgGt-4o5UGChX2LtRgWE6SYCNYrunc7mgL_gnenzh2A@mail.gmail.com \ --to=sox-users@lists.sourceforge.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
sox-users@lists.sourceforge.net unofficial mirror Archives are clonable: git clone --mirror https://public-inbox.org/sox-users Example config snippet for mirrors Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.audio.sox nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox nntp://news.gmane.org/gmane.comp.audio.sox note: .onion URLs require Tor: https://www.torproject.org/ AGPL code for this site: git clone https://public-inbox.org/public-inbox.git