Hi,
The new « soundfile » primitive is progressively implemented in the different
backends. Work has been done in the C/C++ and LLVM backends. Several faust2xx
tools supports it (faust2caqt, faust2jack, faustjaqt, faust2ios, faust2msp,
faust2max6). You’ll have to use the -soundfile parameter so that sound files
are copied in the produced binary (so something like: faust2caqt -soundfile
foo.dsp). faustgen~ supports it also, FaustLive dev branch can now use it.
Here is the current state of documentation:
=========
3.5.3 Soundfiles
The soundfile("label[url:path]", n) primitive allows to access an externally
defined sound resource. A soundfile has one input (the read index in the
sound), three fixed outputs (the first one is the sound length in frames, the
second one is the sound nominal sample rate, the third one is the sound number
of channels) and several more outputs for the sound channels themselves.
If more outputs than the actual number of channels in the soundfile are used,
the sound channels will be automatically duplicated up to the wanted number of
outputs (so for instance if a stereo sound is used with four output channels,
the same group of two channels will be duplicated).
If the soundfile cannot be loaded for whatever reason, a default sound with one
channel, a length of 1024 frames and null outputs (with samples of value 0)
will be used. Note also that soundfiles are entirely loaded in memory by the
architecture file.
Architecture files are responsible to load the actual soundfile. The SoundUI
C++ class located in the faust/gui/SoundUI.h file implements the void
addSoundfile( label, file_name, sf_zone) method, which loads the actual
soundfiles using the libsndfile library, and set up the sf_zone sound memory
pointers. If label is used without any url metadata, it will be considered as
the soundfile pathname.
Note that a special architecture file can perfectly decide to access and use
sound resources created by another means (that is, not directly loaded from a
soundfile). For instance a mapping between labels and sound resources defined
in memory could be used, with some additional code in charge to actually setup
all sound memory point- ers when void addSoundfile(label, file_name, sf_zone)
is called by the buidUserInterface mechanism.
=========
Some simple example are located in tests/soundfile folder. The libraries
contain some helper functions:
https://github.com/grame-cncm/faustlibraries/blob/41163d260be908778d638e1d0211626b8b22b7e7/soundfiles.lib
Next step is to support it in WebAssembly backend, and WebAudio related glue
code.
Use the latest master-dev branch (version 2.6.3 and later).
Testing welcome !
Stéphane
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users