The Start Of A Simple Audio Scope Shell Script...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting The Start Of A Simple Audio Scope Shell Script...
# 15  
Old 03-20-2013
Quote:
Originally Posted by wisecracker
Working on a config file now so that user parameters can be saved and auto-restarted. This will take a while...
Before you get too carried away with that, you can use the shell's ability to source files to do that simply. If you can print a file like this:

Code:
VAR1="value"
VAR2="value"
VAR3="value"
SOMEOTHERVAR="value"

then you can directly load it like . /path/to/configfile
This User Gave Thanks to Corona688 For This Post:
# 16  
Old 03-20-2013
Oh, and you can dump a lot of variables at once in a loop in BASH shell:

Code:
for VAR in A B C D E
do
        echo "$VAR=\"${!VAR}\""
done > ~/.scoperc

$VAR is the variable name, for example A. ${!VAR} is interpreted by the shell's name to mean the contents of variable A, as if you'd done ${A}.
# 17  
Old 03-20-2013
Hi Corona688...

Thanks a mill' I will certainly take your advice.

FTTB here is the last of the timebase uploads, less _trigger_ modes, and including the first ultra-simple circuit for the MacBook Pro 13 inch as a comment right at the end of the script.

It includes an offset to allow for sound card midpoint bit error...

I intend to have eveything for basic calibration as part of the script, incuding ultra simple circuits, and matching code if required...

There is now a commented out sinewave generator for Linux machines with /dev/dsp to experiment with...

Although the circuit remains the same the people experimenting will have to work out the dual Stereo I/O plugs wiring for themselves...

Best viewed in plain text mode and watch for wordwrapping, etc...

Last edited by wisecracker; 07-14-2013 at 06:52 AM.. Reason: Code now an attachment.
# 18  
Old 03-21-2013
Hi Corona688...

That small snippet that saves and loads a config file seems to work an absolute dream.
Simplicity at its best, _noise_ free to kids that might view it.

Test code "config.sh"; only tested on this Macbook Pro, assuming my Debian works too.

Code:
scan_start=0
scan_jump=1
zero_offset=0
speed="FASTEST"
> /tmp/AudioScope.config
chmod 777 /tmp/AudioScope.config
printf "scan_jump=12\n" >> /tmp/AudioScope.config
printf "scan_start=6\n" >> /tmp/AudioScope.config
printf "speed='10mS'\n" >> /tmp/AudioScope.config
printf "zero_offset=0\n" >> /tmp/AudioScope.config
. /tmp/AudioScope.config
sleep 1
printf "$scan_start $scan_jump $zero_offset $speed\n"

(Just shows how little I know compared to the big guns.)

I am a very quick learner...

I sure am glad you are _on_my_side_... ;o)

Thanks a lot matey...

WIll now see how it works in the main script...

Last edited by wisecracker; 03-21-2013 at 08:24 PM..
# 19  
Old 03-21-2013
777 is not the magic sledgehammer to fix all permissions problems. It's certainly not a habit I want to teach to kids. 660, or even 600, should do(executable permission is not needed for a script you source). Or just leave it alone.

The traditional location for user config files is ${HOME}, aka ~/, more appropriate than /tmp/
# 20  
Old 03-21-2013
Hi Corona688...

Quote:
777 is not the magic sledgehammer to fix all permissions problems.
Point taken, except I always do this whilst testing and back down when proven or leave if I want things _global_...

Quote:
The traditional location for user config files is ${HOME}, aka ~/, more appropriate than /tmp/
Again I always tend to use the default /tmp/; C:\Windows\Temp; T: and so on as these are usually definitive on any particular platform invovled and you can clear them out as you like.
I've no idea if WIndows 8 (TM) has the ability to allow any/all users to R/W globally to C:\Windows\Temp as I haven't got it, nor do I want it...

My methods may not be the done practice but my motto is "get it working first then improve on it" using the KISS method...

LBNL if anything looks like _noise_ to a kid then I do it longhand for them to understand.

