Re: Linux sound output
- To: mathgroup at smc.vnet.net
- Subject: [mg19282] Re: Linux sound output
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Thu, 12 Aug 1999 01:24:31 -0400
- Organization: "Wolfram Research, Inc."
- References: <37B188B8.2E122915@tc.umn.edu>
- Sender: owner-wri-mathgroup at wolfram.com
On Wed, 11 Aug 1999, Phil Mendelsohn wrote: > <SNIP> > > > @sample=split(" ",<STDIN>); > > #print "sample rate $sample[0] sample depth(bits) $sample[2]\n"; > > #print "Currently only 8 bit sample depth is working\n"; > > Some brief questions about this: > > I wish to do DSP where the processing resolution is greater than > 16-bits. I realize that proper dithering to the output resolution is > best handled by a dither function. However, this script says that only > 8-bit resolution is working; that is not sufficient for my purposes. > > Is there a contact for Mr. Pfitzinger to see if he ever moved up the > resolution of samples? Here is his homepage. http://theorie3.physik.uni-erlangen.de/~bepfitz/index.html > Is there a limitation on the MPS output? I don't know of any limitations within the kernel. Sound objects are represented by primitives that can contain numbers of arbitrary precision. When you apply Show[] to have the kernel create the PostScript representation of the sound, the option SampleDepth (default is 8 bits) tells how the kernel should quantize the signal. > (I take it that's Mx PostScript) I'm sorry for my acronym abuse. By "MPS", I mean abbreivated Mathematica PostScript, which is a subset of the PostScript page description language. It uses a lot of appreviated operator names to reduce the size of the PostScript string sent from the kernel to the front end. > Where can I find a copy of the MPS spec and what Mathematica > implements from it? There is no published specification for MPS, but there is a Rosetta stone of sorts for those literate in PostScript. In the directory returned by evaluating this expression: ToFileName[{$TopDirectory, "SystemFiles", "Graphics", "SystemResources"}] you will find a Bourne shell script named "psfix". It is a script which can convert MPS files into regular PostScript documents. There are ample comments from which one can decipher MPS operators -- including those used for sound. > Any other ways of exporting WAV files? Under Mathematica 4, you can setup Export[] pipe functions that handle the playing of sounds. Play[Sin[880 Pi t], {t, 0, 1}, DisplayFunction :> (Export["!cat - > /dev/dsp", #, "WAV"] &)] > Any suggestions on exporting WAV files of greater than 16-bit > resolution? Export[] can handle only 8- and 16-bit sample depths. For higher depths, you will probably have to refer to format specs for WAV files. A good starting point is the Wotsit's Format website. > How practical would it be to write other sound format data files using > Mathematica directly? In principle, you could use the top-level implementations in Export[], but if you are dealing with much larger sound blocks, you may want to write your own MathLink program to handle translation of incremental blocks of data that are sent to the sound-playing device. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc.