是否可以从Node JS中的Windows CLI实用程序中获取数据流?
我想创建一个节点应用程序,该应用程序从Windows 10中的系统输出设备记录和解析音频。这似乎是一个真正的挑战,因为我已经检查了许多NPM软件包,但没有找到任何允许从输出设备。 因此,我找到了适用于Windows 10的第三方CLI实用程序 我不确定我应该给它起名称,因为它可能会受到营销等的威胁。
因此,此CLI实用程序允许为输出设备记录回合音调并将其保存到WAV文件中。
我想知道是否存在某种方法可以拦截从我的node.js应用程序来处理该实用程序到WAV文件的数据流来处理它?或者,如果CLI实用程序不提供一些API来获取此数据,则不可能?
我还在考虑在录制过程中立即打开WAV文件并读取此文件,以获取Node.js应用程序中的最新数据并处理它,但我不确定由于写入/读取流是否可能相同的文件(来自CLI-写入,来自Node-读),
感谢您提供的任何帮助!
PS抱歉,如果我的问题很愚蠢。我不熟悉如此低级的事情
I'd like to create a node app that records and parses audio from the system output device in my Windows 10. It looks like it's a real challenge because I've checked many npm packages but didn't find anything that allows audio recording from the output device.
So I found a third-party CLI utility that works for Windows 10
I'm not sure that I should give its name because it could be threatened like marketing etc.
so this CLI utility allows to record a loopback audion for the output device and save it to the WAV file.
I'm wondering if there exists some way to intercept the data stream that comes from this utility to the WAV file from my NODE.js app to handle it? or if the CLI utility doesn't provide some API to get this data it isn't possible?
I also was thinking about the immediate opening of the WAV file and reading this file during the recording to get the recent data in the node.js app and handle it but I'm not sure that it's possible due to the write/read stream for the same file (from CLI - write, and from NODE - read)
Thanks for any help or info!
P.S. Sorry if my question is stupid. I'm not familiar with such low-level things
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一夜的研究,我设法在特定情况下获取了数据。
我从节点子进程软件包中使用了 spawn 来创建一个专用过程,在该过程中,我使用适当的参数执行了CLI实用程序,该参数将记录数据直接发送到Stdout中。
请记住, exec 由于缓冲区问题
这里最重要的事情:幸运的是,CLI实用程序有可能将录制数据块发送到stdout而不是文件。但是,我不知道如果不能做什么。我不知道是否有一种直接写入输出文件的数据的现有方法,因此此答案不适合100%的问题。如果CLI不将数据写入Stdout,该怎么办?如果有人知道这一点:请让我知道,我会非常感谢
这是基本的代码示例:
善意的问候
After a night of research, I managed to get the data in my particular situation.
I used a spawn from the node child process package to create a dedicated process where I executed the CLI utility with the appropriate arguments that send the recording data directly into the STDOUT.
Please, keep in mind that exec won't work in this particular task due to the buffer issue
The most important thing here: Luckily the CLI utility has the possibility to send the recording data chunks to the STDOUT instead of the file. However, I don't know what would I do if it couldn't. I don't know if there is an existing way to intercept the data that writes directly into the output file so this answer isn't 100% fits the question. What to do if a CLI doesn't write the data into the STDOUT? If someone knows about it: please, let me know, I'll appreciate it a lot
Here is the basic code example:
Kind regards