Sponsored Content
Operating Systems OS X (Apple) Plotting A Sine Curve Inside A Bash Shell... Post 302914577 by Corona688 on Tuesday 26th of August 2014 06:14:48 PM
Old 08-26-2014
I was trying to output direct 8-bit binary in awk. It kept converting my ff's into two-byte sequences.

You can, in GNU awk, with -b, which I was missing before:

Code:
$ # F is frequency, R is samplerate, S is number of samples
$ awk -b -v F=4000 -v R=8000 -v S=20 'BEGIN { for(N=0; N<S; N++) printf("%c", int(255*(sin(3.14159/2+2*3.14159*N*(F/R))/2)+128)) }' /dev/null | hexdump -C

00000000  ff 00 ff 00 ff 00 ff 00  ff 00 ff 00 ff 00 ff 00  |................|
00000010  ff 00 ff 00                                       |....|
00000014

$

Ordinary awk should be able to manage 1-127 with %c, but no more.

Last edited by Corona688; 08-26-2014 at 07:22 PM..
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[BASH] redirect standard error and use it inside

Hi all, Maybe my question is too simple but till now i couldn't figure about a solution :( I have a bash script scheduled in cron: <cron time parameters> my_script.sh > result.log 2>&1 By this way i can have standard output and standard error in my result.log file Now i want my script... (2 Replies)
Discussion started by: Pescator
2 Replies

2. Shell Programming and Scripting

running bash command inside awk

Org file 192.168.1.10 d:\adir\xdir 192.168.1.11 d:\bdir\ydir want to covert it into robocopy \\192.168.1.10\d$\adir\xdir\log* some_localdir\adir robocopy \\192.168.1.10\d$\adir\ydir\log* some_localdir\bbdir (5 Replies)
Discussion started by: ydk
5 Replies

3. UNIX for Dummies Questions & Answers

using awk inside bash script?

Hello, I'm trying to write a bash script that will query the current system time (OS X 10.6.6) and then convert the output from HH:MM:SS into time in seconds. The output of the system time command (systemsetup -gettime) is returned as: Time: HH:MM:SS so I wanted to use awk -F: to grab... (5 Replies)
Discussion started by: xaiu
5 Replies

4. Shell Programming and Scripting

Learning curve to understand bash iteration

Hi Folks, I know on one side there is script and on another side there is smart script. I am able to achieve what I got but thought there has to be a code which doesn't require multiple lines. So if you guys can help me out than it will be awesome. Also I wrote in cshell but if can get both the... (4 Replies)
Discussion started by: dixits
4 Replies

5. Shell Programming and Scripting

Hide bash code which is inside C plus plus program

I am embedding bash in cpp. Can the bash code be hidden (when we cat the executable to not be able to see the bash code) The simple code I am using: #include <iostream> #include <cstdlib> using namespace std; #define test1 "\ #!/bin/sh --posix \n\ echo... (1 Reply)
Discussion started by: frad
1 Replies

6. Shell Programming and Scripting

Aliases NOT working inside bash shell script

i have defined a function ln_s() for customizing the ln command in script1.sh. more script1.sh echo "Starting Execution" ./script2.sh echo "End of Execution" ln_s(){ ] && return ln -s "$1" "$2" } My script1.sh executes another script2.sh which has the following entry more script2.sh... (12 Replies)
Discussion started by: mohtashims
12 Replies

7. Shell Programming and Scripting

Need Multiple checks inside if condition in a bash shell script

Hi, I need to perform the untar and rm operation if the file found is a .tar and does not have test.tar or hello.tar as the file names. Below is the loop to check the same. for tf in *.tar do if ] then found=1 ... (1 Reply)
Discussion started by: mohtashims
1 Replies
LSCONV(1)						      General Commands Manual							 LSCONV(1)

NAME
lsconv - a program does Log Sweep convolution. SYNOPSIS
lsconv [parameters] sweepfile inversefile Usage: lsconv sweepfile inversefile outfile [refsweep mingain [dlstart]] Example: lsconv sweep.pcm inverse.pcm impulse.pcm refchannel.pcm 0.1 0.8 DESCRIPTION
This manual page documents briefly the lsconv program. This manual page was written for the Debian distribution because the original pro- gram does not have a manual page. lsconv is program to perform accurate time aligned impulse response measurements. lsconv is based on the log sweep method for impulse response measurement, which is one of the most accurate, especially for acoustic mea- surements. This method is based on a special signal, which is a logarithmic sinusoidal sweep, that need to be reproduced through the system under test, and an inverse filter, which, when convolved with the measured log sweep, gives back the impulse response of the system. Files used by lsconv must be in the raw 32 bit floating point format. Use for e.g. sox program for converting if needed. PARAMETERS
sweepfile: sweep file name inversefile: inverse sweep file name outfile: output impulse response file refsweep: reference channel sweep file name mingain: min gain for reference channel inversion dlstart: dip limiting start for reference channel inversion Refer to html documentation for more details. SEE ALSO
sox(1). AUTHOR
This manual page was written by Jaromir Mike <mira.mikes@seznam.cz>, for the Debian project (but may be used by others). August 30, 2011 LSCONV(1)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy