File: play

package info (click to toggle)
sox 11gamma-cb3-5
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 980 kB
  • ctags: 1,240
  • sloc: ansic: 14,222; sh: 159; makefile: 136
file content (49 lines) | stat: -rwxr-xr-x 1,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# Shell script to play sound files to unix style sound devices.
# Should auto detect most supported systems and play the file for you.
#
# TODO: -v volume option is being parsed but requires an external
# program to use its value to set the recording volume.

if [ "$1" = "" ] ; then
  echo "play v1.1 - front end to Sox"
  echo "Usage: [ fopts ] infile [effects]"
  echo "fopts: -r rate -v volume -c channels -s/-u/-U/-A -b/-w/-l/-f/-d/-D -x"
  echo "effects: copy/rate/avg/stat/echo/vibro/lowp/band"
  echo ""
  echo "See sox man page for more info on required effects options."
  exit
fi

for i
do case $1 in
   copy|rate|avg|stat|echo|vibro|lowp|band)
     break
     ;;
   -v)
     shift
     volume=$1
     ;;
   -)
     fopts="$fopts /dev/stdin"
     ;;
   *)
     fopts="$fopts $1"
   esac
   if test $# -gt 0
   then shift
   fi
done

arch=`uname -s`

if [ "$arch" = "SunOS" ]; then
  sox $fopts -t sunau /dev/audio $@
else
  if [ "$arch" = "Linux" ]; then
    if [ "$volume" != "" ] ; then
      mixer $volume
    fi
    sox $fopts -t ossdsp /dev/dsp $@
  fi
fi