Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Foreign Constants and Variables

FAUST provides linkages to the hosting environment via ``foreign'' entities. For example, here are some selected declarations from the FAUST Librariess:6

  SR = fconstant(int fSamplingFreq, <math.h>);
  BS = fvariable(int count, <math.h>);
  tanh = ffunction(float tanhf (float), <math.h>,"");

The foreign constant in the above example is the audio sampling rate SR, which is not known until run-time. It is typically used in FAUST expressions to calculate normalized frequencies f/SR. The FAUST compiler assumes that foreign constants are determined at initialization time and never change.

The foreign variable example is the audio block size BS (or ``buffer size'' or ``inner-loop length''). The FAUST compiler assumes that foreign variables are constant within an inner loop (typically 64 samples), but may change between blocks (like values coming from user-interface widgets).


Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III.
Copyright © 2022-05-05 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA