Sponsored Content
Operating Systems OS X (Apple) An Audio Function Generator... Post 302970069 by wisecracker on Friday 1st of April 2016 09:31:17 AM
Old 04-01-2016
Hi all...

Steady on guys I ain't that quick... ;oD

Don...
Your code did not work initially I had to do some minor changes.
BYTES is removed as the number '8' is bit depth per sample and will never change.
The reason is I want everything in this project to be pure ASCII including waveform generation; therefore 16 bit depth is a none starter and has two problems:-
1) You have to tell sox whether the two bytes per sample are big or little endian on raw data.
This is not necessary on 8 bit data.
2) Because of 1) there will ALWAYS be binary values and this defeats text mode waveform generation.
This also means I can create an arbitrary waveform in any text editor...
LBNL. I have no intention at this point of deleting the TMPFILEs so I have commented 'rm' out...

Mods to your code:-
Code:
	#### Change these two lines...
	COMMANDpt1 = "~/sox-14.4.0/sox -q -b 8 -r "
	COMMANDpt2 = " -e unsigned-integer " TMPFILE " -d trim 0 00:01 > /dev/null 2>&1"

		#### Change here correct lowercase Commandpt2...
		system(COMMANDpt1 RATE COMMANDpt2)

	exit # system("rm -rf " TMPFILE)

It now works...
A derivative of your code will be my starting point many thanks.
BTW your code answered my next question about global variables thanks for that too.
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. Shell Programming and Scripting

Sequence generator

Thanks Guys This really helped (5 Replies)
Discussion started by: robert89
5 Replies

4. 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

5. OS X (Apple)

A Bash Audio Sweep Generator...

This is a small program as a tester for a basic sweep generator for bandwidth testing of AudioScope.sh. This DEMO is only capable of 4KHz down to about 85Hz and back due to the low bit rate, but it is proof of concept for a much wider variant using a much higher bit rate. The file generated... (4 Replies)
Discussion started by: wisecracker
4 Replies

6. OS X (Apple)

Variable frequency audio generator...

Hi all... I intend to do an Audio Function Generator using Awk, (already started thanks to Don), but the biggest thing I have struggled with was variable frequency. I was going to generate differing sized waveforms on the fly but that would that would mean the frequencies are dependent on any... (2 Replies)
Discussion started by: wisecracker
2 Replies

7. 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

8. Shell Programming and Scripting

Hostsfile generator

Hello I use a bash script to creating the hosts file /etc/hosts But there is a bug inside my output and I want to fix this. My Array looks like this: 205,IP 111.122.133.20 205,HOST2 unas 205,HOST1 unas15533 205,COMMENT # UNAS 775,IP ... (9 Replies)
Discussion started by: Marti95
9 Replies
play(1) 						      General Commands Manual							   play(1)

NAME
play - play any sound file to audio device rec - record audio to any sound file format SYNOPSIS
play [fopts] infile [effect] rec [fopts] outfile [effect] DESCRIPTION
This manual page briefly documents the play and rec commands. play and rec are programs that allow you to play and record different types of sound files from the command line. They are front ends to the more general sox(1) package. Normally, the play command will automatically detect the type and other parameters of the soundfile. If it can't do so, the parameters can be changed through options. OPTIONS
A summary of common options are included below. For a complete description of options and their values, see the sox(1) man page. -c [channels], --channels=[channels] Define the number of channels in the file. -d [device], --device=[device] Specify a different device to play the sound file to. -f [format], --format=[format] Specify bit format of the sample. One of s, u, U, A, a, or g. -r [rate], --rate=[rate] Specify the sample rate of the audio data (samples per second). -s [size], --size=[size] Specify the width of each sample. One of b, w, l, f, d, or D. -t [type], --type=[type] Specify audio file format to use. Useful if it can not be automatically determined. -v [volume], --volume=[volume] Change the audio volume -x , --xinu Reverse the byte order of the sample (only works with 16 and 32-bit data). -h, --help Show summary of options. --version Show version of play/rec. Description of effects are described in the sox(1) man page. SEE ALSO
sox(1) soxexam(1) AUTHOR
This manual page was written by Guenter Geiger <geiger@iem.mhsg.ac.at>, for the Debian GNU/Linux system. Updates by Anonymous. December 11, 2001 play(1)
All times are GMT -4. The time now is 04:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy