# \[Announce\] node-red-contrib-sox-utils : first beta (testers wanted)

**URL:** https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563
**Category:** Share Your Nodes
**Created:** [31 May 2020 10:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563 "2020-05-31T10:12:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [31 May 2020 10:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/1 "2020-05-31T10:12:28Z")

</div>

Hello,  
I just finished the first usable beta version of my very first node.  
The node is a wrapper around the record functionality of the [sox commandline tool](http://sox.sourceforge.net/) on linux and you can find it here:

> **[johanneskropf/node-red-contrib-sox-utils](https://github.com/johanneskropf/node-red-contrib-sox-utils)**
>
> a simple node-red wrapper around the record functionality of the sox commandline utility - johanneskropf/node-red-contrib-sox-utils

  
I’m happy for any testers who could give it a spin and tell me about any errors they find or usage feedback.  
This node will record audio from the specified audio source on the machine node-red runs on.  
It has several features which distinguish it from the microphone/record nodes already present.  
It has options for record duration and a fine tune able silence detection which can be both used together or separate. It can be configured to either return a stream of raw audio buffers or a single buffer when recording is done. It separates the audio data and info/debug to two different outputs and the debug amount can be specified.  
You can easily combine it with nodes like [https://github.com/bartbutenaers/node-red-contrib-wav](https://github.com/bartbutenaers/node-red-contrib-wav) or use it in speech projects involving watson, voice2json or similar to record voice commands.  
There is some detailed usage instructions in the readme which you can find in the repository.  
Here are some pictures:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/77dbb1346c46b09b4ba65b8256a1808537ee06c8.jpeg) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f9af13d58d680fd082e5d550680eefaaf096619.jpeg) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cbc28880965f4508f91703334725b6fcdc09fbca.jpeg)

Thanks for your time and i look forward to your feedback,

Johannes

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [3 June 2020 15:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/2 "2020-06-03T15:58:02Z")

</div>

Version Bump to 0.1.2  
Added gain, highpass and lowpass parameters.  
Streamlined record argument building.  
Reshuffled some Ui parameters.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [3 June 2020 21:43 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/3 "2020-06-03T21:43:10Z")

</div>

> [@JGKK](#):
>
> Added gain, highpass and lowpass parameters.

Hey Jonathan,  
Unfortunately I cannot test this node, since I don't have a microphone for my raspberry ...  
But is there any reason why you have added all this functionality into a single node? Because I can image it would be nice to have a _ **separate** _ highpass-node and a lowpass-node (in a separate repository). Then it would be possible to _ **reuse** _ that functionality e.g. when I want to process audio arriving from my node-red-contrib-ui-microphone node.

Or is this perhaps functionality that is completely stuffed into the sox library?

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [4 June 2020 04:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/4 "2020-06-04T04:52:59Z")

</div>

Its all typically things you do within a single sox command. As sox can do amazing things the commands tend to get quite long which is why i made this node in the first place. It just offers that little bit more in tunability compared to any of the other microphone nodes. As this is something you do to a live audio stream it also makes sense to have as much as possible in one workstep as by splitting it into several nodes you would introduce extra latency in each step which is not what you want especially if you use it for something like speech commands.  
I tried to get around some of the menu bulkiness by hidding some of the more detailed options till you actually use them but i agree it is quite a long menu. Hopefully its structure is logical enough that it still is usable.

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [4 June 2020 07:31 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/5 "2020-06-04T07:31:32Z")

</div>

Ok i might change it to this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/8/d855c345469be3de0fa59815fdcc7bfac4bd5625.jpeg)  
where some of the more advanced settings that are optional are hidden by default and make the config more manageable but you can expand it all the way up to a monster like this if you want to have full control:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/254df16fe661236ab330a9796408a3f89636ef92.jpeg)

Edit:  
This is now in the repo as 0.1.3

---

<div class="post-metadata">

### Author: ![WhiteLion](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/whitelion/32/12266_2.png) [@WhiteLion](https://discourse.nodered.org/u/WhiteLion)
#### Post date: [10 June 2020 22:57 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/6 "2020-06-10T22:57:52Z")

</div>

Thank you for your great work!  
I ve no microphone connected to my raspi. I guess its not possible to use the mircophone from the laptop/mobile phone I use to view the dashboard with?

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [11 June 2020 04:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/7 "2020-06-11T04:58:21Z")

