About
Software
Services
Ideas
Rants
nklein logo

fromStream

Overview

This program turns a stream into PCM output. It interpolates between lines of the stream. It uses the interpolated pixel values to be the volume of given frequencies. The frequencies are interpolated between a given max and min so that the ratio of frequencies in adjacent columns is constant.

For example, if the minimum frequency and maximum frequency are there default values of 128 and 4096 respectively and the stream is five pixels wide, the following would happen. This program would interpolate between two consecutive lines in the input stream. The result will have the same width as the input stream. The zero-th column would get mapped to 128Hz, the first column to 256Hz, the second column to 512Hz, the third column to 1024Hz, and the fourth column to 2048Hz. In general, the j-th column for a stream with w columns would get mapped to:

exp( log(minHz) + j * ( log(maxHz) - log(minHz) ) / w )

Options

[-lps linesPerSecond]
This specifies how many lines of the input stream go into making each second of output. The default is 64.0.
[-gamma gamma]
In order to make images in a paint program which made good sounds, we found it convenient to do a gamma correction. If we didn't do this, then stuff that you couldn't even distinguish from black in the image could drown out lower frequencies. The default is 0.44.
[-minHz minHz]
The minimum frequency. The default is 128.0.
[-maxHz maxHz]
The maximum frequency. The default is 4096.0. Note, if the minimum and maximum aren't both powers of the same number, chances are that there will be a great deal of interference between your frequencies that results in crackles in the sound. Also note, that there is no reason that the minimum frequency really has to be smaller than the maximum frequency.
[-gain gain]
A scaling factor for the output sample. The default is 1.0.
[-freq frequency]
This is the number of PCM samples per second for the output. The default is 8192.
[-wave sine|square|triangle|sawtooth|toothsaw]
This is the type of waveform to use when converting a frequency into PCM. The first three choices are obvious. A sawtooth wave steadily climbs from -1 up to 1 over an interval and then drops back down to -1. A toothsaw wave steadily drops from 1 to -1 over the interval and then hops back up to 1. The default is sine.
[-float]
If this flag is specified, then the raw floating point PCM numbers are emitted in whatever format the host stores them. Otherwise, the floating point numbers are scaled and clipped to [-32767,32767] and emitted as signed 16-bit 2's complement MSB numbers. The default is to use signed 16-bit output.

(copyright 2001) (gpg keys)

Valid XHTML 1.0! Valid CSS!