Sponsored Content
Top Forums Shell Programming and Scripting Experimental awk audio converter for CygWin and AudioScope.sh Post 302923349 by Corona688 on Saturday 1st of November 2014 12:29:45 PM
Old 11-01-2014
I think you can simplify that awk code by telling it to use all whitespace as record separators. One statement instead of four. Then you just tell it to process the "odd" lines -- 1, 3, 5, ...

You can get rid of the BEGIN block by feeding variables into awk on the commandline. This also lets you script the value of the outputfile.

I started adding pipes and stuff then saw the BINMODE, and realized that's probably why you were forced to use temp files. Oh well.

Code:
awk --characters-as-bytes 'NR%2 { printf("%c", ($1+32768)/256)) > OUT }' RS="[ \r\n\t]+" BINMODE=3 OUT="/tmp/leftbinary" /tmp/signed16bit.txt

This User Gave Thanks to Corona688 For This Post:
 

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
Audio::File::Type(3pm)					User Contributed Perl Documentation				    Audio::File::Type(3pm)

NAME
Audio::File::Type - represents an audio filetype DESCRIPTION
An instance of an object inherited from Audio::File::Type is returned by the constructor of Audio::File. This object currently provides access to the audio files information like its audio properties (bitrate, sample rate, number of channels, ...) and the data stored in the files tag, but also providing access to the raw audio data and other information should be easy to be implemented. METHODS
new Constructor. In fact you don't need to use it. Please use Audio::File which will call the appropriate constructor corresponding to the files type. init This method will be called by the constructor. It's empty by default and should be overwritten by inheriting subclasses to initialize themselfes. name Returns the name of the audio file. is_readable Checks whether the file is readable or not. At the moment it's only used by the constructor, but it will be more usefull with later versions of Audio::File. is_writeable Checks whether the file is writeable or not. At the moment you'll probably don't need to call this method, but it'll be more usefull as soon as changing the audio file is implemented. tag Returns a reference to the files tag object. See the documentation of Audio::File::Tag to learn about what the tag object does. audio_properties Returns a reference to the files audio properties object. See the documentation of Audio::File::AudioProperties to get information about what the audio properties object does. save Saves the audio file. This is not yet implemented but it should remember me to do it at some time.. :-) type Returns the files type. TODO
implement changing the file SEE ALSO
Audio::File, Audio::File::Tag, Audio::File::AudioProperties AUTHOR
Florian Ragwitz <flora@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2004 Florian Ragwitz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. perl v5.10.0 2005-02-18 Audio::File::Type(3pm)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy