Cool Geoff!
You've inspired me to share as well :)

Here's the one I am officially contributing to the open-source community:
(please forgive me, I'm kinda proud of this one - it was a big deal for me - 
lol)

============================================================
#!/bin/bash
# Author:
#    Rick Quendun
#    KMUZ Engineering
#    rick <_at_> kmuz <_dot_> org
#
#    Script last modified    2014-06-06
#
# Hourly script to record 1 hour audio blocks from analog source into default 
audio input.
# Spans 1 minute before (hh:59) and past (hh:01) the hour recorded
# Total recording time = 62 mins (3720 secs)

# RAMDISK notes:
# Requires 1GB ramdisk size to hold 1 hr recording, plus next hour's partial 
before prior is moved.
# Records WAV, 320k MP3, and 128k MP3.  This all fits within 1GB ramdisk.

# PHYSICAL storage notes:
# (1 hr audio file size) x (hours to retain 30-31 days)
# WAV      = 655 MB x 744 = approx. 700 GB
# 320k MP3 = 150 MB x 744 = approx. 150 GB
# 128k MP3 =  60 MB x 744 = approx.  75 GB
# ----------------------------------------------
# TOTAL STORAGE NEEDED      = approx. 925 GB
#
# (1TB drive = approx. 985 GB usable; perfect capacity for this use.)

# SCHEDULED JOB notes:
# Include crontab info here as a reference
#  # Run the hourlyrecs script hourly starting at hh:59
#  59 * * * * /opt/scripts/hourlyrec-analog.sh


# Start script
# Set current directory to the ramdisk:
cd /media/ramdisk/

# Assumes start time of hh:59
# Start recording in the background (&); stop after 3720 secs (62 mins).
arecord -f cd -t wav -d 3720 current.wav &
arecord -f cd -t raw -d 3720 | lame -r --preset insane - current320.mp3 &
arecord -f cd -t raw -d 3720 | lame -r --preset 128 - current128.mp3 &

# Wait 90 secs into the "recording hour" to make sure the job has started and 
the file(s) are opened:
sleep 90

# Rename the current files to a name representing the date and time of the 
recording.
# (YYYYMMDD-day-HHMMpm):
mv current.wav `date +%Y%m%d-%a-%I%P.wav`
mv current320.mp3 `date +%Y%m%d-%a-%I%P-320.mp3`
mv current128.mp3 `date +%Y%m%d-%a-%I%P-128.mp3`

# Now wait 5 MINUTES before moving the last hour's recordings from ramdisk to 
physical
sleep 5m


# **** MAKE SURE THERE IS ENOUGH PHYSICAL STORAGE FOR RETENTION PERIOD!
# **** 30-31 days retention = 744 x WAVs  _plus_  744 x both MP3s

# MOVE the last hour's recordings (file age older than 4 mins) from ramdisk to 
physical disk
# (this moves the previous hour's recordings, not the files actively being 
recorded)
find /media/ramdisk/*.wav -type f -mmin +4 -exec mv {} /media/hourlyrecs \;
find /media/ramdisk/*.mp3 -type f -mmin +4 -exec mv {} /media/hourlyrecs \;

# DELETE files older than 30 days from physical storage.
#    Remember:  For all 3 audio files, 30 days retention requires a 1TB hard 
disk.
#    Adjust retention time as necessary.
find /media/hourlyrecs/*.wav -type f -mtime +30 -exec rm {} \;
find /media/hourlyrecs/*.mp3 -type f -mtime +30 -exec rm {} \;

# end


===========================================================


I hope this is useful for someone.

It doesn't show some of the other stuff like setting up the RAMdisk, script 
folders, etc.
I can provide that too if you need it.
Cheers,
Rick
KMUZ Engineering



________________________________
 From: Geoff Barkman <[email protected]>
To: 
Cc: User discussion about the Rivendell Radio Automation System 
<[email protected]> 
Sent: Monday, September 22, 2014 2:23 PM
Subject: Re: [RDD] Looking for Looping Software to record Broadcast
 

I use linux command line recorder called arecord to record audio for a
fixed period and then spit the created file out to a 320k mp3 when
finished. I use crontab to schedule it. It starts at 1 min to the hour
and appends the date / time in the month to the file name.
The 50 second sleep means the actual recording starts 10 seconds
before the top of the hour. That way It overlaps the next hours
recording. I run 2 scripts... one for the even hours and one for the
odd hours.

I hope someone finds this usefull.
Many thanks
Geoff

#!/bin/bash
# Special recording program to record audio for logging purposes and
convert to mp3.

sleep 50

CURRENTevenTIME00=`date +%H_%M`

# arecord records 44.100 cd quality audio for duration 3610 seconds (1
hour 10 seconds)
arecord -d3610 -r44100 -f cd -t wav -c2
/mnt/sdb1/share/wav/$CURRENTevenTIME00.wav

sleep 10

lame -b 320 -m j /mnt/sdb1/share/wav/$CURRENTevenTIME00.wav
/mnt/sdb1/share/mp3/$CURRENTevenTIME00.mp3





On 9/23/14, Rick <[email protected]> wrote:
> This is not RDD-specific or anything.
>
> It happened to us (HD died from the 24x7 recording activity).
>
> We were using a WinXP system running BUTT to feed Shoutcast.
>
> BUTT had a record option, but it was clunky, so my tech added a $99 utility
> for recording (sorry, I don't remember the product).  Hourly recordings
> going to a data drive (on the XP box) that was then shared on the LAN.
>
> The hourly recording activity ran the data drive so hard (constantly writing
> every few seconds) it finally started corrupting.
> This caused BSoDs for the XP box, bringing down the primary function of
> feeding Shoutcast.
>
> I rebuilt that box and said "no recording anymore; recording shall not take
> down the stream feed".
>
> We had a manual Tascam recorder workaround for quite awhile, but I wanted to
> figure out a way to do the automated recordings again, and it was an
> opportunity to figure out how to do it with Linux.
>
> I thought about SSDs, but I was reluctant to put one in for constant
> thrashing, and remembered my old DOS days when RAMdisks were used to
> compensate for slow HDs.
>
> I thought PERFECT!  RAM IS designed to be thrashed for the life of the
> system, let's do it that way!
>
> The rest fell into place one the plan was set :)
>
> Cheers,
> Rick
> KMUZ Engineering
>
>
>
> ________________________________
>  From: Rob Landry <[email protected]>
> To: Rick <[email protected]>
> Cc: "Kevin, Natalia, Stacey and Rochelle" <[email protected]>;
> "[email protected]" <[email protected]>; 'User
> discussion about the Rivendell Radio Automation System'
> <[email protected]>
> Sent: Monday, September 22, 2014 4:02 AM
> Subject: Re: [RDD] Looking for Looping Software to record Broadcast
>
>
>
>
>
>
>
> On Sun, 21 Sep 2014, Rick wrote:
>
>> - Everything recorded to ramdisk, then moved to physical HD once hourly
>> recording is complete (prevents killing your HD by constantly writing to
>> it
>> during recording).
>
> I've never encountered that problem. Where did you learn about it?
>
>
> Rob
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

Reply via email to