[arm-allstar] Archive Audio at Specific Times
Patrick Perdue
borrisinabox at gmail.com
Fri Mar 26 02:36:45 EDT 2021
That's how I've done it before. Other than using nptee, outstreamcmd and
a scheduled dd to capture the output of a pipe to a single named raw PCM
file, or using SoX or lame to capture the pipe and convert it to some
other output, I don't know of a better way to do it. Of course, this
way, you are also recording the gaps, and you don't get the
timestamps/metadata, etc. that goes along with using app.rpt's built-in
archiving functionality.
An example of how that works with dd:
In rpt.conf under your node's stanza:
outstreamcmd=/usr/local/bin/nptee,pipe1
Then, to save this to a file:
dd if=/tmp/outsound/pipe1 of=/Some/Path/Some/Filename.raw bs=1024 count=1
Note: the bs may be otpimized better. That's usually what I use, and it
seems to work.
You can also use things like this for time/date in your file name:
dd if=/tmp/outsound/pipe1 of=/Some/Path/$(date +%Y-%m-%d-%H-%M-%S).raw
bs=1024 count=1
which would generate a filename like
2021-03-26-02-12-01.raw
in the /Some/Path directory.
You could then put a line in cron to start dd, another one to kill it.
You really should use an external drive for archiving!
As mentioned before, this will give you a single, raw PCM file. You'll
need to convert it to wave, mp3 or some other format before it can be
played.
You could also use SoX to do this in real time from the pipe instead of
using dd, specifying the input and output spec, I guess. I've never
tried that. It works for lame, so it should work for SoX, unless SoX
takes issue with writing the correct number of samples to the wav header
at the end. There is a package called qwelcom, which contains a tool
called qwavheaderdump, which can fix files which have a mismatch in the
number of reported samples vs. actual number of samples, but I don't
think it's available on HamVoIP.
I have used it in combination with Liquidsoap, because it doesn't have a
clue how many samples will be in a wave file when it starts recording,
so it uses the maximum number allowed in the wav specification for every
file. qwavheaderdump corrects that by determining the correct number of
samples based on the information provided in the wav header, and
comparing it to the actual file size.
Anyway, now I'm just rambling.
Just throwing some ideas around. There are other ways to do this, I'm sure.
On 3/26/2021 12:35 AM, "Kevin Davis via ARM-allstar" wrote:
> I have a need to archive audio from a node, but only during specific
> windows.
>
> My plan was to create two versions of rpt.conf; one with the archiveaudio=0
> and another with archiveaudio=1 and use a cron job to switch/reload between
> the two at the appropriate times to start and stop the archive.
>
> Am I missing a more obvious way to handle this?
>
> -KE7K
> _______________________________________________
>
> 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