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...
# 8  
Old 03-13-2013
Are you running sox once per loop? Why not run it once and just read from it as long as you need?

Code:
sox | while true
do
        DATA=$(dd bs=8192 count=1) # Get 8K bytes from the stream
done

That might solve some timing too, since you'd only get data as fast as sox captures it...
# 9  
Old 03-13-2013
This is a new updated version of the AudioScope with limited scans which can be from single shot storage to pseudo-continuous.

Beware when altering any values as there is NO error detection as yet.

Now starting to create _functions_ as this becomes more mature...

Corona688, just eyeballed your upload and will see if it fits my requirements...

Last edited by wisecracker; 07-14-2013 at 05:34 AM.. Reason: Code now an attachment.
# 10  
Old 03-16-2013
Well this script code is now taking shape...

Apologies for any typos...

It has some _command_line_ stuff to alter certain parameters and a few status line updates.

The _commands_ are not case sensitive and there is a starter help window built in also.

HELP and some other commands will auto switch from capture mode to rerun mode displaying the last capture taken. READ THE CODE for more information...

There is a commented out section that would, if edited according to the instructions in the code, generate another shell script and run it in a separate terminal. This will generate an 8 second burst of 1KHz sinewave and as long as the window is the active one just press ENTER to keep rerunning or Ctrl-C to quit the script and close down the terminal...

Connecting the output of the signal to the mic input and adjusting the audio system's gain controls will display a nice sinewave within the limits of standard text mode...

If you edit and run the generator script then SOX must be installed...

I hope this will become a practical kids learning tool along with some simple HW construction in the not too distant future...

As you will see almost EVERYTHING that is needed for testing, calibration running and the like will be generated from this one script only...

Enjoy...

Last edited by wisecracker; 07-14-2013 at 05:38 AM.. Reason: Code now an attachment.
# 11  
Old 03-17-2013
Changes made so that the start position of any timebase scan can be altered. The effective speed is not yet done. This will be the next upload. After that timebase calibration, then a means of saving the settings and being able to start the script with "your" user settings...

Minor changes made including removal of UPPERCASE conversion mode as this could still create a user error.

I hope you guys and gals taking a look at this are enjoying what you are seeing...

What started as a fun upload is evolving into something serious that 10 year olds could understand. I have tried to write the code in such a way as to make it as visaully noise free as possible to youngsters.

Watch for wordwrapping, etc...

To the Admins; thanks for allowing me to do this...

Bazza...

Last edited by wisecracker; 07-14-2013 at 05:42 AM.. Reason: Code now an attachment.
# 12  
Old 03-19-2013
User variable timebase is now complete.

The command is TBVAR then follow the prompts...

It is _in_theory_ error free when typing in wrong characters and/or values... ;o)

The "scan_jump" variable sets the timebase speed, number 1 is the fastest and the maximium allowable number is the slowest and varies according to the "scan_start" position.

The next upload will be the _calibrated_ timebase ranges...

The oscillator commented out of the code will probably be used for checking this...

These will probably be FASTEST, 1mS, 10mS, 100mS and SLOW...

DEMO will not be able to have FASTEST and 1mS.

/dev/dsp will not be able to have FASTEST...

This is slowly evolving into fully working tool...

Watch for wordwrapping, etc...

Last edited by wisecracker; 07-14-2013 at 05:45 AM.. Reason: Code now an attachment.
# 13  
Old 03-19-2013
I think case statements could shrink your kbinput and status checks a lot:

Code:
case "$kbinput" in
TEN)  echo "got TEN"
        ;;
HUNDRED) echo "got HUNDRED"
        ;;
...
*) echo "Unknown kbinput"
    ;;
esac

For tiny if-statements with only one thing in them, you can use && shortcuts:

Code:
[ $hold -eq 1 ] && waveform

# 14  
Old 03-19-2013
Hi Corona688...

Apologies for any typos...

Thanks for the heads up, you are a real pal...

I will fork the existing code and shorten it in your style but upload the longhand version for the foreseeable future.

I have done it this way so that a 10 year old can see the progression.

Does it show that much that I am an amateur... ;o)

BTW, calibrated timebase ranges are finished and coupling the earphone output to the mic input and setting the levels accordingly works a treat. Also added a small offset to ensure that the trace is linear when there is zero input. This removes the sound card's mid point bit error...

Working on a config file now so that user parameters can be saved and auto-restarted. This will take a while...

Bazza...
This User Gave Thanks to wisecracker For This Post:
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