Thanks to Stéphane for helping me create this working example: // Test soundfile primitive // // USAGE: // // > faust2caqt -soundfile tsndfile.dsp // // Doc: https://faust.grame.fr/doc/manual/index.html#soundfile-primitive
gate = button("gate"); inc = 1; play(i) = i, _~(*(gate):+(inc*gate)); // play i'th soundfile process = play(0) : soundfile("son[url:{'/w/s/wav/uh-oh-.wav'}]",2):!,!,_,_; // or soundfile("label[url:{'path1';'path2';'path3'}]", n); On Fri, Jun 7, 2019 at 1:46 AM Julius Smith <j...@ccrma.stanford.edu> wrote: > > Hi Stéphane, > > This sounds really useful! I tried it just now and it did not work, > and I don't understand the error message. What does it mean? > > Thanks, > - Julius > > > cat tsndfile.dsp > // Test soundfile primitive > // Doc: https://faust.grame.fr/doc/manual/index.html#soundfile-primitive > n = 1; > process = soundfile("mylabel[url:/w/s/wav/uh-oh-.wav]", n); > // or soundfile("label[url:{'path1';'path2';'path3'}]", n); > > > faust tsndfile.dsp > ERROR : out of range soundfile part number (interval() instead of > interval(0,255)) in expression : > length(soundfile(mylabel[url:/w/s/wav/uh-oh-.wav]),int(IN[0])) > > > sndinfo /w/s/wav/uh-oh-.wav > ======================================== > File : /w/s/wav/uh-oh-.wav > Length : 17903 > RIFF : 17895 > WAVE > fmt : 16 > Format : 0x1 => WAVE_FORMAT_PCM > Channels : 1 > Sample Rate : 11025 > Block Align : 1 > Bit Width : 8 > Bytes/sec : 11025 > *** 'data' chunk should be an even number of bytes in length. > data : 17859 > End > > ---------------------------------------- > Sample Rate : 11025 > Frames : 17859 > Channels : 1 > Format : 0x00010005 > Sections : 1 > Seekable : TRUE > Duration : 00:00:01.620 > Signal Max : 128 (0.00 dB) > > > faust --version > FAUST Version 2.17.13 > Embedded backends: > DSP to C > DSP to C++ > DSP to Java > DSP to old C++ > DSP to WebAssembly (wast/wasm) > DSP to SOUL > Copyright (C) 2002-2019, GRAME - Centre National de Creation Musicale. > All rights reserved. > > On Thu, Jun 6, 2019 at 11:24 PM Stéphane Letz <l...@grame.fr> wrote: > > > > Hi Gary, > > > > Currently soundfile support is done using the language « soundfile » > > primitive, that allows to load files at DSP init time, and process them in > > the code, see: > > https://faust.grame.fr/doc/manual/index.html#soundfile-primitive. > > > > There is no « please save this buffer to a WAV file » support for now. This > > would require a bit of development at « architecture file level » that is , > > developing a piece of code to somewhat keep audio outputs and write them on > > disk on the fly. This is an additional code that does audio files read as a > > separated DSP object using Libsndfile here: > > https://github.com/grame-cncm/faust/blob/master-dev/architecture/faust/dsp/sound-player.h. > > This could serve an an example to start with. > > > > Note that your requirement could be precised, discussing that on the Faust > > Slack channel > > here:https://join.slack.com/t/faustaudio/shared_invite/enQtNjQ2NDU1OTY4MjQ1LWRlMDY0OTc0ZmM3ZTc5ZjA4MTQzMTYxYzAzZmJiOTMwYzMxNjdiZjlkNTQxYTJiOWUxNzNlMzcyMGNhNDMyODY > > > > Stéphane > > > > > Le 7 juin 2019 à 00:29, Gary Worsham <gary.wors...@gmail.com> a écrit : > > > > > > I'm thinking of implementing something like this, where it has a looper > > > and instruments and MIDI and an external input and you could build up > > > some crazy loops that way. Well it would be a shame just to lose them > > > every time you wanted to start fresh, so I'm wondering if there's a way > > > to say "please save this buffer to a WAV file". > > > > > > Thanks, > > > > > > GW > > > _______________________________________________ > > > Faudiostream-users mailing list > > > Faudiostream-users@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > > > > > _______________________________________________ > > Faudiostream-users mailing list > > Faudiostream-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > -- > > Julius O. Smith III <j...@ccrma.stanford.edu> > Professor of Music and, by courtesy, Electrical Engineering > CCRMA, Stanford University > http://ccrma.stanford.edu/~jos/ -- Julius O. Smith III <j...@ccrma.stanford.edu> Professor of Music and, by courtesy, Electrical Engineering CCRMA, Stanford University http://ccrma.stanford.edu/~jos/ _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users