I don't deny that I know little compared to professionals code wise but I sure know how to get things like this project working to give kids a chance to do, and experiment with, for themselves... :-)

Your input has been a great asset and saved me searching for things I don't know about, however, KISS is also extremely important to me...

HTH, G'Night...
# 21  
Old 03-22-2013
Quote:
Originally Posted by wisecracker
Point taken, except I always do this whilst testing and back down when proven or leave if I want things _global_...
...which is where this habit comes from. You see it used and see that it works, and eventually come to believe it's sometimes necessary. Others see it done in code you make, and come to believe this too.

600 or 700 is always enough to access your own file, by definition, and files you create are your own files, by definition.

660 or 770 is plenty for sharing. If it's not, it's not the file permissions but the group arrangement that's wrong.

777 allows anyone, including not just other users but system daemons and other such things which have no business being there. Someone could pervert a webserver into overwriting the file with their own code, since it's open to writing from anything, web daemon included.

Last edited by Corona688; 03-22-2013 at 02:49 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

A simple variable frequency sinewave audio generator.

Hi all... Well I have not been inactive but working out how to make OSX 10.14.x command line audio player have a variable sample rate. This is a back door as afplay does not have a sample rate flag unlike aplay for ALSA, in Linux flavours. This is a DEMO only but a derivative of it will... (2 Replies)
Discussion started by: wisecracker
2 Replies

2. Shell Programming and Scripting

Generate 10000 unique audio file of 2MB each using shell script.

Hi, I want 10000+ unique Audio file of approx 2MB each. How can i generate numerous audio files using shell script. Any tool, command or suggestions are welcome. If i give one audio seed file then can we create numerous unique files with same seed file? Any help is highly appreciable.... (11 Replies)
Discussion started by: sushil.kumar
11 Replies

3. OS X (Apple)

Python script to do simple audio capture...

This site is the first to get this snippet. It will capture an audio recording of any time length within the limits of OSX's QuickTime Player's capablility... A shell script derivative of this will be used as a further capture for CygWin's AudioScope.sh. Thoroughly read ALL the comments in... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. UNIX for Dummies Questions & Answers

unable to start shell script

Hi, Pleasse could someone advise why i'm getting this error below - No such file or directory dev6:$ ls -ltr ReleaseManagement.sh -rwxr-xr-x 1 dev fix 4830 Aug 22 11:13 ReleaseManagement.sh dev6:$ ./ReleaseManagement.sh : No such file or directory dev6:$ thank you (2 Replies)
Discussion started by: venhart
2 Replies

5. Shell Programming and Scripting

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
Discussion started by: casmo
5 Replies

6. What is on Your Mind?

Scope of Shell Programming and scripting

Hi all, I want to know what is the scope and job status of shell Programming and scripting. Does it have any attractive jobs? (2 Replies)
Discussion started by: malikshahid85
2 Replies

7. Shell Programming and Scripting

Help with stop/start Shell Script.

Hi All, I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task. 1. User will input the option which server they wish to stop. 2. Will clear cache files from specific location. 3. ... (1 Reply)
Discussion started by: venga
1 Replies

8. Shell Programming and Scripting

scope of a Variable inside shell script

hi all, i'm using the following script, Status=1 Function_do () { while read line; do if ; then #echo $line if ; then Status=0 echo " LINKINK ERROR " fi fi done < ldd.log } Function_do (4 Replies)
Discussion started by: vij_krr
4 Replies

9. Shell Programming and Scripting

simple shell - how to get a parameter typed in a shell script

Hi, I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies

10. Shell Programming and Scripting

problem with shell variable's scope

Hi, I am stuck while developing a shell sub-routine which checks the log file for "success" or "failure". The subroutine reads the log file and checks for key word "success", if found it set the variable (found=1). It returns success or failure based on this variable. My problem is, I can... (2 Replies)
Discussion started by: cjjoy
2 Replies
Login or Register to Ask a Question