Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A fun bit of shell scripting...

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Tue Jul 16, 2013 6:30 pm    Post subject: A fun bit of shell scripting... Reply with quote

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

Bazza...
Code:

#!/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.
m=0
n=0
waveform="\\xA0\\xA0\\xA0\\x60\\x60\\x60"
# Initialise the waveform.raw file length to zero.
> /tmp/waveform.raw
# Generate the high start sound.
for m in $( seq 0 1 50 )
do
   printf "$waveform" >> /tmp/waveform.raw
done
# 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 )
do
   # Add the correct byte at the end, append the file, looping a few times...
   waveform="$waveform\\x60"
   for m in $( seq 0 1 10 )
   do
      printf "$waveform" >> /tmp/waveform.raw
   done
   # Now add the correct byte at the beginning, append the file, looping a few times...
   waveform="\\xA0$waveform"
   for m in $( seq 0 1 5 )
   do
      printf "$waveform" >> /tmp/waveform.raw
   done
done
# 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...

_________________
73...

Bazza, G0LCU...

Team AMIGA...
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast