Sponsored Content
Full Discussion: Play sound
Top Forums Shell Programming and Scripting Play sound Post 302787065 by wisecracker on Thursday 28th of March 2013 03:44:39 PM
Old 03-28-2013
Hi sreejithalokkan...

Makes much more sense now... ;o)

I will assume that you will need a a dedicated shell Audio I/O app for platform independence.
So I will suggest SOX...

I have to assume also that this is some _homework_ style project, but not necessarily so.

OK.

Think of your problem...

Keep it simple...

I am not going to give you the code directly as you learn nothing about what is going on...

Code:
1) Generate a function, let us call it "say_it()"
2) inside the function call SOX somehow to play your *.wav file. Something like this:-

say_it()
{
        /full/absolute/path/to/sox <your player options> somefile.wav
}

3) Use if - then - fi to call it something like this:-

number="one"
if [ "$number" == "one" ]
then
        # Your new function...
        say_it
fi

All "case"s can be catered for this way and this is its simplest and easiest to understand form, albeit slow...

Next try and make the function universal by making "somefile.wav" a variable...

This User Gave Thanks to wisecracker For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

play cd? how?

hi all, How do I set up my cdrom to play some regular audio cd (not cd-r or cd-rw). I know that my cdrom has been mounted as it does pop up the file manager if I put in, e.g., the office52 cd. Thanks in advance. Andre (3 Replies)
Discussion started by: andrec
3 Replies

2. UNIX for Advanced & Expert Users

Need something new to play with

I posted this question in the dummies forums, but I would like to get a more expert opinion... I am looking for a new OS to play with. I have a celron 450 running slackware linux, a powermac G4 450 running Mac OS X (Which by the way has 81 days of uptime as of this moment), a PowerBook G3 running... (5 Replies)
Discussion started by: dewhite04
5 Replies

3. UNIX for Dummies Questions & Answers

How Can I Play A Cd On Unix

HI I AM A FRESH NEW USER ...I MEAN I JUST GOT A COMPUTER ALMOST FOR FREE AND IT RUNS UNIX WHICH I DIDN'T EXPECT AND DONT KNOW HOW TO WORK ON IT I THOUGHT IT'LL BE WITH WINDOWS ..YOU KNOW SO HOW DO I PLAY A CD IN IT. REMEMBER I KNOW NOTHING ABOUT UNIX , BUT I THINK I'LL GET OVER IT... (1 Reply)
Discussion started by: IMOTEB
1 Replies

4. UNIX for Advanced & Expert Users

play

dear friends, i have linux system . can i play songs in linux system. like winamp player in windows. let me know. (2 Replies)
Discussion started by: rajan_ka1
2 Replies

5. Linux

how can i play the gam

can some1 tell me how to start playing? (2 Replies)
Discussion started by: 123456
2 Replies

6. Linux

Can not play sound in Linux RHEL5.

Hi All, Recently I installed Linux RHEL5 on my machine. It seems that I can not play sound on RHEL5. I have real player installed along with RHEL5 but, when I try to play any song, the error message comes up saying "Can not open the audio device.Another application may be using it." Does any... (2 Replies)
Discussion started by: gydave
2 Replies

7. Slackware

Can't play sound files with aplay or cat to /dev/dsp

I am having problems using soundes. Until a few moments ago the following commands produced errors and no sound: cat /usr/share/apps/kolf/sounds/blackhole.wav/ > /dev/dsp yielded: /dev/dsp: Invalid argument cat /usr/share/apps/kolf/sounds/blackhole.wav > /dev/audio yelded: /dev/audio:... (3 Replies)
Discussion started by: slak0
3 Replies

8. Shell Programming and Scripting

Making a play-list

approximately the same question as the last time, but unfortunately I didn't get a working answer. I made a script with bash and gtkdialog that create a play-list. The output is for example : gtk-media-pause | CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip | 28897 |... (3 Replies)
Discussion started by: jkfloris
3 Replies
MIXER(1)						  The Canonical Csound Reference						  MIXER(1)

NAME
mixer - Mixes together a number of soundfiles. . DESCRIPTION
Mixes together a number of soundfiles, starting at different times and with individual channel selection from the input files. SYNTAX
mixer [OPTIONS ... ] infile [[OPTIONS... ] infile] ... INITIALIZATION
Flags: o -A = Generate an AIFF output file. o -W = Generate an WAV output file. o -h = Generate an output file with no header. o -c = Generate 8-bit signed_char sound samples. o -a = Generate alaw sound samples. o -u = Generate ulaw sound samples. o -s = Generate short integer sound samples. o -l = Generate long (32 bit) integer sound samples. o -f = Generate floating point samples. o -F arg = Specifies the gain to be applied to the following input file. If arg is a floating point number that gain is applied uniformly to the input. Alternatively it could be a file name which specifies a breakpoint file for varying the gain for different periods. o -S integer = Indicate at which sample to start to mix in the next input file. o -T fpnum = Indicate at which time (in seconds) to start to mix in the next input file. o -1 = Mix in channel 1 from next sound file. o -2 = Mix in channel 2 from next sound file. o -3 = Mix in channel 3 from next sound file. o -4 = Mix in channel 4 from next sound file. o -^ intx inty = Mix in channel x from next sound file as channel y in the output. o -v = Verbose mode. o -R = Continually rewrite the header while writing soundfile (WAV/AIFF). o -H integer = Show a "heart-beat" to indicate progress, in style 1, 2 or 3. o -N = Alert call (usually ringing the bell) when finished. o -o fname = output file name (default: test.wav) EXAMPLES
The default values are mixer -s -otest -F 1.0 -S 0 For example mixer -F 0.96 in1.wav -S 300 -2 in2.aiff -S 300 -^4 1 in3.wav -o out.wav This creates a new sound file with a constant gain of 0.96 from in1.wav with the second channel of in2.aiff mixed in after 300 samples and channel 4 of in3.wav outpout as channel 1 after 300 samples. CREDITS
Author: John ffitch 1994 AUTHORS
Barry Vercoe MIT Media Lab Author. Dan Ellis MIT Media Lab, Cambridge Massachussetts Author. COPYRIGHT
5.10 08/01/2011 MIXER(1)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy