Re: A few questions about sfront

From: John Lazzaro (lazzaro@cs.berkeley.edu)
Date: Tue Jul 11 2000 - 20:45:35 EDT


> 1) It would be nice if the C file that is output by sfront
> could just create an object file that I could link to my
> own main(). That way, all sorts of applications could include
> complex sound support with a minimum of effort.

Have you checked out the developer part of the sfront manual:

http://www.cs.berkeley.edu/~lazzaro/sa/sfman/devel/intro/index.html

It covers a few different ways to use sfront in applications,
in particular:

-- For the simplest apps, generating an sa.c file and calling it.
-- For more complex apps, writing your own control and/or audio
   drivers.

If neither of these fit what you want to do, though, the main()
for the sa.c files are copied in from these libraries:

sfront/src/lib/csrc/runtime.c -- for audio drivers that use shorts
sfront/src/lib/csrc/runtimef.c -- for audio drivers that use floats

You could imagine modifying these to be something else in your own
copy of sfront, and then remaking first in sfront/lib and then
in sfront, to create an sfront that generated a C file without a
main, which you could then use.

But I'd really recommend taking a hard look at the driver interfaces
first, and see if it isn't possible to do what you want in that
structure first ... and if not, what extensions need to happen to
make it so. In particular:

> It would be
> great if a protocol could be used to send events to the
> sound generator module. Could this happen?

This chapter:

http://www.cs.berkeley.edu/~lazzaro/sa/sfman/devel/cdriver/intro/index.html

describes control drivers, which is really designed to do this
very thing. Note the -fstr file, which streams SASL out from an
MP4 file, is written as a control driver, and isn't part of sfront
itself.

> 2) Can I get a report on the max amplitude of the output_bus
> as the piece is being rendered? I guess that I could make this
> in different ways with printf(); Does anyone do that?

There may be real advantages to using a system like esound for
this:

http://freshmeat.net/appindex/1998/05/02/894135797.html

Basically, printf()'s to xterms will click for low-latency stuff,
whereas I assume esound and its competitors are better written
in this regard (I haven't actually used esound, or an alternative
like

http://freshmeat.net/appindex/2000/06/08/960483753.html

so I actually don't know if it handles sa.c audio output well, but
I would think it would).

> 3) When I generate tables, can I ask that they be normalized?
> Or, what would be the sharpest way to normalize tables after
> they have been created?

No, if the sort of normalization you want isn't what a specific
wavetable generator delivers (for example, the sample wavetable
generator, given a 16-bit WAV or AIFF file, doesn't sense the
highest and lowest short in the file and scales that to -1/1,
but rather scales assuming -1.0 == -32768), you'll need to
use tablewrite/tableread calls at i-rate to rescale your file,
probably best done on imports exports global tables by an
instr that you start up at time 0 ...

                                                        --jl

-------------------------------------------------------------------------
John Lazzaro -- Research Specialist -- CS Division -- EECS -- UC Berkeley
lazzaro [at] cs [dot] berkeley [dot] edu www.cs.berkeley.edu/~lazzaro
-------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 11:46:40 EST