</div>

Not with my node but you can use Nicks great [node-red-node-ui-microphone](https://discourse.nodered.org/t/announce-node-red-node-ui-microphone/23923) for that. You just need to set up https first as it wont work otherwise,

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [11 June 2020 21:45 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/8 "2020-06-11T21:45:00Z")

</div>

Version 0.1.4.

- A play node has been added that can play audio from a file path send to it for now. Buffer support will be added soon. The new play node also includes a dropdown that shows all available playback devices. I will add this feature to the record node too to make input selection easier.

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [12 June 2020 10:37 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/9 "2020-06-12T10:37:04Z")

</div>

Version 0.1.5

- Play node now also accepts data as a single buffer in addition to file paths
- Play node now has a output gain option
- You can now choose how the play node behaves if a new input arrives while a playback is already in progress
- Moved Nodes to their own category

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [12 June 2020 15:01 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/10 "2020-06-12T15:01:03Z")

</div>

Version 0.1.6

- Record Node now also includes a dropdown showing all available devices
- Added option to output a single wav buffer to the record node
- updated documentation

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [13 June 2020 14:02 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/11 "2020-06-13T14:02:34Z")

</div>

Version 0.1.7

- added queue mode to the play node
- added better help text to the nodes
- updated the readme to reflect all current options

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [22 June 2020 08:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/12 "2020-06-22T08:58:07Z")

</div>

Version 0.2.0

- added sox-convert node:
  - can convert from all available sox formats to wav, flac, mp3 and ogg (i will add more target formats in the future, if you have a request for one tell me 🙂 )
  - it accepts both buffers and file paths

- fixed a whole lot in the play node when it comes to playing buffer input
- **breaking change:** If you want to play a buffer you now have to attach a `msg.format` to the msg.object that contains the buffer that contains the file extension of the buffer (eg. wav, mp3, flac, ogg...)
  - the record and convert node now automatically include this `msg.format` property in their output so that the nodes can still be connected straight to each other.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 June 2020 09:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/13 "2020-06-22T09:03:57Z")

</div>

If the buffer arrives without a `.format` could you guess by using "magic numbers" ? [https://en.wikipedia.org/wiki/List\_of\_file\_signatures](https://en.wikipedia.org/wiki/List_of_file_signatures)  
and then fail if not recognised ?

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [22 June 2020 10:11 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/14 "2020-06-22T10:11:49Z")

</div>

Just tested this and it looks like i should be able to simply use `buffer.includes(Buffer.from(formatAsHex))` and just keep an array of the formats hex identifiers to compare against.  
Thanks for this great input @dceejay

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 June 2020 10:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/15 "2020-06-22T10:29:55Z")

</div>

maybe need compare rather than includes to save searching the whole file...

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [22 June 2020 11:19 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/16 "2020-06-22T11:19:37Z")

</div>

> [@dceejay](#):
>
> compare rather than includes

Don’t think that would work as the file signatures are not always in the same place. For example for mp3s without an id3 Tag i have to look for frame headers to identify it.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 June 2020 11:21 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/17 "2020-06-22T11:21:35Z")

</div>

uugh.. well I did say it could be a best effort... searching complete buffer may kill performance.

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [22 June 2020 11:25 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/18 "2020-06-22T11:25:28Z")

</div>

I think big audio files will probably be passed in as urls or file paths and i don’t need to do the searching and guessing for them. You wouldn’t want to pass around a buffer of 3 hours of flac audio in memory anyway. I might integrate it as a checkbox with a disclaimer of possible performance problems. So check this box if you want the node to guess the input format. I might add a note that this option should only be used with smaller files.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 June 2020 11:42 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/19 "2020-06-22T11:42:22Z")

</div>

I would not have the option (one more thing to confuse users) - just search the first few bytes - if successful then hooray - good win - if not then error/warn that msg.format was not supplied.

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [22 June 2020 12:15 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563/20 "2020-06-22T12:15:22Z")

</div>

To catch the ones that are not at the start i would have to search at least the first 20000 buffer elements. Does that count as a few 🙈 I will only check the first few and if you pass in mp3s that don’t include modern tags its your own fault and you have to supply a msg.format

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-sox-utils-first-beta-testers-wanted/27563.md?page=2)
