Sponsored Content
Top Forums Shell Programming and Scripting Experimental awk audio converter for CygWin and AudioScope.sh Post 302923352 by wisecracker on Sunday 2nd of November 2014 01:02:54 PM
Old 11-02-2014
Hi Corona688...

Along with a few others, you have been extremely helpful with AudioScope.sh over its 21 month lifetime.

All I can say is many thanks.

I will try this baby of yours out and see how it goes on CygWin, as that is the platform that it is aimed at...

Bazza.

---------- Post updated 02-11-14 at 01:44 PM ---------- Previous update was 01-11-14 at 06:59 PM ----------

Hi Corona688...
Just this minute tried your code.
Had to add a '(' in red below to get it to run but ot only delivers 1 byte instead of 48000.
Code:
#!/bin/bash
# 16to8bit_new.sh
> /tmp/sample.raw
> /tmp/leftbinary
> /tmp/signed16bit.txt
dd if=/dev/urandom of=/tmp/sample.raw bs=1 count=192000 > /dev/null 2>&1
od -td2 -An /tmp/sample.raw > /tmp/signed16bit.txt
awk --characters-as-bytes 'NR%2 { printf("%c", (($1+32768)/256)) > OUT }' RS="[ \r\n\t]+" BINMODE=3 OUT="/tmp/leftbinary" /tmp/signed16bit.txt

Results:-
Code:
Last login: Sun Nov  2 13:30:37 on console
AMIGA:barrywalker~> cd Desktop
AMIGA:barrywalker~/Desktop> cd Code
AMIGA:barrywalker~/Desktop/Code> cd Awk
AMIGA:barrywalker~/Desktop/Code/Awk> ./16to8bit_new_c688.sh
awk: extra ) at source line 1
 context is
	NR%2 { printf("%c", >>>  ($1+32768)/256)) <<< 
awk: syntax error at source line 1
awk: illegal statement at source line 1
	extra )
AMIGA:barrywalker~/Desktop/Code/Awk> ./16to8bit_new_c688.sh
AMIGA:barrywalker~/Desktop/Code/Awk> ls -l /tmp/leftbinary
-rw-r--r--  1 barrywalker  wheel  1  2 Nov 13:39 /tmp/leftbinary
AMIGA:barrywalker~/Desktop/Code/Awk> _

---------- Post updated at 06:02 PM ---------- Previous update was at 01:44 PM ----------

This is an even smaller version for the LHS only and works a real treat in CygWin...
Thanks C688 for mentioning the removal BEGIN ...
Code:
#!/bin/bash
# 16to8bit_new.sh
> /tmp/sample.raw
> /tmp/leftbinary
> /tmp/signed16bit.txt
dd if=/dev/urandom of=/tmp/sample.raw bs=1 count=192000 > /dev/null 2>&1
od -td2 -An /tmp/sample.raw > /tmp/signed16bit.txt
awk --characters-as-bytes '
{
	BINMODE=3;
	FS=" ";
}
{
	if ($1=="") exit(0);
	$1=(int(($1+32768)/256));
	$3=(int(($3+32768)/256));
	$5=(int(($5+32768)/256));
	$7=(int(($7+32768)/256));
	printf("%c%c%c%c",$1,$3,$5,$7) > "/tmp/leftbinary";
}' < /tmp/signed16bit.txt

Listening tests were more than good, now I have to attempt to obtain a conversion to 8000Hz sampling rate for the frequency counter part of AudioScope.sh...

I have a simple idea to test and will post here when done.
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Row to column converter using Awk or grep?

Hello, Can someone please help me on this.:confused: I have a file which has more than 1 million lines (XML file). What I need is: Search for "abcd" in the input file > output the result into a output.txt (colloum1) Search for "efghi" in the input file > output the result in to... (3 Replies)
Discussion started by: Needhelp2
3 Replies

2. Slackware

Problems with audio recording in Audacity 2.0.5. Slackware64 14.1; Intel HD Audio.

I'm trying to record audio using Audacity 2.0.5 installed from SlackBuilds. My system is 64-bit Slackware 14.1 and a sound card is Intel HD Audio. I didn't change my sound system to OSS. (Default sound system in Slackware 14.1 is ALSA, isn't it?) First, I set Internal Microphone slider in KMix... (2 Replies)
Discussion started by: qzxcvbnm
2 Replies

3. What is on Your Mind?

AudioScope...

Boy oh boy, with only a MONO mic input to use AudioScope gets much more difficult when the ALTDC board is included. It needs, so far, two hits at the MIC input with a single hit at the HEADPHONE audio output. The first at the highest practical resolution for the AC component and the second... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. UNIX for Beginners Questions & Answers

Command awk under CYGWIN

One my friend wrote one script on his machine linux, when I try to use it under cygwin I recive one error about the command awk. Is there someone can suggest me the way to fix the error? The script is wrote using gawk and I have no idea what kind of comand is used by cygwin. This is the script:... (8 Replies)
Discussion started by: Tapiocapioca
8 Replies

5. OS X (Apple)

AudioScope Project.

AudioScope Project. (Apologies for any typos.) For the few following...... AudioScope.sh... Now at Version 0.60.00. Well this baby has come a long way since its inception in January 2013. It is now at Version 0.60.00. It is MUCH more Apple centric now with a new OSX Sierra minimum _silent_... (7 Replies)
Discussion started by: wisecracker
7 Replies
DH_MOVEFILES(1) 						     Debhelper							   DH_MOVEFILES(1)

NAME
       dh_movefiles - move files out of debian/tmp into subpackages

SYNOPSIS
       dh_movefiles [debhelperoptions] [--sourcedir=dir] [-Xitem] [file...]

DESCRIPTION
       dh_movefiles is a debhelper program that is responsible for moving files out of debian/tmp or some other directory and into other package
       build directories. This may be useful if your package has a Makefile that installs everything into debian/tmp, and you need to break that
       up into subpackages.

       Note: dh_install is a much better program, and you are recommended to use it instead of dh_movefiles.

FILES
       debian/package.files
	   Lists the files to be moved into a package, separated by whitespace. The filenames listed should be relative to debian/tmp/. You can
	   also list directory names, and the whole directory will be moved.

OPTIONS
       --sourcedir=dir
	   Instead of moving files out of debian/tmp (the default), this option makes it move files out of some other directory. Since the entire
	   contents of the sourcedir is moved, specifying something like --sourcedir=/ is very unsafe, so to prevent mistakes, the sourcedir must
	   be a relative filename; it cannot begin with a `/'.

       -Xitem, --exclude=item
	   Exclude files that contain item anywhere in their filename from being installed.

       file ...
	   Lists files to move. The filenames listed should be relative to debian/tmp/. You can also list directory names, and the whole directory
	   will be moved. It is an error to list files here unless you use -p, -i, or -a to tell dh_movefiles which subpackage to put them in.

NOTES
       Note that files are always moved out of debian/tmp by default (even if you have instructed debhelper to use a compatibility level higher
       than one, which does not otherwise use debian/tmp for anything at all). The idea behind this is that the package that is being built can be
       told to install into debian/tmp, and then files can be moved by dh_movefiles from that directory. Any files or directories that remain are
       ignored, and get deleted by dh_clean later.

SEE ALSO
       debhelper(7)

       This program is a part of debhelper.

AUTHOR
       Joey Hess <joeyh@debian.org>

11.1.6ubuntu2							    2018-05-10							   DH_MOVEFILES(1)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy