LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2007, 10:56 AM   #1
PAix
Member
 
Registered: Jul 2007
Location: United Kingdom, W Mids
Distribution: SUSE 11.0 as of Nov 2008
Posts: 195

Rep: Reputation: 40
Simple AU audio data and volume, from the command line


I have a C program generating Morse code, written by Tom Russo KM5VY around 1999, modified to include include a few extra characters and cater for the anomaly of things like short breaks “ii” that need the inter character space to be unweighted when the character speed and word speed (Farnsworth weighting) are dissimilar. Normally the output goes to a user selected .au file - an early Sun sound format that will happily play via Real Player in a small window.

I would like to use the program from the command line and wish to transmit the program output directly directly as tone modulated CW on an FM transmitter for operator training purposes. I can presently queue a Bourne shell script to call the program which also redirects the output to /dev/audio or less satisfactorily to /dev/dsp.

The problem I have is that the sound card is working at full volume with no control of the audio level. I would need to use a simple resistor divider to adjust the signal, but would like to be able to control the sound card volume, either by piping through a digital attenuator/filter and on to /dev/audio or redirection to an application that will render the output correctly, hopefully with some form of volume control setting/configuration.
Code:
(  morse 20 20 800 < messagedata.txt > /dev/audio )
 The parameters to morse are character speed, Morse speed and tone
is there a way that I may redirect the audio data (.AU formatted) to a simple sound application that can be called from the command line and that will quietly die at the end of the file/data stream?

Alternatively, I suppose that it should be possible to write a small C program to take stdin, work on the numbers and pass the modified stream of values back out to std out.
Code:
( morse 20 20 800 < message.txt | FILTER > /dev/audio )
I understand that the .AU format, being one of the early ones, is very simple and straight forward. I suspect that the header information is presently responsible for a slight click in the audio at the beginning of the stream, but optionally removing the generation of the .snd header would I believe leave me with numeric representation of audio samples that might be amenable to simple experimentation.
My early research however suggests that I am a naif, but about to find out a lot about codecs and digitally compressed audio data. So no free lunch then.

The best direction to take is probably almost as good as a ready made answer to my problem.
Thanks for reading.

PAix
 
Old 10-20-2007, 10:12 PM   #2
timkb4cq
LQ Newbie
 
Registered: Jan 2006
Posts: 17

Rep: Reputation: 0
If you are using the alsa drivers for your sound card then you can use the amixer command line mixer app to set the sound card levels in your bash script before you call the routine that sends the audio data.

If you are using the OSS drivers instead, than the aumix mixer can also be run from a shell script in a similiar fashion.

Last edited by timkb4cq; 10-20-2007 at 10:17 PM.
 
Old 10-21-2007, 09:50 AM   #3
PAix
Member
 
Registered: Jul 2007
Location: United Kingdom, W Mids
Distribution: SUSE 11.0 as of Nov 2008
Posts: 195

Original Poster
Rep: Reputation: 40
Thank you for your kind guidance. I now know what ocean I am sailing and what boat I'm on. Once I have figured how to put the sails up I should make good progress. I'll dig around in the spirit of self teaching and report my progress shortly. =
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line CD Audio dtjohnst Linux - Software 3 02-25-2007 04:47 PM
Simple / quick GUI on the command line ? michael_util Programming 3 01-05-2005 05:08 PM
command line tool to control volume? infected Programming 4 09-02-2004 08:58 AM
How to change volume/audio settings using the command line? brynjarh Linux - Newbie 3 07-08-2004 10:50 PM
Simple help in Linux command line daeojkim Programming 3 09-30-2003 10:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration