A fun bit of shell scripting...

Code junkies hangout here

Moderators: ChriThor, LXF moderators

A fun bit of shell scripting...

Postby Bazza » Tue Jul 16, 2013 5:30 pm

A FUN Bash Shell Bomb-Out Error Sound... ;o)

Do you remember the Bomb-Out icon(s) that appeared on some computers' SW and HW many years ago...

Well this is a matching sound to go with it and can be used as a critical error sound.

It sounds a little like a bomb being dropped from an aeroplane and is purely a shell sript only.

It is set up to run "/dev/dsp" but just by editing the code SOund eXchange, SOX, can be used instead.

Read the code for more informastion.

Enjoy and have a little fun with your new error beep... ;oD

Code: Select all
#!/bin/bash --posix
# Generate a fun bomb-out sound using SOX and /dev/dsp...
# $VER: bomb.sh_Version_1.00.00_(C)2013_B.Walker_G0LCU.
# This is now Public Domain and you may do with it as you please...
# Tested on a Macbook Pro 13" OSX 10.7.5, using SOX.
# Tested on Debian Linux 6.0.x, using /dev/dsp
# Tesetd on PCLinuxOS 2009, using /dev/dsp.
# Initialise the waveform.raw file length to zero.
> /tmp/waveform.raw
# Generate the high start sound.
for m in $( seq 0 1 50 )
   printf "$waveform" >> /tmp/waveform.raw
# Now build up the waveform by adding the correct byte values at the end first then the beginning last.
for n in $( seq 0 1 15 )
   # Add the correct byte at the end, append the file, looping a few times...
   for m in $( seq 0 1 10 )
      printf "$waveform" >> /tmp/waveform.raw
   # Now add the correct byte at the beginning, append the file, looping a few times...
   for m in $( seq 0 1 5 )
      printf "$waveform" >> /tmp/waveform.raw
# Now generate a crude explosion...
dd if=/dev/urandom of=/tmp/explosion.raw bs=8000 count=1
# Append to the waveform.raw file...
cat /tmp/explosion.raw >> /tmp/waveform.raw
# Now play back a single run of the raw data using SOX.
# IMPORTANT! Change the path to suit your SOX path...
# /Users/barrywalker/Downloads/sox-14.4.0/play -b 8 -r 8000 -e unsigned-integer /tmp/waveform.raw
# A version for /dev/dsp too.
cat /tmp/waveform.raw > /dev/dsp
# DEMO bomb.sh end.
# Enjoy finding simple solutions to often very difficult problems...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
LXF regular
Posts: 1596
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests