Sponsored Content
Special Forums Windows & DOS: Issues & Discussions A SOX 1KHz Sinewave Generator Using A Batch File... Post 302790641 by wisecracker on Saturday 6th of April 2013 06:38:46 AM
Old 04-06-2013
A SOX 1KHz Sinewave Generator Using A Batch File...

Hi all...

I don't think this has been done before but I am open to being corrected...

This batch file generates a 65536 byte binary file to give 8 seconds of pure sinewave at the earphone/speaker output(s)...

It uses ONLY a default Windows 32 bit installation, to Windows 7, except for the installation of SOX...

Notepad was the _main_ editor... ;o)

Hopefully the code section does NOT corrupt the binary part which is 8 bytes in size.
If it does then let me know on here and I will post a pointer from where to grab it...
(Hmmm, just did a preview and it looks as though it does... ;o( )

Enjoy...

Code:
REM Prevent echoing to the CLI...
@ECHO OFF
CLS

REM Generate a pure 1KHz sinewave using SOX...
REM $VER: SOX_DEMO.BAT_Version_0.00.10_(C)2013_B.Walker_G0LCU.

REM This script uses standard Notepad and a default Windows 32 bit install ONLY...
REM It requires no extra installs except SOX itself...
REM The 8 bytes of binary was also generated inside the default Windows OS to windows 7... ;o)

REM Create an 8 byte binary _string_ first for 1 complete sinewave cycle...
SET "rawfile=€&&€ÙþÙ"

REM Write the 8 bytes of binary data to disk in your default TEMP folder...
ECHO | SET /P="%rawfile%" > %TEMP%.\SINEWAVE.RAW

REM Append to the file in powers of 2 to 8*(2^13) = 65536 bytes...
FOR /L %%n IN (1,1,13) DO TYPE %TEMP%.\SINEWAVE.RAW >> %TEMP%.\SINEWAVE.RAW

REM The path is where a default install of SOX resides...
REM Now play the tone burst for around 8 to 9 seconds...
C:\PROGRA~1\SOX-14-4-1\SOX -b 8 -r 8000 -e unsigned-integer -c 1 %TEMP%.\SINEWAVE.RAW -d

REM 1KHz sinewave demo end...
REM ENjoy finding simple solutions to often very difficult problems...

 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sudo & Sox compliance

Hello, I am trying to convince my boss to stop allowing our users to login as root (superuser). Currently our users login to our unix server with their own account, then as needed, they will do an su and put in the root password. This scares me, for a bunch of reasons. Mainly, one is that we... (1 Reply)
Discussion started by: rwallaceisg
1 Replies

2. UNIX for Dummies Questions & Answers

Parsing Powerbroker Logs for SysAdmin Changes (SOX)

I need to identify a list of AIX command strings that can be used to parse Powerbroker logs for changes that are being made by Unix SysAdmins. Need to filter out (as much as possible) inquiry or routine maintenance activity and concentrate on software/security changes. This is for internal... (1 Reply)
Discussion started by: bcouchtx
1 Replies

3. Programming

Python, Platform Independent, Pure Audio Sinewave Generator...

IKHz_SW_OSX.py A DEMO mono _pure_ sinewave generator using standard text mode Python 2.6.7 to at least 2.7.3. This code is EASILY modifyable to Python version 3.x.x... This DEMO kids level 1KHz generator is mainly for a MacBook Pro, (13 inch in my case), OSX 10.7.5 and above. See below...... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. Shell Programming and Scripting

A Crude 1KHz Audio Sinewave Generator Demo...

A very simple crude sinewave generator. The file required is generated inside the code, is linear interpolated and requires /dev/audio to work. Ensure you have this device, if not the download oss-compat from your OS's repository... It lasts for about 8 seconds before exiting and saves a... (5 Replies)
Discussion started by: wisecracker
5 Replies

5. Programming

A Function To Create A 1 Second Sinewave WAVE Beep File In Python.

sinebeep.py Creating an audio WAVE file called... beep.wav ...that can be played using almost ANY audio player available. This simple DEMO snippet of code generates a 1 second sinewave WAVE file. It IS saved inside the CURRENT drawer so that you can find it... ;o) Note that the... (1 Reply)
Discussion started by: wisecracker
1 Replies

6. 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
remquo(3M)						  Mathematical Library Functions						remquo(3M)

NAME
remquo, remquof, remquol - remainder functions SYNOPSIS
cc [ flag... ] file... -lm [ library... ] #include <math.h> double remquo(double x, double y, int *quo); float remquof(float x, float y, int *quo); long double remquol(long double x, long double y, int *quo); DESCRIPTION
The remquo(), remquof(), and remquol() functions compute the same remainder as the remainder(), remainderf(), and remainderl() functions, respectively. See remainder(3M). In the object pointed to by quo, they store a value whose sign is the sign of x/y and whose magnitude is congruent modulo 2**n to the magnitude of the integral quotient of x/y, where n is an integer greater than or equal to 3. RETURN VALUES
These functions return x REM y. If x or y is NaN, a NaN is returned. If x is +-Inf or y is 0 and the other argument is non-NaN, a domain error occurs and a NaN is returned. ERRORS
These functions will fail if: Domain Error The x argument is Inf or the y argument is 0 and the other argument is non-NaN. If the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating-point exception is raised. USAGE
An application wanting to check for exceptions should call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an exception has been raised. An application should either examine the return value or check the floating point exception flags to detect exceptions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
feclearexcept(3M), fetestexcept(3M), math.h(3HEAD), remainder(3M), attributes(5), standards(5) SunOS 5.10 1 Sep 2002 remquo(3M)
All times are GMT -4. The time now is 06:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy