[arm-allstar] Recording Node Audio
Patrick Perdue
borrisinabox at gmail.com
Tue Jul 12 16:18:45 EDT 2022
There are a bunch of possibilities here, but what I normally do is use
outstreamcmd instead, then use dd to copy the output of a pipe to a
file, usually in /tmp or an external drive so I am not writing to the SD
card. This will give you one contiguous file, no timestamps or metadata,
unlike the archivedir directive, just as your node transmitted it,
including any telemetry, in raw PCM, which you will then need to convert
to wav. Have a cron job that fires up dd at a specific point, and
another one that kills it.
Note that /tmp lives in RAM, so the more free memory your Pi has, the
longer you can record directly to /tmp if you choose to do things this
way. I have most of my nodes on Raspberry Pi 3's, which have 1GB of
memory, but I have a couple on 2 and 4GB boards with no external media
attached. I almost never write an archive like this to the SD card, just
keeping it in RAM long enough to grab it later via SFTP. The only time
this could be an issue is if your node suddenly shuts down while
archiving. RAM is volatile, after all. For context, 1 minute of linear
recording in this format uses 960Kb of disk space, so a two-hour net
recording should be about 112.5 Mb, give or take if you put some space
on either side of net time. If you use the archivedir feature, (I'll get
to that later), which doesn't record dead air, this can be smaller.
To record using outstreamcmd/nptee, in rpt.conf under your node's
stanza, add the following:
outstreamcmd=/usr/local/bin/nptee,pipe1
and then restart Asterisk, or rpt reload.
Now, you can pipe the output to a file with a command like this:
dd if/tmp/outsound/pipe1 of=/Some_Directory/Some_filename.raw
status=progress
Since there is no wave header, the file extension is arbitrary, and in
fact, isn't necessary at all, really. I'm just using .raw as an example.
It could be anything, or indeed nothing.
If you do this from your shell, you will get a foreground process that
can be stopped with control+c. Obviously, not what you need or care
about for background operation, and you can tape the status=progress bit
out for anything you fork to the background, or redirect the output to
/dev/null. It's just good to see that in the console to make sure it's
working.
You can give the output file a pretty name by using the date command,
like so.
dd if=tmp/outsound/pipe1 of=/Some_Directory/net-`date
+%Y-%m-%d-%H%-M-%-S`.raw
This yields the format YYYY-mm-dd-HH-MM-SS, where HH represents the hour
in 24-hour format, MM is minutes, and SS is seconds. This can be
tweaked, see the man page for gnu date formatting strings. I prefer
using this format as this is how practically every operating system
sorts things in a list of files.
There are far better ways to do what I'm about to describe, but I'm
going for quick and dirty here due to lack of time (I need to get going
for an event in a few minutes). Others, feel free to refine, for example
by incorporating this into a proper bash script with a start and stop
command argument.
In cron, if you want your recording to always start at, say, 6:55 PM
every and end at 9:05 PM, Tuesday, put in two jobs like this.
55 18 * * 2
dd if=tmp/outsound/pipe1 of=/Some_Directory/net-`date
+%Y-%m-%d-%H%-M-%-S`.raw
05 21 * * 2 killall -9 dd
But wait, this is still just a raw PCM file, which needs to be converted
to something an audio editor likes. Well, most can open raw audio, which
is what I do just to avoid a conversion process. Parameters are PCM,
8000 hz, 16-bit mono, signed, LE. You can use SoX to do that conversion.
I was going to make a writeup on how to start/stop the archiveaudio
function on a schedule, but...
It's been a while since I've used archiveaudio in HamVoIP. I have it set
to PCM, but it is actually generating GSM 6.10 wave files. Hardly ideal
for a true archive. What's up with that? So, I'll hold off on that until
I figure out why this is happening.
On 7/12/2022 2:20 PM, "Chris via ARM-allstar" wrote:
> I understand that by adding or commenting out a line which says
>
> archivedir=/tmp
>
> to the rpt.conf file in the node section will enable or disable recording.
> But, to put the results out as a podcast, I need to combine all those wav
> files into a single file and move it to my PC. How do I combine wav files on
> the Pi?
>
>
>
> Additionally, is it possible to automate this, turn recording on/off at
> specific times, and collect and concatenate the resulting files, maybe even
> send them to my Dropbox or similar storage?
>
>
>
> Thanks for any assistance.
>
>
>
> 73
>
>
>
> Chris
>
> VE3RWJ (Absolute Tech Net podcast)
>
> _______________________________________________
>
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3/4 web page - http://hamvoip.org
More information about the ARM-allstar
mailing list