tanhfedora15
fedora15 时间:2021-04-01 阅读:(
)
AudioSignalProcessinginFaustJuliusO.
SmithIIICenterforComputerResearchinMusicandAcoustics(CCRMA)DepartmentofMusic,StanfordUniversity,Stanford,California94305USAjosatccrma.
stanford.
eduAbstractFaustisahigh-levelprogramminglanguagefordigitalsignalprocessing,withspecialsup-portforreal-timeaudioapplicationsandpluginsonvarioussoftwareplatformsincludingLinux,Mac-OS-X,iOS,Android,Windows,andembeddedcomputingenvironments.
AudiopluginformatssupportedincludeVST,lv2,AU,Pd,Max/MSP,SuperCollider,andmore.
Thistuto-rialprovidesanintroductionfocusingonasimpleexampleofwhitenoiselteredbyavariableresonator.
Contents1Introduction31.
1InstallingFaust41.
2FaustExamples42PrimerontheFaustLanguage52.
1BasicSignalProcessingBlocks(ElementaryOperatorsonSignals)72.
2BlockDiagramOperators72.
3Examples82.
4InxNotationRewriting82.
5EncodingBlockDiagramsintheFaustLanguage92.
6Statements92.
7FunctionDenition92.
8PartialFunctionApplication102.
9FunctionalNotationforOperators112.
10Examples1112.
11SummaryofFaustNotationStyles112.
12UnaryMinus122.
13FixingtheNumberofInputandOutputSignals122.
14NamingInputSignals122.
15NamingOutputSignals122.
16SignalTypes132.
17SignalComparisonOperators132.
18BitwiseOperationsforIntegerSignals132.
19ForeignConstantsandVariables142.
20ForeignFunctions142.
20.
1Example1142.
20.
2Example2152.
20.
3Functionsfrommath.
h152.
21ParallelandSequenceMacros152.
22SumandProductMacros162.
23PatternMatchinginFaust162.
23.
1FormalParameterException172.
23.
2RecursiveBlockDiagramSpecication172.
23.
3Understandingcountandtakefrommath.
lib182.
23.
4PatternMatchingImplementation182.
23.
5UsingPatternMatchinginRewritingRules192.
23.
6UsingLispSyntaxtoExpressTrees192.
23.
7Pattern-MatchingExample202.
23.
8Pattern-MatchingAlgorithmDescription202.
23.
9MiscellaneousPattern-MatchingExamples202.
24ScopeRules212.
25WhiteNoiseGenerator212.
26FurtherReadingsontheFaustLanguage222.
27Acknowledgment223ASimpleExampleFaustProgram224VerifyingandTestingFaustPrograms224.
1GeneratingFaustBlockDiagrams234.
2ALookattheGeneratedC++code264.
3Printing/PlottingtheOutputSignal(s)264.
4InspectingtheOutputSignal(s)inMatlaborOctave294.
5SummaryofFaustProgramTestingStrategies305AddingaGUI316GeneratingStand-AloneQtorGTKApplications327GeneratingOtherApplicationsandPlugins328GeneratingaLADSPAPluginviaFaust3329FeedingSoundlestoFaustStandaloneApps359.
1OineProcessingofSoundlesinFaust359.
2SoundleInputforStandaloneFaustApplications389.
3SoundleInputforFaustPlugins3810GeneratingaMIDISynthesizerforPD3811MIDISynthesizerTestPatch4012UsingFaustwithSuperCollider4112.
1GettingStartedwithSuperCollider4212.
2LinuxandFaust-GeneratedSuperColliderPlugins4212.
3MacOSXandFaust-GeneratedSuperColliderPlugins4313UsingFaustwithOpenSoundControl(OSC)4414Conclusions48AAppendixA:State-SpaceModelstoFaust49A.
1State-SpaceBiQuadinFaust511IntroductionTheFaustprogramminglanguage1byYannOrlareyetal.
atGrame[3,7,8,4]generatesC++forreal-timesignal-processingapplicationsandpluginsfromahigh-levelspecication.
InadditiontogeneratingecientinnerloopsinC++,FaustsupportsGraphicalUserInterface(GUI)spec-icationinthesourcecode.
Moreover,Faustcangenerateeasy-to-readblockdiagramsdirectlyfromthesource,illustratingsignalowandprocessinggraphically.
Thistutorialprovidessomebasicgetting-startedinfo,abriefoverviewofmainaspectsofthelanguage,andexampleapplicationsandpluginsgeneratedfromasimpleFaustprogramspecifyingaresonatordrivenbywhitenoise.
(SeealsotheFaustonlinedocumentation2.
)InpartbecauseFaustisalwaysevolvingforward,thistutorialisincomplete.
Themostup-to-datespecicationofthelanguageisgenerallyfoundintheFaustQuickReference3manual.
TheFaustcompilertranslatestheFaustlanguageintoC++les(andotherback-endlan-guagesthatwillnotbeconsideredhere).
TheseC++lesmustthenbecompiledandinstalledsomewhereforuse.
ThereaderisthereforeassumedtohaveelementaryprociencyinUNIXop-eratingenvironmentssuchasallLinuxdistributionsandMacOSX.
SuchprociencyincludesfamiliaritywithCommand-LineInterfaces(CLI)suchasallUNIXshells(principallytcshandbashinthistutorial),source-codeversioncontrolusinggit,andelementarycompiling,linking,andinstallationusingmake,someC++compiler,thestandardlinkerld,andsoon.
Fortextediting,Emacsismosthighlyrecommended,butanywilldo.
1TheFausthomepageishttps://faust.
grame.
fr/.
Theexamplesinthistutorial,exceptwhereotherwisenoted,havebeentestedwithFaustversion0.
9.
9.
2a2.
Thename"Faust"isderivedfrom"FunctionalAUdioSTream.
"2https://faust.
grame.
fr/3https://github.
com/grame-cncm/faust/blob/master-dev/documentation/faust-quick-reference.
pdf3Thistutorialhasbeenupdatedsporadicallysince2011.
Whileallknownout-of-dateitemshavebeenxed,therearelikelymore.
Pleaseemailmeifyoundanythingneedingattention.
1.
1InstallingFaustPackagedFaustdistributionsforLinux,Mac,andWindows,etc.
,tendtobesignicantlybehindthelatestversionunderdevelopment.
Whileyoucanprobablygetbynewiththem,theremaybedierentlocationsforvariouspiecesoftheinstallation,andsomeitemsmightnotbeinstalledatall.
BelowwewillassumeyouhaveinstalledthelatestFaustfromGitHub.
TodownloadthelatestversionoftheFaustdistributionfromGitHub(anonymously,read-only),say>gitclonehttps://github.
com/grame-cncm/faust>cdfaust>gitcheckoutmaster-devwhere'>'denotesyourshellprompt,suchasinTerminal.
apponaMac.
Next,followREADME.
mdtocompileandinstallFaustonyoursystem.
Inparticular,youwillneedCMakeinstalled(portinstallcmakeonaMacusingMacPorts,etc.
Normallyportcanbereplacedbybrewforbrewusers).
IalwaysusethelatestFaustmaster-devversion,andndittobequitestable.
Fromtimetotime,updatetothelatestandreinstallasfollows(inthefaustdirectory):>gitpull>gitsubmodulesync--recursive>gitsubmoduleupdate--init--recursive>make>sudomakeinstall(Iuseashellaliasgpwhichexpandstogitpull!
*&&gitsubmodulesync--recursive&&gitsubmoduleupdate--init--recursive.
)Updatingsubmodulestakescareofupdatingthefaustlibrariessubmodule.
ToincludeOSCandHTTPsupport(whichrequirelibloandlibmicrohttprespectively),aswellasallFaustlanguage"backends"(targetlanguagesbeyondC++)say"makeworld"inplaceof"make"above.
TouseQtGUIswithFaust,youneedQt5installed.
OntheMac,saysudoportinstallqt5.
OnFedoraLinux,sayyuminstallqt-devel.
Etc.
OnaMac,youneedtheCommandLineToolsforXcodetobeabletocompileC++codeinthestandardwaysfortheMac.
Thesetoolsaredownloadableviahttps://developer.
apple.
com/downloads/index.
action.
SeealsotheXcodemenuitemXcode/OpenDeveloperTool/MoreDeveloperTools.
.
.
.
1.
2FaustExamplesTheFaustdistributioncontainsasetofprogrammingexamplesintheexamplessubdirectory.
Forexample,toseethegraphicalequalizerdemoonaMac,assumingyourTerminal/shellworkingdirectoryiswhereyoutypedmakeabove,say4>cdexamples/filtering/>faust2caqtgraphicEqLab.
dsp>opengraphicEqLab.
appandexperimentwiththeexamplereal-timelterbankdrivenbyasawtoothoscillatororwhite/pinknoise.
Theuseoffaust2caqtassumesyouareonaMac('ca'standsfor"CoreAudio")andhaveQtinstalled(e.
g.
,MacPorts'qt5-macorbrew'sqt5ontheMac).
Ifnot,thereisalsofaust2jackwhichusestheGNOMEToolKit(GTK),etc.
(sudodnfinstallgtk2-develonFedoraLinuxasofMay2020).
ThesourcecodeforthefunctionsusedingraphicEqLab.
dsp(prex'dm.
')maybefoundinlibraries/demos.
lib.
They,inturn,callfunctionsintheFaustlibrariessuchaslibraries/filters.
lib.
NotethattheFaustlibrariesaredevelopedinaseparategitproject4fromFaust,buttheyarecopiedinthefaustlibrariessubmoduleoftheFaustproject.
MoreFaustdemos/examplescanbefoundonline.
52PrimerontheFaustLanguageFaustisafunctionalprogramminglanguage[6]inwhichthe"main"function,calledprocessinFaust,speciesasignal-processingblockdiagram.
Averysimpleexampleisprocess(x)=x;whichdenesasimple"wire"blockdiagramthatconnectsitssingleinputtoitssingleoutput.
Wecanalsodeneapairofwiresforstereooperation:process(x,y)=x,y;Herewehaveintroducedthecommablock-diagramoperator(,)ontherighthandsidewhichcom-binesblockdiagramsinparallel.
(Onthelefthandside,acommaseparatesfunctionarguments,whichisadierentusageofcomma.
)Commonblock-diagramfunctionsarepredened,suchas"+":process(x,y)=x,y:+;Nowwehaveintroducedthecolon(:)operatorforcombiningblockdiagramsinseries.
Theblockdiagramconsistingoftwowiresxandyinparallelisconnectedtothetwoinputsofthe+blockdiagram.
Sincethe+operatoralreadyhastwoinputs,wedonotneedtorefertothemexplicitly.
Thus,process=+;isequivalentto"process(x,y)=x,y:+;",anditthereforealsospeciesablockdiagramconsist-ingoftwoinputsignals,oneoutputsignal,andasummer,asshowninFig.
1.
Theunderbarsymbol,alsocalleda"wire",denotesthetrivialblockdiagramthatfeedsitssingleinputtoitssingleoutput.
Thus,usingthepredenedblockdiagram""wecandenethe"monowire"function"process(x)=x;"as4https://github.
com/grame-cncm/faustlibraries.
git5https://faust.
grame.
fr/5Figure1:Mainprocessblockdiagramforatwo-inputadder:process=+;process=_;andthe"stereobus"asprocess=_,_;whichisequivalentto"process(x,y)=x,y;".
Theblockdiagramgeneratedbyfaust-svgwire.
dsp(asusedbythescriptfaust2firefox),wherewire.
dspcontainsprocess=;,isshowninFig.
2.
processFigure2:process=;Arguablyevensimplerisprocess=0;where0canbethoughtofasapredenedblockdiagramhavingnoinputsignals,andoneoutputsignalthatisastreamofzeros.
TheblockdiagramforthisisshowninFig.
3.
Itisconvenienttorefertoablockdiagramasasignalwhenithasnoinputsignalsandoneoutputsignal.
Similarly,process=1;speciesablockdiagramhavingnoinputsignalsandanoutputsignalthatisastreamofonesstartingattimezero.
Block-diagramssuchas'0'and'1'maybethoughtofasconstantsignals.
However,sinceaconstantsignal,asdened,issemanticallyablockdiagram,alloperationsvalidforblockdiagrams(listedbelow)canbeapplied.
Forexample,usingtheone-sample-delaypostxoperator',wecanspecifytheunitimpulsesignalby6impulse=1-1';because1istheunit-stepsignal(aunitconstantturningonattime0)and1'istheunit-stepdelayedbyonesample.
Figure3:process=0;2.
1BasicSignalProcessingBlocks(ElementaryOperatorsonSignals)Inadditiontonumberswhichspecifyconstantsignals,primitivesignal-processingblocksincludethefollowing:-outputsignal=rstinputsignalminusthesecondinputsignal(referringtoFig.
1,the"rst"signalistheonenearesttheblackreferencedot)*outputsignal=pointwiseproductofthetwoinputsignals/outputsignal=rstinputdividedbysecondinput(pointwise)^outputsignal=rstinputraisedtothepowerofthesecondinput(pointwise)!
("cut")inputsignalisterminated(nooutputsignal)%("modulo")output=remainderafterdividingrstinputbysecondinputmemoutputsignal=inputsignaldelayedbyonesample(sameas@(1))@output=rstinputdelayedby(integer)valueofsecondinput2.
2BlockDiagramOperatorsThereareseveralfundamentalblock-diagramoperators::combineblockdiagramsinseries,combineblockdiagramsinparallelmerge:signalfan-in(withsummation)~recursive:specifyfeedbackThesewillbeillustratedintheexamplesbelow.
72.
3ExamplesIfanyofthefollowingexamplesarenotobvious,pastethemintotheFaustEditor6,oralenamedtest.
dspfollowedby"faust2firefoxtest.
dsp"inashell:processseriescombination(1in,1out)processparallelcombination(2ins,2outs)process=+;//summer(2ins,1out)processsamesummerprocesssamesummerprocess=-;//signalsubtractorprocess=*;//pointwisesignalmultiplier(nonlinear)process=/;//pointwisesignaldivider(nonlinear)process=mem;//unit-sampledelayprocess=_,1:@;//unit-sampledelayprocess=_,10:@;//ten-sampledelayprocess=a~b;//feedbackthrubaroundaprocessfeedbackthru_(generates0)process=mem~_;//two-sampleclosedloop(generates0)processdigitalintegratorprocessmonotostereoprocessmonotoquadprocessstereotoquad(seediagram)processstereotomono[equivto+]processquadtomono[equivto+,+:+]2.
4InxNotationRewritingForreadabilityandconvenience,inxnotationsuchasx*yisrecognizedandtranslatedtoBlock-DiagramNormalForm(BDNF)asx,y:*,i.
e.
,theparallelsignalsxandyarefedtothetwo-inputmultiplier*.
Similarly,thenotationf(x)isrewrittentox:fiffisaprimitivefunction.
(Moregenerally,f(x)isrstrewrittenaspossibleusingpattern-matching(§2.
23)anddenition-expansion(§2.
7)).
Postxoperatorssuchas'arehandledsimilarly.
Moreformally,wecanwritex*y→x,y:*x/y→x,y:/x^y→x,y:^pow(x,y)→x,y:^x@y→x,y:@x'→x:memf(x)→x:ff(x,y)→x,y:ff(x,y,z)→x,y,z:fandsoon.
6https://faust.
grame.
fr/editor/82.
5EncodingBlockDiagramsintheFaustLanguageWhilemanyblockdiagramsaresimpletowritedowninFaust,suchaselementaryseriesand/orparallelcombinationsofbasicprimitives,thereareotherswhicharehardertoimmediatelysee,particularlywhentherearemultipleoverlappingfeedbackloops.
Aslewlimiterisasimpleexamplecontainingdualoverlappingfeedback.
7AgeneralprocedureforencodingblockdiagramsinFaust,informallycalled"bruteforceFaustication,"isobtainedbyfollowingtheoriginallypublishedtheoremonthegeneralityofFaustasalanguageforencodingblockdiagrams[7].
Analternativeapproach,basedonmethodsofautomaticcontrol,istorstwritedownastate-spacemodelofthesystem,fromwhichaFaustdescriptionreadilyfollows(seeAppendixA).
AnearlyimplementationofthismethodwastheSynth-A-ModelerCompiler[1].
AdisadvantageofthisapproachisthattheresultingFaustcanbelessreadable.
Insteadofanaturalleft-to-rightprocessingspecication,itproducesageneralstate-spacemodelwhichtakestheformofavectorrst-ordernite-dierencerecursion.
Inthistutorial,apartfromAppendixA,simpleandimmediatelyobvioustranslationsofblockdiagramsintoFaustwillbeused,asthesesucemostofthetimeandprovidethemostreadablecode.
Thereisalsousuallyasmallperformanceadvantageofthemoreintuitiveencodingsoverthemoregeneralstate-spaceformulation.
TheperformancedierenceissmallbecausetheFaustcompilerdoesagoodjobofoptimizingthecomputationsimpliedbythesparsematricesofthestate-spacedescription.
2.
6StatementsAsdescribedintheFaust8ManualandFaustQuickReference,9therearefourtypesofstatementsinFaust:denition—deneafunctionintheFaustlanguageleimport—incorporateotherles(like#includeinC)declaration—declare"metadata"suchasauthor,copyright,etc.
documentation—provideXML-style"tags"forin-sourcedocumentationTheonlyrequiredtypeofstatementinaFaustprogramisthedenitionstatement,andtheonlyrequireddenition-statementistheonedeningprocess(analogoustomain()inC):process=faust_expression;Inthistutorial,wewillbeconcernedalmostexclusivelywithdenitionstatements(withsomeoccasionalle-imports).
2.
7FunctionDenitionFaustisafunctionalprogramminglanguage[7].
Fromthispointofview,everyblockdiagrammaybeseenasafunctionmappingitsinputsignalstoitsoutputsignals.
AfullygeneralfunctiondenitioninFaustisoftheform7WritingaSlewLimiterintheFaustLanguage(8m):https://youtu.
be/3WY0ikTFAe48https://faust.
grame.
fr9https://github.
com/grame-cncm/faust/blob/master-dev/documentation/faust-quick-reference.
pdf9f(a)=b;wherefisaname,andaandbareblockdiagramspecications.
Inprinciple,thecompilermustrecognizetheblockdiagramaowingintothesymbolfandreplaceallthatbyb,withanyoccurrencesofawithinbappropriatelywireduptotheoriginalinputa.
Functionargumentsarenormallyasimpleparallelbankofnamedsignals,suchasf(x,y,z)=b,wherebisablock-diagramexpressionthatmaycontainsymbolsx,y,andzwhichwillbeboundtotheinputsignalsasexpected.
Naminginputsignalsinthiswayisoftentheeasiestandmostreadablewaytocopyinputsignalswithinablock-diagramexpression:sum_and_diff_unnamedsum_and_diff_named(x,y)=x+y,x-y;Moregeneralcaseswillbediscussedin§2.
23below("patternmatching").
Functiondenitionscanappearinanyorder;thus,Fauststatementscanappearinanyorder;however,thereisoneexception:Whendeningafunctiondierentlyfordierentargumentpatterns(§2.
23),statementordermattersbecausepattern-matchesaretriedintheordergiven.
Unuseddenitions(unusedbyprocess,eitherdirectlyorindirectly)arediscardedbytheFaustcompilerandhavenoeectonthegeneratedcode:x=1;y=2;//noeffectprocess=x;Sometimeswehavetoforceinclusionofinaudibleprocessingusingtheattachprimitive.
Forexample,thefollowingcasesappearequivalent,eveninthegeneratedblockdiagram,butonlylevelmeter2makesitintothegeneratedC++code(levelmeter1getsoptimizedawaybythecompiler):smoother(s)=*(1.
0-s)s);//unity-dc-gainlowpassfilterlevelmeter1=abs:smoother:vbargraph("Level1[unit:dB]",-70,10);levelmeter2=abs:smoother:vbargraph("Level2[unit:dB]",-70,10);sol1levelmeter1:_,!
;sol2=_R;Producesasignalthatis1whensignalLisgreaterthansignalRand0otherwise.
2.
18BitwiseOperationsforIntegerSignalsTherearealsoC-styleoperatorsformanipulatingthebitsineachsampleofanintegersignal:xorForexample,&canbeusedtoapplyabitmask:ramp=_~+(1);//integerramp1,2,3,.
.
.
process=ramp&((1);BS=fvariable(intcount,);tanh=ffunction(floattanhf(float),,"");TheforeignconstantintheaboveexampleistheaudiosamplingrateSR,whichisnotknownuntilrun-time.
ItistypicallyusedinFaustexpressionstocalculatenormalizedfrequenciesf/SR.
TheFaustcompilerassumesthatforeignconstantsaredeterminedatinitializationtimeandneverchange.
TheforeignvariableexampleistheaudioblocksizeBS(or"buersize"or"inner-looplength").
TheFaustcompilerassumesthatforeignvariablesareconstantwithinaninnerloop(typically64samples),butmaychangebetweenblocks(likevaluescomingfromuser-interfacewidgets).
2.
20ForeignFunctionsAforeignfunctionisdeclaredasffunction(,,)wherethefunction-declarationmustbeoftheformfn();whereiseitherintorfloat.
Inaddition,theinputtypecanbeomitted,indicatingnoinputargument.
Thus,meansoneofthefollowing:intfn(int);intfn(float);floatfn(int);floatfn(float);intfn();//not'fn(void)'floatfn();2.
20.
1Example1Forexample,process=ffunction(floatfn(float),"","-lm");compilesto(asof2020-04-29usingthelatestFaustmaster-devbranch).
.
.
/*linkwith:"-lm"*/#include"".
.
.
virtualvoidcompute(intcount,FAUSTFLOAT**inputs,FAUSTFLOAT**outputs){FAUSTFLOAT*input0=inputs[0];14FAUSTFLOAT*output0=outputs[0];for(inti=0;(i","-lm");compilesto.
.
.
/*linkwith:"-lm"*/#include"".
.
.
virtualvoidcompute(intcount,FAUSTFLOAT**inputs,FAUSTFLOAT**outputs){FAUSTFLOAT*input0=inputs[0];FAUSTFLOAT*output0=outputs[0];for(inti=0;(i/architecture/math.
libforthecompletelistalreadyincorporatedorpredened.
Thelistofincorporatedprimitivesisgivenin§3.
5.
3(p.
32)oftheFaustQuickReference,10.
Allofthesefunctionsacceptasignalandreturnasignalcomputedbyapplyingthefunctiontoeachsample.
2.
21ParallelandSequenceMacrosForcompactspecicationoflargeparallelandseriesarraysofblockdiagrams,theparandseqmacrosareprovided:pf=par(i,N,f(i));//pf=f(0),f(1)f(N-1);sf=seq(i,N,f(i));//sf=f(0):f(1)f(N-1);10https://github.
com/grame-cncm/faust/blob/master-dev/documentation/faust-quick-reference.
pdf15Averyusefulexampleofparisindeningthebusmacro11bus(n)=par(i,n,_);process=bus(4),andthelatteryieldsamorecompactblock-diagramdrawing.
2.
23PatternMatchinginFaustInFaust,patternmatchingisusedinfunctionalrewritingrules:f(pattern)=expression;wherefisanyvalidfunctionname,andbothpatternandexpressionarearbitraryexpressionsintheFaustlanguage.
Suchadenitionspeciesarewritingrule:Whenf(pattern)isrecognizedinanyfunctiondenition,itisreplacedbyexpression.
PatternmatchingiscommonlysupportedinfunctionalprogramminglanguagessuchasHaskell[6],alanguagethatinuencedthedesignofFaust.
Pattern-matchingallowsdierentfunction-denitionsfordierentargument-patterns.
Forex-ample,thefollowinguseofpattern-matchingdenesdierentamplitudesandfrequenciesforasimpleadditivesynthesizer[5]:import("music.
lib");amp(0)=1.
0;//amplitudeoffundamentalfrequencyamp(1)=0.
5;//amplitudeoffirstharmonicamp(2)=0.
3;freq(i)=(i+1)*440;partial(i)=amp(i)*osc(freq(i));//oscdefinedinmusic.
libprocess=sum(i,3,partial(i));The'0'inamp(0)aboveisreferredtoasasingle-valuepattern,asare'1'and'2'inthenexttwolines.
Eachsingle-valuepatternmatchesonlyonevalueexactly.
The'i'infreq(i)abovemaybecalledafreevariableinthepattern(consistingofonlythatvariable),anditmatchesanythingatall(anyblockdiagramintheFaustlanguage).
Pattern-matchingcanbeusedtodenefunctionsrecursively.
Asimpleexampleistherecursivedenitionoffactorial:fact(0)=1;fact(n)=n*fact(n-1);process=fact(4);//outputsignal=24,24,24,.
.
.
11ThebusfunctionwasinitiallydenedintheFaustdistribution'smath.
lib,andwasmovedtosignal.
libneartheendof2016.
16WhileFaustfunctiondenitionscanappearinanyorder,lexicalordermattersforpatternde-nitions.
Thus,intheabovefactorialexample,therewriteruleusingthesingle-valuepattern0istriedrst,whiletheoneusingthevariablepatternnmatchesforanyblockdiagram(whichshould,inourintendeduse,andtoavoidaninniteloop,evaluatetoanintegereachsample).
Ifthersttwolinesareinterchangedintheaboveexample,aninniteloopisobtainedatcompiletime.
Anotherexample[5]isthefoldoperator:fold(1,f,x)=x(0);fold(n,f,x)=f(fold(n-1,f,x),x(n-1));Thenintheadditivesynthesisexampleabove,sum(i,3,partial(i))canbereplacedbyfsum(3,partial)wherefsum(n)=fold(n,+).
Moregeneralexpressionscanappearinapatterndenition,asdescribedin§2.
23.
4below.
2.
23.
1FormalParameterExceptionThepattern-matchingfacilityisnotappliedtoordinaryformalfunctionparameters[5].
Inotherwords,f(x,y,z)=expressionistreatedasafunctionhavingthreeformalparametersthatareexpectedtoappearliterallyinexpression(e.
g.
,anexpressionsuchasx*y+z).
Thisinterpretationisincontrasttoafunctionwhoseinputisthreeparallelblockdiagramsofarbitrarygenerality.
Asaresultofthisexception,themerenumberofformalparametersdoesnotcontributetotheuniquenessofapattern.
Forexample,thefollowingprogramgeneratesacompile-timeerror:f(x,y)=f(x)+f(y);//(x,y)=>f(x),f(y):+f(x)=2*x;//(x)=>2,x:*process=f(3,5);Thecompiler-errortriggeredis"inconsistentnumberofparametersinpattern-matchingrule:(x)=2,x:*;previousrulewas(x,y)=f(x),f(y):+".
Ontheotherhand,thefollowingprogramoutputstheconstantsignal16:f((x,y))=f(x)+f(y);f(x)=2*x;process=f((3,5));Theextraparenthesesdistinguishthepattern(x,y)fromformalparametersx,yinthiscase.
Asanotherexample,thefollowingprogramalsooutputstheconstantsignal16:f(x*y)=f(x)+f(y);f(x)=2*x;process=f(3*5);Sincetheexpressionx*ydoesnotlooklikealistofformalparameters,itdoesn'tneedadditionalparentheses.
2.
23.
2RecursiveBlockDiagramSpecicationRecursivepatternmatching,introducedandillustratedforcomputingfactorialin§2.
23above,alsogivesapowerfulwaytodeneablockdiagramrecursivelyintermsofitspartitions.
Forexample,thefollowingFaustprogramdenesHadamardmatricesoforder2nwherenisapositiveinteger:17import("math.
lib");//definebus(n)=par(i,n,_);//hmtx(2)scalarbutterflyhmtx(2)bus(2)1)prettierdrawinghmtx(n)=bus(n)bus(n/2)),//vectorbutterfly((bus(n/2),(bus(n/2):par(i,n/2,*(-1)))):>bus(n/2)):(hmtx(n/2),hmtx(n/2));process=hmtx(16);//lookatthediagramintheFaustEditor,e.
g.
OtherexamplesincludeFeedbackDelayNetworks(FDN)andthesquarewaveguidemeshoforder2ndenedintheFaustLibraries(seefdnrev0inreverbs.
libandmeshsquare()inmisceffects.
lib).
AnespeciallyinterestingexampleistheFastFourierTransform(fftdenedinanalyzers.
lib).
Seealsobasics.
libforexamplesofusingrecursionforakindoflistprocessing,suchasincountandtake.
Notethatitisalsopossibletoimplementcounterpartstoparandsequsingpatternmatching(seetheduplicatefunctiononpage14oftheFaustQR.
2.
23.
3Understandingcountandtakefrommath.
libInmath.
lib,wehavethefollowingdenitionofcount:count((xs,xxs))=1+count(xxs);count(xx)=1;Thisdenitionusespatternmatchingtocountthenumberofblockdiagramsinparallel.
Forexamplecount((6,5,4))evaluatesto3.
Therstpatternrecognizesaparallelarrangementoftwoblockdiagrams,whilethesecondpatternwillmatchanyblockdiagram.
Inthemulti-elementcase,thelistisparsedasitsrstelementinparallelwithablockdiagramconsistingofallremainingelements(analogoustoCARandCDRintheLispprogramminglanguage).
Notethat(a,b,c,d)matches(xs,xxs)as((a),(b,c,d)).
Alsoinmath.
lib,wehavethefollowingdenitionoftake:take(1,(xs,xxs))=xs;take(1,xs)=xs;take(nn,(xs,xxs))=take(nn-1,xxs);Thisdenitionusespatternmatchingtoreturnthespeciedelement.
Forexampletake(2,(6,5,4))yields5.
Theextraparenthesesaround(xs,xxs)avoidthestructureofmereformalargumentsseparatedbycommas.
Notethattakeis1-basedwhileseqandparetal.
are0-based.
2.
23.
4PatternMatchingImplementationThepatternmatchingfacilityinFaustoperatesonblock-diagramexpressionsinFaustBlock-DiagramNormalForm(BDNF),whichisthelow-levelFaustexpressionformatappearingincompile-timeerrorsanddrawninscalablevectorgraphics(.
svg)lesgeneratedbythefaust-svgoption.
18BDNFexpressionscanbeviewedastrees.
Theleavesofthesetreesarenumbersandprimitiveblockdiagramssuchas+,,!
,abs,sin,etc.
ThenodesofthetreesaretheveoperationsoftheBlock-DiagramAlgebra(BDA)ApatternisaFaustexpressionoptionallycontainingfreevariables.
AFaustexpressionisapatternwhenitappearsasafunctionargumentontheleft-handsideofafunctiondenition:f(pattern)=expression;Suchfunctiondenitionsspecifyrewritingrulessuchthatwhenf(pattern)isrecognizedelsewhere,itisreplacedbyexpressionwithanyfreevariablesinthepatternreplacedbywhattheymatchedintheexpression.
Iftherearenofreevariablesinthepattern,thenthepatternwillonlymatchblockdiagramswhoseBDNFisidentical.
Forexample,thepattern(a)consistsofonlythefreevariablea,whichwillmatchanyexpression.
Thepattern(2*a)=(2,a:*)canberepresentedasatreeconsistingofa':'nodeatthetop,a','nodeasitsleftchild,andthe'*'operatorleafasitsrightchild.
The','nodeinturnhastheleft-leaf'2'andright-leaf'a'(afreevariable).
2.
23.
5UsingPatternMatchinginRewritingRulesAsmentionedabove,rewritingrulesarespeciedinFaustsourcebyfunctiondenitionsoftheformf(pattern)=expression;wherefisanyvalidfunctionname,andbothpatternandexpressionarearbitraryexpressionsintheFaustlanguage.
TheFaustcompilerstoresallrewritingrulesinthelexicalordertheywerespecied(sincelexicalorderdeterminespattern-matchingprecedence).
Whenaninstanceoff(arg)isencounteredintheFaustsource,theargumentargiscompared,inBlockDiagramNormalForm,totherstdenedpatternforf,alsoinBDNF.
ThenodesoftheBDNFarecomparedandtraversedinthestandardorder(top-down,left-to-right),andthematchissuccessfulwhen(1)allnodesandnon-variableleavesmatchliterally,and(2)thefreevariablesinthepattern(ifany)"greedily"matchsubtreesinarg.
Afteranunsuccessfulmatch,additionalpatternsforfaretried,untilamatchisfound.
Afterasuccessfulmatch,anyfreevariablesinpatternareboundtotheirmatchingsubtreesinarg,andexpressionisevaluatedandinsertedinplaceoff(arg).
WewillillustrateanexamplebelowusingLisptreesyntax.
2.
23.
6UsingLispSyntaxtoExpressTreesLispsyntaxisniceforexpressingtreestructureinlineartext.
ALispexpressionhastheformexpr=(functionNameexpr1expr2.
.
.
exprN)wherefunctionNamenamesafunction(analogoustoaprocedureorsubroutineinotherlanguages),andexpr1.
.
.
exprNaretheNfunctionarguments,eachofwhichisaLispexpressionitself.
So,inLisp,anexamplethree-leveltreeconsistingofoneparent,twochildren,andvegrandchildren,couldlooklike19tree=(topNode(leftChild(leftLeftGrandChildleftMiddleGrandChildleftRightGrandChild))(rightChild(rightLeftGrandChildrightRightGrandChild)))2.
23.
7Pattern-MatchingExampleDoesthepattern(a:b)match(2+3)Yes,aswewillseebelow.
12Rewriting2+3inBDNFgives((2,3):+).
ExpressingthisinLispformgives2+3->((2,3)23)(+))Theargumentstothefunction':'aretheexpressions'(,23)'and'(+)'.
Theargumentstothefunction','are'2'and'3'.
Rewritingthepattern(a:b)inLispformgives(a:b)->(:ab)Sincebothpatternsareoftheform(:ab),thepatternsmatch.
2.
23.
8Pattern-MatchingAlgorithmDescriptionThepatternmatchingalgorithmcanberoughlyrecursivelydenedasfollows:13//match(pattern,expression)->boolmatch(v,E)=trueapattern-matching-variablematchesanyexpressionmatch(E,E)=truetwoidenticalexpressionsmatchmatch((opP1,P2),(opE1E2))=trueifmatch(P1,E1)andmatch(P2,E2),falseotherwisematch(P,E)=falseInotherwords,apatternPmatchesanexpressionEifwecanreplacethefreevariablesv1,v2,.
.
.
inPwithsubexpressionsE1,E2,.
.
.
fromEtomakeitidenticaltoE.
Thatis,PmatchesEifthereexistE1,E2,.
.
.
suchthatP[v1=E1,v2=E2,E.
2.
23.
9MiscellaneousPattern-MatchingExamplesDecidewhatyouthinkprocessisdenedasintheexamplesbelow,andthenndtheanswersattheend:Example1:a=2;//thisdefinitionisnotusedf(a,b)=a+b;//aisaformalargumentthatisusedprocess=f(3,4);//seebelowfortheanswerExample2:12ThankstoYannOrlareyforthisexampleandassociateddiscussiononhowpattern-matchingworksinFaust.
13ThankstoYannOrlareyforthisdescription.
20a=2;//thisdefinitionisused(notshadowedbyformalarg)f(c*b)=a+b;process=f(3*4);//seebelowExample3:a=2;//notused-shadowedbypatternvariablef(a*b)=a+b;process=f(3*4);Answers:7,6,72.
24ScopeRulesAsillustratedin§3below,awith{.
.
.
};blockmaybeusedtodenelocalsymbols(blockdiagrams).
Otherwise,everythingisgloballydened.
Alibrary"foo.
lib"maybeloadedintoitsownnamespacebywritingf=library("foo.
lib");andthensymbolsfromthatlibrarymaybeaccessedusingthegivenprex:fPI=f.
PI;//usedefinitionofPIgiveninfoo.
libfTanZero=f.
tan(0);//usedefinitionoftan()giveninfoo.
libAnenvironmentworkssimilarly:e=environment{Phi=0.
5*(1.
0+sqrt(5));}golden_ratio=e.
Phi;Forconvenience,"component("prog.
dsp")"isdenedtomeanthesamethingas"library("prog.
dsp").
process".
Denitionswithinanenvironmentcanbereplaced(orappended)usingthefollowingbracketsyntax:f=library("filter.
lib")[pole(p)=_;];process=f.
dcblocker;//nowitisone-zero,nopole2.
25WhiteNoiseGeneratorTheFaustnoisegeneratordenedinmusic.
libisaninstructiveexample.
Itgeneratesuniformpseudo-randomwhitenoisein[0,1)bythelinearcongruentialmethod.
14random=+(12345)~*(1103515245);//overflowingmpy&offsetRANDMAX=2147483647.
0;noise=random/RANDMAX;Notethatforthisnoise-generatortogiveidenticalresultsonallplatforms,Faustmustdeneintegersas32bitseverywhere,andoverowbehaviormustbenormalizedacrossplatformsaswell.
14Themathematicalnotation[a,b)denotesahalf-openinterval,i.
e.
,theintervalincludesendpointabutbutnotb.
212.
26FurtherReadingsontheFaustLanguageItisimportanttonotethatthisbriefoverviewisnotcomplete.
SeetheFaustManual15andtheFaustQuickReference,16formoreexamples,featuresofthelanguage,anddiscussion.
Historically,theFaustQuickReferencedocumentistheonlyfullyup-to-datespecicationofthelatestfeaturesofthelanguage.
NewsincethistutorialwaswrittenisanonlinedescriptionofFaustsyntax:https://faustdoc.
grame.
fr/man2.
27AcknowledgmentThankstoYannOrlareyforhelpfulclaricationsregardingtheFaustlanguage.
3ASimpleExampleFaustProgramFigure5listsasmallFaustprogramspecifyingtheconstant-peak-gainresonatordiscussedin[10].
process=firpart:+~feedbackwith{bw=100;fr=1000;g=1;//parameters-seecaptionSR=fconstant(intfSamplingFreq,);pi=4*atan(1.
0);//circumferenceoverdiameterR=exp(-pi*bw/SR);//poleradiusA=2*pi*fr/SR;//poleangle(radians)RR=R*R;firpart(x)=(x-x'')*g*(1-RR)/2;//time-domaincoefficientsASSUMINGONE-SAMPLEFEEDBACKDELAY:feedback(x)=0+2*R*cos(A)*x-RR*x';};Figure5:Faustprogramspecifyingaconstant-peak-gainresonator.
Inputparametersareresonancefrequencyfr(Hz),resonancebandwidthbw(Hz),anddesiredpeak-gaing.
Wewillnowstudythisexampleinavarietyofways.
Firstwewillillustratethetypicaldevel-opmentcycle(lookattheblockdiagram,etc.
)Second,wewilladdaGUIandlookatsomeofthevarioustypesofapplicationsandpluginsthatcanbegeneratedfromit.
4VerifyingandTestingFaustProgramsIttakesabitofexperiencetowriteacorrectprogramonthersttry.
Therefore,weoftenhavetodebugourprogramsbysometechnique.
Typically,inspectingtheautomaticallygeneratedblock15https://faustdoc.
grame.
fr16https://github.
com/grame-cncm/faust/blob/master-dev/documentation/faust-quick-reference.
pdf22diagramsandlisteningtotheresultsaretoolsenoughfordebuggingFaustsourcecode.
4.
1GeneratingFaustBlockDiagramsAgoodrstcheckonaFaustprogram(aftergettingittocompile)istogenerateitsblockdiagramusingthe-svgoption.
17Forexample,thecommand>faust-svgcpgr.
dspcreatesasubdirectoryofthecurrentworkingdirectorynamedcpgr-svgwhichcontainsa"scalablevectorgraphics"(.
svg)leforeachblock-diagramexpressionincpgr.
dsp.
Forthisexample,thereisablockdiagramgeneratedfortheprocessline,andforeachofthelastvelinesinthewithclause(notcountingthecomment).
Figure6showstheblockdiagramgeneratedforthemainprocessblockfromFig.
5:process=firpart:+~feedbackThedotoneachblockindicatesitsstandardorientation(analogoustoa"pin1"indicatoronanintegratedcircuitchip).
Thesmallopensquareatthebeginningofthefeedbackloopindicatesaunitsampledelayintroducedbycreatingasignalloop.
Needlesstosay,itisimportanttokeeptrackofsuchaddeddelaysinafeedbackloop.
firpart+feedbackprocessFigure6:Mainprocessblockfortheconstant-peak-gainresonator.
Figure7showstheblockdiagramgeneratedforthefirpartabstraction:firpart(x)=(x-x'')*g*(1-RR)/2;Similarly,Fig.
8showstheblockdiagramgeneratedforthefeedbackpath:feedback(x)=0+2*R*cos(A)*x-RR*x';Ifnotfortheaddedsampleofdelayinthefeedbackloop(indicatedbythesmallopensquareinFig.
6),thefeedback-pathprocessingwouldhavebeeninstead0+2*R*cos(A)*v'-RR*v''.
17Thefaust2firefoxscriptcanbeusedtogenerateSVGblockdiagramsandopenthemintheFirefoxwebbrowser,amongothers.
23xxxmemmem-1g*1gRR-2/*firpartFigure7:FIR-part(x-x'')*g*(1-RR)/2inFaust.
24x02R*Acos*x*+RRxmem*-feedbackFigure8:Feedbackblock0+2*R*cos(A)*x-RR*x'inFaust.
25Notethattheblockdiagramsaredrawnasthoughalldetailsoftheexpressionaretobeevaluatedeverysample.
However,theFaustcompilerinsteadcomputesconstantexpressionsatinittimeandallocatesmemorylocationsforthem.
Moregenerally,theFaustcompilerseparatelyoptimizesfull-ratesignalsatthesamplingrate(calculatedintheinnerloop),slowlyvaryingsignals(updatedatthe"buerrate"outsideoftheinnerloop—currentlyevery64samples),andconstantsignals(evaluatedonceatinitializationtime).
4.
2ALookattheGeneratedC++codeOnenormallyneverneedstolookattheC++codegeneratedbyFaust.
However,wewilldothisnowjusttoseehowitlooks,andnoteafewthings.
RunningFaustwithnoarchitecturele,e.
g.
,>faustcpgr.
dspcausestheC++signal-processingcodetobeprintedonthestandardoutput,asshownforthisexampleinFig.
9.
WeseethatinitcallsclassInit,whichiswhereread-onlywavetablesareinitialized(nonebeingusedinthisexample),followedbyinstanceInit,whichresetsallparameterstotheirdefaultvalues.
Thus,instanceInitprovidesamoreecientprocessor"reset"whenreadonlywavetablesareinuse.
Sinceallprocessorstateisallocatedasinstancevariablesofthemydspclass(whichcanbechangedtoanynameusingthe-cnFaust-compileroption),thereisnoallocationininit.
Noticehowconstantsubexpressions,suchasforfconst0,arecomputedonlyonceininstanceInit.
Thetemplatefaustpower(x)(omittedintheabovelisting)expandstox*x,therebyavoidingcallingthepowfunction.
Ingeneral,Faustdoesalotofsuchoptimization.
ThebuildUserInterfacemethodcallstheappropriateinterfacefunctionforeachcontrolwid-get(slider,button,etc.
),buttherearenoneinthissimpleexample.
In§5wewilladdGUIcontrols,andyoucompilethattoseehowbuildUserInterfacechangesasaresult.
TheGUIcontrolvari-ablesarealsoincludedamongtheprocessorstatevariables,andtheinterfaceisgivenpointerstothem.
(Theinterfaceholdsnosignal-processingstate,includingbothsignalandcontrollervalues.
)Theinterfacemayupdatethecontrolvariablesasynchronously(e.
g.
,inanotherthreadofexecu-tion),andtheywillgetsampledinthesignalprocessoronceperexecutionofthecomputeinnerloop.
Thus,thecontrolrateisthesamplingratedividedbytheaudiobuerlengthcount.
Asaresult,elaborateFaustexpressionsinthecontrolvariablesarenormallyveryinexpensivecompu-tationally.
Foroptimization,wetendtolookhardonlyattheforloopinthecomputefunction;forexample,wegenerallytrytoavoidcallstolibcforthingslikesin()andcos(),whichcanberelativelyslow.
Therearefastapproximatealternativessuchasthefastapproxlibrary,18andlinearlyinterpolatedlookuptablesareoftenused.
4.
3Printing/PlottingtheOutputSignal(s)Sometimes,beyondinspectingtheblockdiagram,itmaybenecessarytoverifytheoutputsignal(s)inmoredetail.
Forthispurpose,Fausthasauseful"architecturele"namedplot.
cppwhichresultsingenerationofamainC++programthatsimplyprintstheoutputsignal(s)tothestandard18https://fastapprox.
googlecode.
com/svn/tags/fastapprox26classmydsp:publicdsp{private:floatfConst0;floatfConst1;floatfVec0[3];floatfConst2;floatfRec0[3];public:staticvoidmetadata(Meta*m){}virtualintgetNumInputs(){return1;}virtualintgetNumOutputs(){return1;}staticvoidclassInit(intsamplingFreq){}virtualvoidinstanceInit(intsamplingFreq){fSamplingFreq=samplingFreq;fConst0=expf((0-(314.
1592653589793f/float(fSamplingFreq))));fConst1=(2*cosf((6283.
185307179586f/float(fSamplingFreq))));fConst2=(0.
5f*(1-faustpower(fConst0)));for(inti=0;iopenVerticalBox("cpgr");interface->closeBox();}virtualvoidcompute(intcount,FAUSTFLOAT**input,FAUSTFLOAT**output){FAUSTFLOAT*input0=input[0];FAUSTFLOAT*output0=output[0];for(inti=0;i.
.
.
};Thesignal1=[1,1,1,istheunit-stepsignalconsistingofallones,and1'=[0,1,1,istheunitstepdelayedbyonesample.
Therefore,1-1'istheimpulsesignalδ=[1,0,0,Supposethelecpgrir.
dsp("Constant-Peak-GainResonatorImpulse-Response")containsourtestFaustprogram.
Thenwecangeneratetheimpulse-responseprintoutasfollowsatthecommandline:>faust-aplot.
cpp-ocpgrir-print.
cppcpgrir.
dsp>g++-Wall-g-lm-lpthreadcpgrir-print.
cpp-ocpgrir-print>cpgrir-print-n10(Commandssimilartothersttwolinesabovearecarriedoutmoreconvenientlyusingthefaust2plotutilitydistributedwithFaust.
)TherstlinegeneratestheC++programcpgrir.
cppfromtheFaustsourcelecpgrir.
dspusingthearchitectureleplot.
cpp.
ThesecondlinecompilestheC++letoproducetheexecutableprogramcpgrir-print.
Finally,thethirdlinegeneratesandprintstherst10samplesoftheoutputsignal(anythingmorethanthenumberofltercoecientsisusuallyenough),whichisourdesiredimpulseresponse:1919Thisspecicoutputwasobtainedbyeditingcpgrir-print.
cpptoreplace%8fby%gintheprintstatements,inordertoprintmoresignicantdigits.
28h=[0.
007073310.
01390390.
0132840.
0124050.
01128820.
009959470.
008448650.
006788770.
005015440.
00316602.
.
.
]Thematlabversionproducesthefollowingimpulseresponse:h=[0.
007073284598646030.
013903827077782880.
013283993892416000.
012404969918063340.
011288153127933900.
009959435446936530.
008448616896341550.
006788749193761010.
005015423047045970.
00316601431505539.
.
.
]Sincematlabusesdouble-precisionoating-pointwhileFaustusedsingle-precisionfloatsinthisexample,weseedierencesaftersixorsodecimaldigits.
TheprecisionofthefloattypeinFaustcanbeextendedtodoubleorquadbychangingthecompilelineasfollows:>faust-double.
.
.
>faust-quad.
.
.
4.
4InspectingtheOutputSignal(s)inMatlaborOctaveThefaust2octavescript,distributedwithFaust,executesshellcommandssimilartothefaust2plotscriptmentionedabove,thenexecutesthegeneratedprogramtowriteamatlabinputle,and-nallyloadstheleinOctave.
Theresultistypicallyasifthefollowingcommandsweretypedfortheaboveexample:>faust-amatlabplot.
cppcpgrir.
dsp-ocpgrir.
cpp>g++-O3cpgrir.
cpp-ocpgrir>cpgrir-n600>cpgrir.
m>octave--persistcpgrir.
mInOctave,thevariablefaustoutisamatrixcontainingtheprogramoutput.
Eachoutputsignalisacolumnofthismatrix.
Intheaboveexample,wehaveoneoutputsignalthatis600sampleslong,sothefaustoutmatrixisa600*1columnvector.
InOctave,anoverlayofalloutputsignalscanbeplottedbythecommandoctave:1>plot(faustout);Veryofteninsignalprocessingweneedtoseethespectrumofthesignal:octave:1>plot(20*log10(abs(fft(faustout,1024))(1:512,:)));Inthisexample,thesignaliszero-paddedoutto1024samples,aFastFourierTransform(FFT)isperformed,therst512samplesareselected,theabsolutevalueistaken,followedbyconversiontodB,andnallythisdBspectralmagnitudeisplotted.
Iftherearemultipleoutputsignals,theirdB-magnitudespectraareallplottedoverlaid.
294.
5SummaryofFaustProgramTestingStrategiesThedevelopmentofaFaustprogramp.
dsp,say,typicallyconsistsofthefollowingsteps:>faustp.
dsp#doesitcompile>faust2firefoxp.
dsp#checktheblockdiagram>faust2octavep.
dsp#(maybe)inspecttheoutputsignal(s)inOctave>faust2jaqtp.
dsp#makeaJACK-compatibleapplicationTheseoperationsaresocommonthatIhaveshellaliasesf,f2ff,f2o,andf2jforthesecommands.
Morerecently,thersttwomaybereplacedbytheFaustEditor.
Thethird(f2o)istypicallyonlyusedforserioustesting,suchasforapublication.
305AddingaGUIToillustrateautomaticgenerationofuser-interfacecontrols,wewilladdtwo"numericentry"eldsandone"horizontalslider"toourexampleofFig.
5.
Thesecontrolswillallowtheapplicationorpluginusertovarythecenter-frequency,bandwidth,andpeakgainoftheconstant-peak-gainresonatorinrealtime.
Acompletelistingofcpgrui.
dsp("Constant-Peak-GainResonatorwithUserInterface")appearsinFig.
11.
declarename"Constant-Peak-GainResonator";declareauthor"JuliusSmith";declareversion"1.
0";declarelicense"GPL";/*Controls*/fr=nentry("frequency(Hz)",1000,20,20000,1);bw=nentry("bandwidth(Hz)",100,20,20000,10);g=hslider("peakgain",1,0,10,0.
01);/*Constants(FAUSTprovidestheseinmath.
lib)*/SR=fconstant(intfSamplingFreq,);PI=3.
1415926535897932385;/*Theresonator*/process=firpart:+~feedbackwith{R=exp(-PI*bw/SR);//poleradiusA=2*PI*fr/SR;//poleangle(radians)RR=R*R;firpart(x)=(x-x'')*g*(1-RR)/2;//time-domaincoefficientsASSUMINGONE-SAMPLEFEEDBACKDELAY:feedback(v)=0+2*R*cos(A)*v-RR*v';};Figure11:Listingofcpgrui.
dsp—aFaustprogramspecifyingaconstant-peak-gainresonatorwiththreeusercontrols.
Alsoshownaretypicalheaderdeclarations.
316GeneratingStand-AloneQtorGTKApplicationsThenextstepafterdebuggingaFaustprogramistypicallygeneratingthedesiredapplicationorplugin.
Forexample,>faust2jaqtp.
dsp#makeastandaloneJACK-compatibleQtapplication>faust2jackp.
dsp#makeastandaloneJACK-compatibleGTKapplicationwherep.
dspistheFaustprogramtobecompiled.
OntheMac,eachoftheabovecommandswouldcreatep.
app.
OnaLinuxsystem,thebinaryexecutableprogrampwouldbecreated.
faust2jaqtandfaust2jackareconveniencescriptsdistributedwithFaust.
20Ascreen-shotoftheQtmainwindow(obtainedusingGrab.
appontheMac)isshowninFig.
12.
Figure12:Main(andonly)windowofaQtapplicationgeneratedbyfaust2jaqtfromcpgrui.
dsponaMacOSXsystem.
Whentheapplicationisrun,itautomaticallybindsitsoutputstothesystemoutputifJACKisrunning(anditwillexitifJACKisnotrunning!
).
InaLinuxenvironment,itisnecessarytomanuallyconnecttheprogramoutputtothesystemaudiooutputs.
JACKmaybeconvenientlystartedonMacOSXusingJackPilot,andonLinuxsystemsusingqjackctl.
7GeneratingOtherApplicationsandPluginsThefaustcompilertranslatestheFaustlanguagetoC++.
Usingitsarchitectureles(writteninC++)andconveniencescripts(suchasfaust2jaqt),workingtests,applications,andpluginscanbequicklygeneratedfromFaustsource.
Abovewelookedatusingfaust2plot,faust2matlabplot,faust2firefox,faust2octave,faust2jaqt,andfaust2jackonasimpleexample.
Therearemanyothers.
Forthelatestlist,cdtothefaust/tools/faust2appls/directoryandlistitscontents.
Atthetimeofthiswriting(May2020),theresultisasfollows:20Theauthorhasveried(July2010)thatworkingQtapplicationsaregeneratedonbothMacOSXandFedora12Linuxsystems,andworkingGTKapplicationsaregeneratedonFedora12Linux.
32Directoryfaust/tools/faust2appls/Info.
plistfaust2firefoxfaust2octavefaust2svgviewerREADME.
mdfaust2genfaust2osxiosunityfaust2teensycheck-au.
shfaust2graphfaust2owlfaust2unityencoderunitypackagefaust2graphviewerfaust2paqtfaust2vstfaust2alqtfaust2iosfaust2pdffaust2vstifaust2alsafaust2jackfaust2plotfaust2w32max6faust2alsaconsolefaust2jackconsolefaust2pngfaust2w32mspfaust2androidfaust2jackrustfaust2portaudiorustfaust2w32puredatafaust2androidunityfaust2jackserverfaust2purefaust2w32vstfaust2apifaust2jaqtfaust2puredatafaust2w64max6faust2atomsnippetsfaust2jaqtchainfaust2raqtfaust2w64vstfaust2aufaust2jucefaust2rosfaust2wasmfaust2belafaust2ladspafaust2rosgtkfaust2webaudiowasmfaust2caqtfaust2linuxunityfaust2rpialsaconsolefaust2webaudiowastfaust2caqtiosfaust2lv2faust2rpinetjackconsolefaust2winunityfaust2csoundfaust2mathdocfaust2samfaustoptflagsfaust2csvplotfaust2mathviewerfaust2sigfaustpathfaust2dssifaust2max6faust2sigviewerfilename2identfaust2dummyfaust2mdfaust2smartkeybreadme-faust2au.
txtfaust2dummymemfaust2mspfaust2sndfileunsupportedfaust2epsfaust2netjackconsolefaust2soulusage.
shfaust2esp32faust2netjackqtfaust2supercolliderfaust2faustvstfaust2nodejsfaust2svgTheseshellscriptsareeasilyreadtondouthoweachoneworks.
Checkoutinparticulartheoptionssupported(eachscriptshouldaccepta-hoptionthatprintsoutasummaryofoptionssupported).
Additionalinformationisfoundinthefaust/examplesdirectory.
SeealsotheFaustLibrariesdocumentationsomewhereunderhttps://faust.
grame.
fr/.
218GeneratingaLADSPAPluginviaFaustLADSPAstandsfor"LinuxAudioDeveloperSimplePluginAPI",anditisacommonaudiopluginAPIforLinuxapplications.
[Note:LADSPAhasbeensupersededbyLV2,andthissectionshouldbeupdatedtoshowhowtocreatelv2pluginsinstead.
Seethefaust2lv2scriptfordetails.
It'snotsignicantlydierentatthislevel.
]ItcanbeconsideredtheLinuxcounterpartofthewidelyusedVSTpluginstandardforWindowsapplications.
InthePlanetCCRMAdistribution,mostoftheLADSPApluginsarefoundinthedirectory/usr/lib/ladspa/.
Atthetimeofthiswriting,thereare161audioplugins(.
soles)inorunderthatdirectory.
TogenerateaLADSPApluginfromFaustsource,itismerelynecessarytousetheladspa.
cpparchitecturele,asinthefollowingexample:21ItisinadvisabletopublishlinksintocontentwithintheFaustwebsite,evensomethingaslargeasthemanual,editor,orlibrarydocumentation,astheyfrequentlychangeincompatibly.
Fortunately,thelanguagerarelyhasanincompatiblechange.
33>faust-aladspa.
cppcpgrui.
dsp-ocpgruilp.
cpp>g++-fPIC-shared-O3\-Dmydsp='Constant_Peak_Gain_Resonator'\cpgruilp.
cpp-ocpgruilp.
so>cpcpgruilp.
so/usr/local/lib/ladspa/(Recallthatcpgrui.
dspwaslistedinFig.
11onpage31.
)WeseethattheC++compilationstepcallsfor"position-independentcode"(option-fPIC)anda"sharedobject"format(option-shared)inorderthatthelebedynamicallyloadablebyarunningprogram.
(Recallthatpdsimilarlyrequireditsexternalstobecompiled-shared.
)TheFaustdistributionprovidesthemakele/usr/lib/faust/Makefile.
ladspacompile(amongothers)whichdocumentssuchdetails.
ManyLinuxprogramssupportLADSPAprograms,suchasthesoundeditorAudacity,themultitrackaudiorecorder/mixerArdour,andthesequencerRosegarden.
However,forourexam-ple,we'lluseasimpleapplication-independentLADSPAeectsrackcalledJACKRack(select"Applications/PlanetCCRMA/Jack/JACKRack").
Figure13showstheappearanceofthejack-rackmainwindowafteradding22thepluginnamedConstantPeakGainResonator.
Notethatthetwonumericentryeldshavebeenconvertedtohorizontalsliders.
(Verticalslidersarealsoconvertedtohorizontal.
)Also,thecontrollernameshavebeensimplied.
Abugisthatthedefaultvaluesforthecontrolsarenotsetcorrectlywhenthepluginloads.
(TheyweresetmanuallytoobtainFig.
13asshown.
)Figure13:JACKRackscreenshotafteraddingtheLADSPApluginConstantPeakGainResonator.
AdditionalLADSPApluginscanbeloadedinthespacebelow(andconnectedinseries).
TotesttheLADSPAplugin,anyprogram'saudiooutputcanberoutedthroughjack-racktothesound-outdriver(typically"ALSAPCM"thesedays).
Forexample,pd'saudiooutputcanbe22Afterrunningjack-rack,theLADSPApluginwasaddedbyclickingonthemenuitems"Add/Uncategorised/C/ConstantPeakGainResonator".
Ifjack-rackdoesnotndthisorotherplugins,makesureyourLADSPAPATHenvironmentvariableisset.
Atypicalsettingwouldbe/usr/local/lib/ladspa/:/usr/lib/ladspa/.
34routedthroughjack-racktoalsapcmasshowninFig.
14.
23Figure14:JACKaudioconnectionsroutingpdthroughjack-racktotheALSAsound-outdriveralsapcm.
9FeedingSoundlestoFaustStandaloneAppsTheFauststandaloneappswehaveconsideredthusfarexpectsoundinputinrealtime,suchasfromyourcomputer'smicrophoneinput.
Sometimesitishandytobeabletofeedaprerecordedsoundleinstead.
BelowwewilldiscusstwoapproachestosoundleprocessinginFaust:1.
OineProcessing—anoutputsoundleiscreatedfromtheinputsoundleandnotime-varyingmanipulationofprocessingparametersispossible,muchlikewhenrunningsoxonasoundle.
2.
RealTimeProcessing—theinputsoundleisprocessedinrealtime,allowingparametermanipulationandaudiomonitoring.
9.
1OineProcessingofSoundlesinFaustIfyouhavetheFaustdistributionandlibsndfileinstalledonyourcomputer,thenyoucansimplysay>faust2sndfilemyprocessor.
dsp>myprocessorinput.
wavoutput.
wav23Soundroutingssuchasthismaybeaccomplishedusingthe"Connect"windowinqjackctl.
Inthatwindow,thereisanAudiotabandaMIDItab,andtheAudiotabisselectedbydefault.
Justclicktwicetoselectthedesiredsourceanddestinationandthenclick"Connect".
Suchconnectionscanbemadeautomaticbyclicking"Patchbay"intheqjackctlcontrolpanel,specifyingyourconnections,saving,thenclicking"Activate".
Connectionscanalsobeestablishedatthecommandlineusingaconnectfromthealsa-utilspackage(includedwithPlanetCCRMA).
35toproducesoundleoutput.
wavfrominput.
wavusingmyprocessor.
dsp.
Therstlineusestheshellscriptfaust2sndfile,normallyinstalledin/usr/local/bin/,tocreatethebinaryprogrammyprocessorfromFaustsource,andthesecondlinerunsmyprocessoroninput.
wav,writingtheprocessedsignaltooutput.
wav.
YoucanalsosetFaustparameters(suchasslidersandbuttons)onthecommandline,andgenerateasoundlewithnoinputle:>mysynth-duration1-gate1-gain0.
5-freq440output.
wavwhereofcoursemyprocessor.
dspdenestheseUIelements.
Notethattheparameternamesaremadelowercaseandhavespacesandsuchremoved;youcanndoutwhattheybecameusingthe-helpoption:>myprocessor-h***USAGE:myprocessorinput_sfileoutput_sfile.
.
.
-duration[0.
.
1]-gate[0.
.
1]-gain[0.
.
1]-freq[20.
.
10000]Thus,thenameofeachparameterisprintedalongwithitsrange.
Underthehood,thefaust2sndfilescriptusestheFaustarchitecturelesndfile.
cpp,whichinturnusesErikdeCastroLopo'slibsndfilelibrarytoprocessthechannelsofaninputsoundle,producingasingleoutputsoundlecontainingalloftheoutputchannelsignals.
Forexample,supposethelegain-stereo.
dspcontainstheone-lineFaustprogramprocess=*(0.
5),*(0.
5);ThenthefollowingcommandwillcompileittoC++:>faust-asndfile.
cppgain-stereo.
dsp>gain-stereo.
cppThelegain-stereo.
cppcontains#includewhichisinstalledwiththelibsndfiledistribution.
Themainfunctioningain-stereo.
cppisasfollows:intmain(intargc,char*argv[]){SNDFILE*in_sf;SNDFILE*out_sf;SF_INFOin_info;SF_INFOout_info;CMDUI*interface=newCMDUI(argc,argv);DSP.
buildUserInterface(interface);interface->process_command();36//openinputfilein_info.
format=0;in_sf=sf_open(interface->input_file(),SFM_READ,&in_info);if(in_sf==NULL){sf_perror(in_sf);exit(0);}//openoutputfileout_info=in_info;out_info.
format=in_info.
format;out_info.
channels=DSP.
getNumOutputs();out_sf=sf_open(interface->output_file(),SFM_WRITE,&out_info);if(out_sf==NULL){sf_perror(out_sf);exit(0);}//createseparatorandinterleaverSeparatorsep(kFrames,in_info.
channels,DSP.
getNumInputs());Interleaverilv(kFrames,DSP.
getNumOutputs(),DSP.
getNumOutputs());//initsignalprocessorDSP.
init(in_info.
samplerate);//DSP.
buildUserInterface(interface);interface->process_init();//processallsamplesintnbf;do{nbf=sf_readf_float(in_sf,sep.
input(),kFrames);sep.
separate();DSP.
compute(nbf,sep.
outputs(),ilv.
inputs());ilv.
interleave();sf_writef_float(out_sf,ilv.
output(),nbf);//sf_write_raw(out_sf,ilv.
output(),nbf);}while(nbf==kFrames);//closetheinputandoutputfilessf_close(in_sf);sf_close(out_sf);}Thus,afteropeningtheinputandoutputsoundles,thereisaloopovertimeframes(sampletimes).
24Foreachframe,theinterleavedinputchannelsarereadfromdiskbysfreadffloat()anddeinterleavedintoasetofseparatebuersbysep.
separate().
TheinputbuersareprocessedbyDSP.
computetoproduceoutputbuers,oneforeachoutputsignal.
Theoutputbuersaretheninterleavedbyilv.
interleave()andwrittentotheoutputsoundleondiskbysfwriteffloat().
Afteralltimeframeshavebeenprocessed,theinputandoutputsoundlesareclosed.
24Ateachtimesamplinginstant,thesetofaudiosamplesfromallchannelsiscalledaframe.
379.
2SoundleInputforStandaloneFaustApplicationsJACKstandaloneappsreadandwriteJACKportswhichareeasilyconnectedtootherJACK-compatiblesoundsources/sinksviaqjackctlinLinuxorJackPilotonaMac(see§8and§6forotherexamplesofusingJACKtoconnectaudiostreams).
Thus,tofeedasoundletoastandaloneFaustapp,runanyprogramthatcanoutputasoundleonaJACKport(suchaspd),andconnecttheprogramsJACKoutputportstotheFaustappinputportsusingtheconnect/routingGUIinterfaceofqjackctlorJackPilot.
ThefollowingconveniencescriptsaredistributedwithFaust:25faust2jack-makeaJACK-GTKstandaloneappfaust2jaqt-makeaJACK-Qtstandaloneappfaust2jackconsole-makeaJACKconsolestandaloneapp(nolocalGUI)9.
3SoundleInputforFaustPluginsEachpluginhosthasitsownsoundleinputfacilities.
Forexample,inSuperCollider,oneoftenreadsanentiresoundleintoaninstanceoftheBufferclassusingtheBuffer.
readmethod.
Similarly,pdhasasoundfilerobjectforreadingasoundleintoatableinmemory(see,forexample,thepdHelpBrowseratPureData/2.
audio.
examples/B07.
sampler.
pd).
Finally,typicalVSTpluginhostshaveextensivefacilitiesforreading,writing,andmanipulatingsoundclips,pluginparameters,andsoon.
10GeneratingaMIDISynthesizerforPDThefaust2puredatascripthasa-polyoptionforgeneratingaMIDIsynthesizerpluginforpd.
ThesynthhaseightvoicesandmanagesvoiceallocationwhenplayedfromMIDI.
Forthistowork,theFaustprogramshouldbewrittentosynthesizeonevoiceusingthefollowingthreestandardsynthesisparameters(whicharedrivenfromMIDIdatainthepdplugin):freq-frequencyoftheplayednote(Hz)gain-amplitudeoftheplayednote(0to1)gate-1while"keyisdown",0after"keyup"TheparametersfreqandgainaresetaccordingtoMIDInote-numberandvelocity,respectively,whilethegateparameterissetto1onaMIDI"note-on"andbacktozeroupon"note-o".
Theabstractionmidi-in.
pdreceivesanddecodesMIDIdatainpd.
Let'smakeasimple8-voicedMIDIsynthesizerbasedontheexampleFaustprogramcpgrs.
dsp("Constant-Peak-GainResonatorSynth")listedinFig.
15below.
CopythetextinFig.
15andsaveitinyourworkingdirectoryinalenamedcpgrs.
dsp.
Creatingapdsynthislikecreatingapdeectplugin,exceptthatthe-polyoptionisused:>faust2puredata-polycpgrs.
dspThiscreatesthelecpgrs.
pddarwininyourworkingdirectory.
25Additionallytherearefaust2jackinternalandfaust2jackserverwhicharebeyondthescopeofthistutorial.
38Ifyouseetheerror"mpd.
hlenotfound",youmaynothavePureDatainstalled.
Inadditiontoconvertingthefrequencyandamplitudeparameterstothestandardnamesfreqandgain,wehaveaddedaclassicADSRenvelopegenerator26(denedinFaust'senvelopes.
lible)whichusesournewgateparameter,andwhichaddsfournewenvelopeparametersattack,decay,sustain,andrelease.
Toseelower-leveldetailsofhowthepdpluginiscreated,readthefaust2puredatashellscript,typicallyinstalledin/usr/local/bin/fromfaust/tools/faust2appls/faust2puredata.
import("stdfaust.
lib");//defineen.
adsr,ma.
SR,ma.
PIdeclarename"Constant-Peak-GainResonatorSynth";declareauthor"JuliusSmith";declareversion"1.
0";declarelicense"GPL";/*Standardsynthcontrolssupportedbyfaust2pd*/freq=nentry("freq",440,20,20000,1);//Hzgain=nentry("gain",0.
1,0,1,0.
01);//fracgate=button("gate");//0/1/*UserControls*/bw=hslider("bandwidth(Hz)",100,20,20000,10);/*ADSRenvelopeparameters*/attack=hslider("attack",0.
01,0,1,0.
001);//secdecay=hslider("decay",0.
3,0,1,0.
001);//secsustain=hslider("sustain",0.
5,0,1,0.
01);//fracrelease=hslider("release",0.
2,0,1,0.
001);//sec/*Synth*/process=no.
noise*env*gain:filterwith{env=gate:vgroup("1-adsr",en.
adsr(attack,decay,sustain,release));filter=vgroup("2-filter",(firpart:+~feedback));R=exp(0-ma.
PI*bw/ma.
SR);//poleradiusA=2*ma.
PI*freq/ma.
SR;//poleangle(radians)RR=R*R;firpart(x)=(x-x'')*(1-RR)/2;//time-domaincoefficientsASSUMINGONE-SAMPLEFEEDBACKDELAY:feedback(v)=0+2*R*cos(A)*v-RR*v';};Figure15:Listingofcpgrs.
dsp—aFaustprogramspecifyingasimplesynthpatchconsistingofwhitenoisethroughaconstant-peak-gainresonator.
26TheAttack,Decay,Sustain,andRelease(ADSR)envelopeissaidtohavebeeninventedbyRobertMoogincollaborationwithcomposerHerbertDeutschinthe1960s.
3911MIDISynthesizerTestPatchTheexamplesynthisloadedintopdlikeanyplugin-wrapper.
Amanuallywrittentestpatch(cpgrshelp.
pd)isshowninFig.
16.
NotethatthestandardMIDI-synthcontrolparameters(freq,gain,gate)arehandledbehindthescenesanddonotappearamongthepluginGUIcontrols.
printbandwidth-Hzbandwidth-Hz200bandwidth-Hz300loadbangactive0active1;pddsp0;pddsp1dac~cpgrsattack0.
01decay0.
3release0.
2sustain0.
5bandwidth-Hz20midi-in80Figure16:Testpatchforthepdsynthplugincpgrs.
pdgeneratedbyfaust2pdbasedoncpgrs.
dspinFig.
15.
TodriveourMIDIsynth,weneedasourceofMIDIdata.
PerhapsthesimplestresourceforthispurposeistheVirtualKeyboard(vkeybd),whichisstandardinRedHatFedora,andintheplanetccrma-menusat"Applications/PlanetCCRMA/MIDI/Vkeybd").
Figure17showsascreenshotoftheVirtualKeyboardwithitskey-rangeandvelocitycontrollersdisplayed(menuitem"View/Key/Velocity").
Thevelocitycontrollersetsthegainparameter,mappingMIDIvelocity(0-127)totheunitinterval(0-1).
Thekey-rangecontrollertransposesthekeyboardbyoctaves.
Pressingakeydetermines,togetherwiththekey-range,thefreqparameterinoursynth.
Pressingakeyalsosetsthegateparameterto1,andreleasingitsetsgateto0.
TheADSRenvelopeistriggeredwhengatetransitionsto1,anditbeginsits"release"phasewhengatetransitionsto0,asisstandardforADSRenvelopestriggeredbyakeyboard.
NotethatthebottomtworowsofASCIIkeyboardkeysaremappedtovirtual-keyboardkeys,enablingtheplayingofchordsinrealtimeontheregularcomputerkeyboard.
40Figure17:TheVirtualKeyboard(MIDIsource).
Figure18illustratestheMIDItabofqjackctl'sConnectwindowafterconnectingtheVirtualKeyboardMIDIoutputtopd'sMIDIinput.
27Figure18:JACKMIDIconnectionsroutingMIDIfromtheVirtualKeyboard(vkeybd)topd'srstMIDIinputport.
ToplaybackaMIDIle(extension.
mid),anicewayistoopenitinRosegarden("Applications/PlanetCCRMA/Sequencers/Rosegarden")andconnectRosegarden'sMIDIoutputtopd'sMIDIinputasabove.
(YoucanstillplayalongontheVirtualKeyboard.
)12UsingFaustwithSuperColliderThissectiondescribesandillustratesmakingSuperCollider(SC)pluginsfromFaustsourceonLinuxandMacOSX.
(Windowsshouldalsowork.
)27PdmusthaveatleastoneMIDI-inputportdenedatstartupforthistowork.
Forexample,atypical~/.
pdrclemightcontainthefollowingstartupoptionsforpd:-jack-r48000-alsamidi-midiindev1-midioutdev1-audiooutdev1-outchannels2-path/usr/lib/pd/.
.
.
4112.
1GettingStartedwithSuperColliderThereaderisassumedtohaveworkedthrougharsttutorialonSuperCollider(SC).
Inparticular,the"GettingStartedwithSC"tutorialintheSuperColliderDocumentation28isagoodplacetobegin.
TheSCinstallationpageishttps://supercollider.
github.
io/download.
Afterabasicorientationviatutorials,theonlinedocumentationisexcellent.
Itcanbeeectivetoworkthroughvarioustutorialexamples,placingthecursor(inEmacs,e.
g.
)onaclassname,andtypingC-cC-htojumptotheclassdocumentation(Cmd-DintheMacapp),whichinturnreferstootherclassesandonlinetutorials,andsoon.
(Notethatsclangmustberunningforthistowork.
)FormoreonusingFaustwithSuperCollider,see[8].
Seethe"SuperColliderBook"[12]forintroductionstoandfullerpresentationofmanyaspectsofSC.
Whenyouarereadyforit,readthroughrelevantSCsourcecode(*.
sc).
Notethat"C-c:"inEmacswillgototheclassdenitionlewhentheeditingcursorisonthenameoftheclass.
Also,"C-c;"willlookupreferencestomethodsmarkedbythecursor.
Reading.
sccodewillrapidlygetyoucomfortablewithSCasageneral-purposeobject-orientedprogramminglanguage.
12.
2LinuxandFaust-GeneratedSuperColliderPluginsTheexamplesbelowwerelastfullytestedonaFedora1564-bitLinuxsystemrunningFaustversion0.
9.
43(on8/4/2011),andlaterupdatedbasedonemailfeedbackinMayof2020.
Ifanythingelseneedsupdating,pleaseletmeknowviaemail.
Theshellscriptfaust2supercollidercanbeusedtocreateaSuperCollider(SC)pluginfromaFaustsourcele:>faust2supercollidermysynth.
dspTheresultingclasslemysynth.
sc(thesclang"extension")andshared-objectlemysynth.
so(thescsynthorsupernova"plugin")canbecopiedfromthecurrentworkingdirectorytoyourSCextensionsdirectory,typicallyasfollowsonLinuxsystems:>mkdir-p~/share/SuperCollider/Extensions/Faust/>cpmysynth.
s[co]~/share/SuperCollider/Extensions/Faust/.
BelowwespeakofusingscsynthastheSuperCollidersound-synthesisserver,butsupernova,themorerecentmultithreadedgeneralizationofscsynth,shouldalsoworkinitsplace.
TotryouttheFaustexampleosc.
dsp,forexample,rstcopythegeneratedlesintoyourSCextensionsdirectory:cp/examples/supercolliderdir/osc.
s[co]~/share/SuperCollider/Extensions/FaustNext,restartsclangandscsynth,29andexecutethefollowingcodeinsclang:y={varout;out={FaustOsc.
ar(freq:100.
0,volume:-40.
0)}.
dup;}.
play(s)28http://doc.
sccode.
org29Afterrestartingsclang,theclassnameFaustOscwillbedened.
Inemacs,thisisindicatedbytypesettingitinthespecialcolorforknownclassnames.
Whenscsynthisstarted,youcanobtainaprintoutoftheline"Faust:oscnumControls=2"inthepostbuerwhenthemoduleisloaded,ifyouremove-DNDEBUGfromthecompileragsineitherfaust2supercolliderorMakefile.
sccompile.
42Youshouldhearasoftsinusoidatfrequency100Hz.
(Execute"y.
free;"whenyouaretiredoflisteningtoit,whichwilllikelybequitesoon.
)TheFaustOscclassintheleosc.
sccreatedbythemakeisasfollows:FaustOsc:UGen{*ar{|freq(1000.
0),volume(0.
0)|^this.
multiNew('audio',freq,volume)}*kr{|freq(1000.
0),volume(0.
0)|^this.
multiNew('control',freq,volume)}name{^"osc"}}Weseeforexamplethatthedefaultfrequencyandvolumeare1kHzand0dB,respectively.
AdaptingacoolexamplefromtheSuperColliderBook,wecancontroltheamplitudeandfrequencyoftheoscillatorwiththemouseasfollows:z={varout;out=(FaustOsc.
ar(MouseX.
kr(400,3000,\exponential),//freq(Hz)MouseY.
kr(-90,10,\linear)//amp(dB))*MouseButton.
kr).
dup;//gate=LEFTmousebutton}.
play(s);z.
free;12.
3MacOSXandFaust-GeneratedSuperColliderPluginsOntheMac,SuperCollider(SC)extensionsgointhedirectory~/Library/ApplicationSupport/SuperCollider/Extensionsinsteadof/share/SuperCollider/ExtensionsasonLinux.
AgainitisnicetoorganizeallFaust-generatedpluginsinaFaustsubdirectoryofExtensions.
ForanicecollectionofexampleSCplugins,seehttps://github.
com/supercollider/example-pluginsSincepre-builtversionsofSCfortheMacdonotseemtoincludetheheadersforcompilingplugins,youprobablyneedalsotodownloadtheSCsourceandsettheSUPERCOLLIDERHEADERSenvironmentvariabletopointintoit.
Forexample,atthetimeofthiswriting,thelateststableSCsourceisv3.
4.
4,soIhavesetenvSUPERCOLLIDER_HEADERS$HOME/sc-3.
4.
4/common/Headersinmy.
tcshrcle.
ForBourneshell(bash)users,addthelinesSUPERCOLLIDER_HEADERS=$HOME/sc-3.
4.
4/common/HeadersexportSUPERCOLLIDER_HEADERS43in/.
bashrc,etc.
Tocreatea32-bitplugininsteadofthedefault64-bitcase,copythefaust2supercolliderscriptandadd"-m32"attheendoftheSCFLAGSvariabletogetSCFLAGS="-DNO_LIBSNDFILE-DSC_DARWIN-bundle-m32"OnedierenceontheMacrelativetoLinuxisthatthemouse-controlledexampleoftheprevioussectionhasitsverticalaxisipped.
Thatis,ontheMac,thevolumegetslouderasthemousegoesdownonthescreen.
IfeitheroftheaboveFaustOscexamplesdoesnotworkoneitherLinuxortheMac,trycheckingoutthelatestgitFaustdistribution,asdescribedin§1.
1.
Thisdocumentisupdatedtostayinsyncwiththat(latest)version,asopposedtoanyparticularpriorFaustrelease.
ForsomeSuperColliderdoconmakingFaustUGens,seehttps://doc.
sccode.
org/Guides/WritingUGens.
ht13UsingFaustwithOpenSoundControl(OSC)FaustcontainssomeveryniceOpenSoundControl(OSC)supportfacilities[2,9].
OSC,whichcanbeviewedasageneralizedreplacementforMIDI,isoftenusedformessagingbetweenmusicapplications,evenacrossnetworks.
Itisused,forexample,asthecommunicationprotocolbetweentheSuperColliderclient(sclang)andserver(scsynth).
Itisalsotheprotocolofchoiceformessagesfromexternalcontrollers,suchasiOS/Androidapplicationsrunningontablets.
OSCusestheUserDatagramProtocol(UDP)tosendandreceivemessages.
UDPislikeTCP/IP(themoretypicalinternetmessageprotocol)exceptthatmessagedeliveryisnotguaran-teed.
Inotherwords,ifsomeprocessgetsbehindandamessageisdropped,nobodyworriesaboutit.
FaustOSCsupportmakesuseofthreeUDPportsforinput,output,anderrors.
BydefaultthesearetheUDPportsnumbered5510,5511,and5512,respectively;whennecessary,FaustwilltryhighernumbersuntilafreeUDPportisfound.
TosendanOSCmessagetosomeprocessonsomehostontheInternet,oneneedstoknowthehost'sIPaddress,theUDPportusedbytheprocessforreceiving,anda"namepath"(muchlikeaUNIXlepath)tothecontrolbeingaected.
Thepathstartswiththeapplicationnameandincludesallgroupnamesdowntothecontrolnameitself.
Forexample,inthezitarev1.
dspexamplebelow,thepathtothe"dry-wetmix"slideris/ZitaRev1/Output/DryWetMix,whereZitaRev1isthenameoftheapplication,OutputisacontrolgroupdenedintheFaustsource,andDryWetMixisthenameofthecontrolslideritselfwithintheOutputgroup.
Wewillusethreeshellsfortheexamplesbelow,eachinitsownTerminalwindow.
InWindow1,wewillrunaFauststandaloneJACKapplicationthatwillreceiveOSCmessagesonUDPport5510andrespondonport5511.
InWindow2,wewillrunoscdump(distributedwiththeliblopackage)toprintoutOSCmessageactivityonport5511.
InWindow3,wewillrunoscsend(alsofromliblo)tosendOSCmessagestoport5510,wheretheFaustJACKappislistening.
AnyresponsesfromtheappwillappearinWindow2.
SinceweareusingastandaloneJACKapplicationfortheseexamples,remembertostarttheJACKdaemonjackd(viaqjackctlonLinuxorJackPilotontheMac).
Ifyouforget,jackdwillbeautolaunchedwithdefaultsetupparametersfromyour/.
jackdrccongurationle.
Below,commentsandprogramprintoutareonlinesbeginningwith'#'.
InTerminalWindow1(applicationwindow):44>cd/examples/generator/>faust2jack-oscnoise.
dsp#Drilldownon/usr/local/bin/faust2jackanditsoutputtoseeallthecode"underthehood".
>.
/noise#Afterperhapssomedelay(especiallyifJACKisautolaunched),youshouldsee#.
.
.
#FaustOSCversion0.
91application'noise'isrunningonUDPports5510,5511,5512#.
.
.
TheUDPportnumbersareforinput,output,anderrormessages,respectively.
InTerminalWindow2(OSCdumpwindow):>oscdump5511#watchthisspaceforOSCmessagerepliesfromtheFaustJACKappInTerminalWindow3(OSCsendwindow):>oscsendlocalhost5510/\*s"hello"#Window2receivesthefollowing,aftersomesecondsofdelay:#/noisesiii"0.
0.
0.
0"551055115512Noticetheuseof's'toindicatethatastringfollows.
Notethat\*ispassedtooscsendas*.
Wearejustquotingittoavoidshelllenameexpansionhere.
OnRedHatFedora17Linux(liblov0.
26),say0inplaceoflocalhostabove.
Onaremotemachine,usetheserver-machine'sIPaddressinplaceoflocalhost.
>oscsendlocalhost5510/\*s"get"#Window2receivesthefollowing(immediately):#/noise/Volumefff0.
0000000.
0000001.
000000ThisprintoutsaysthereisoneparameterwhoseOSCaddresspathis'/noise/Volume'(casematters)anditscurrentvalueis0,minimumvalueis0,andmaximumvalueis1.
Let'ssetitto0.
1:>oscsendlocalhost5510/noise/Volumef0.
1#Nothingisechoed,solet'saskforthecurrentvalue:>oscsendlocalhost5510/noise/Volumes"get"#/noise/Volumefff0.
1000000.
0000001.
000000^C#Stopthenoiseappsothatthenextexamplecanuseport5510.
Itworked!
Noticetheuseof'f'toindicatethataoating-pointvaluefollows.
Ifwedidn'ttypecontrol-C(^C)toendtheprogram,thenextexamplewouldlistenforOSCmessagesonUDPport5513.
Thisisne,andbothprogramswouldworkinparallel(bothbeingconnectedtosystemoutputinJACK),butwewillkeeptooneexampleatatimehere.
Nowlet'smakeOSCJACKappsoutofsomemoreFaustexamplesandexercisethem:InWindow1:>cd/examples/dynamic/>#Mac:45>faust2jaqt-oscdistortion.
dsp>open.
/distortion.
app>#Linux:>faust2jack-oscdistortion.
dsp>.
/distortionIfWindow2isstillsetuprunningoscdumpasabove,weseeFausts"OSCversion1.
22-'CUBIC_NONLINEARITY_cubicnl'isrunningonUDPports5513,5511,5512,InWindow3:>oscsendlocalhost5510/\*s"hello"#/distortionsiii"0.
0.
0.
0"551055115512>oscsendlocalhost5510/\*s"get"#/distortion//SINE_WAVE_OSCILLATOR_oscrs//Amplitudefff-38.
299999-120.
00000010.
000000#/distortion//SINE_WAVE_OSCILLATOR_oscrs//Frequencyfff37.
5999981.
00000088.
000000#/distortion//SINE_WAVE_OSCILLATOR_oscrs//Portamentofff0.
8460000.
0000001.
000000#/distortion//CUBIC_NONLINEARITY_cubicnl//Bypassfff0.
0000000.
0000001.
000000#/distortion//CUBIC_NONLINEARITY_cubicnl//Drivefff0.
6300000.
0000001.
000000#/distortion//CUBIC_NONLINEARITY_cubicnl//Offsetfff0.
0000000.
0000001.
000000#/distortion//SPECTRUM_ANALYZER_CONTROLS/Level_Averaging_Timefff0.
5100000.
0000001.
000000#/distortion//SPECTRUM_ANALYZER_CONTROLS/Level_dB_Offsetfff18.
0000000.
000000100.
000000>oscsendlocalhost5510/distortion//CUBIC_NONLINEARITY_cubicnl//Drivef0.
9>oscsendlocalhost5510/distortion//CUBIC_NONLINEARITY_cubicnl//Drives"get"#/distortion//CUBIC_NONLINEARITY_cubicnl//Drivefff0.
9000000.
0000001.
000000andsoon.
NoticehowtheGUIgroupinggetsintothecontrolnamepath.
Theappearanceof//inthepathindicatesanunnamedgroup,whichcausesnoproblem.
Anattempttosetaparameteroutofrange(lessthan0orgreaterthan1inthiscase)resultsintheparameterbeingclippedtothelimit.
Here'sanotherexample(younowknowwhichwindowisbeinglisted):^C>cd/examples/reverb/>#Mac:>faust2jaqt-osczitaRev.
dsp>open.
/zitaRev.
app>#Linux:>faust2jack-osczitaRev.
dsp>.
/zitaRev#FaustOSCversionssssiii"0.
91""-""'Zita_Rev1'""isrunningonUDPports"551055115512>oscsendlocalhost5510/\*s"get"#/Zita_Rev1/Input/In_Delayfff24.
40000020.
000000100.
000000#/Zita_Rev1/Decay_Times_in_Bands_(see_tooltips)/LF_Xfff1000.
00000050.
0000001000.
000000#/Zita_Rev1/Decay_Times_in_Bands_(see_tooltips)/Low_RT60fff1.
8750001.
0000008.
000000#/Zita_Rev1/Decay_Times_in_Bands_(see_tooltips)/Mid_RT60fff1.
4550001.
0000008.
00000046#/Zita_Rev1/Decay_Times_in_Bands_(see_tooltips)/HF_Dampingfff10418.
0996091500.
00000023520.
000#/Zita_Rev1/RM_Peaking_Equalizer_1/Eq1_Freqfff1108.
90002440.
0000002500.
000000#/Zita_Rev1/RM_Peaking_Equalizer_1/Eq1_Levelfff11.
000000-15.
00000015.
000000#/Zita_Rev1/RM_Peaking_Equalizer_2/Eq2_Freqfff2474.
00000040.
0000002500.
000000#/Zita_Rev1/RM_Peaking_Equalizer_2/Eq2_Levelfff-0.
200000-15.
00000015.
000000#/Zita_Rev1/Output/Dry_Wet_Mixfff1.
000000-1.
0000001.
000000#/Zita_Rev1/Output/Levelfff14.
150000-70.
00000040.
000000Otherexamplesaresimilar.
Finally,let'smakeanOSCJACKappoutoftheFaust-STKpianoandtryitout:>cd/examples/physicalModeling/faust-stk/>#Mac:>faust2jaqt-oscpiano.
dsp>open.
/piano.
app>#Linux:>faust2jack-oscpiano.
dsp>.
/piano#FaustOSCversionssssiii"0.
91""-""'piano'""isrunningonUDPports"551055115512>oscsendlocalhost5510/\*s"get"#/piano/Basic_Parameters/freqfff440.
00000020.
00000020000.
000000#/piano/Basic_Parameters/gainfff1.
0000000.
0000001.
000000#/piano/Basic_Parameters/gatefff0.
0000000.
0000001.
000000#/piano/Physical_Parameters/Brightness_Factorfff0.
0000000.
0000001.
000000#/piano/Physical_Parameters/Detuning_Factorfff0.
1000000.
0000001.
000000#/piano/Physical_Parameters/Hammer_Hardnessfff0.
1000000.
0000001.
000000#/piano/Physical_Parameters/Stiffness_Factorfff0.
2800000.
0000001.
000000#/piano/Reverb/reverbGainfff0.
1370000.
0000001.
000000#/piano/Reverb/roomSizefff0.
7200000.
0100002.
000000#/piano/Spat/pan_anglefff0.
6000000.
0000001.
000000#/piano/Spat/spatial_widthfff0.
5000000.
0000001.
000000Aswithallsynthexamples,anoteisplayedonthepianopatchbysettingparametersasdesired(suchasfreq)andthensettingthegateparameterto1tostartthenote.
Settinggatebackto0startsthedecayphaseofthenote.
InpatcheswithADSRorASRenvelopes,gatetransitioningto1startstheAttackphase,whileatransitionto0startstheReleasephase,asistypicalinsynthesizersdrivenbyakeyboard.
ThebowedinstrumentisanexampleusinganADSRenvelope:^C>#(Makebowedlikepianoabove)>.
/bowed#FaustOSCversion0.
91application'bowed'isrunningonUDPports5510,5511,5512>oscsendlocalhost5510/\*s"get"#/bowed/Basic_Parameters/freqfff440.
00000020.
00000020000.
000000#/bowed/Basic_Parameters/gainfff1.
0000000.
0000001.
000000#/bowed/Basic_Parameters/gatefff0.
0000000.
0000001.
000000#/bowed/Envelopes_and_Vibrato/Envelope_Parameters/Envelope_Attackfff0.
0100000.
0000002.
000000#/bowed/Envelopes_and_Vibrato/Envelope_Parameters/Envelope_Decayfff0.
0500000.
0000002.
000000#/bowed/Envelopes_and_Vibrato/Envelope_Parameters/Envelope_Releasefff0.
1000000.
0000002.
000000#/bowed/Envelopes_and_Vibrato/Vibrato_Parameters/Vibrato_Attackfff0.
5000000.
0000002.
000000#/bowed/Envelopes_and_Vibrato/Vibrato_Parameters/Vibrato_Beginfff0.
0500000.
0000002.
00000047#/bowed/Envelopes_and_Vibrato/Vibrato_Parameters/Vibrato_Freqfff6.
0000001.
00000015.
000000#/bowed/Envelopes_and_Vibrato/Vibrato_Parameters/Vibrato_Gainfff0.
0100000.
0000001.
000000#/bowed/Envelopes_and_Vibrato/Vibrato_Parameters/Vibrato_Releasefff0.
0100000.
0000002.
000000#/bowed/Physical_and_Nonlinearity/Nonlinear_Filter_Parameters/Modulation_Frequencyfff220.
000000#/bowed/Physical_and_Nonlinearity/Nonlinear_Filter_Parameters/Modulation_Typefff0.
0000000.
0000#/bowed/Physical_and_Nonlinearity/Nonlinear_Filter_Parameters/Nonlinearityfff0.
0000000.
000000#/bowed/Physical_and_Nonlinearity/Nonlinear_Filter_Parameters/Nonlinearity_Attackfff0.
1000000.
#/bowed/Physical_and_Nonlinearity/Physical_Parameters/Bow_Positionfff0.
7000000.
0100001.
000000#/bowed/Physical_and_Nonlinearity/Physical_Parameters/Bow_Pressurefff0.
7500000.
0000001.
000000#/bowed/Reverb/reverbGainfff0.
1370000.
0000001.
000000#/bowed/Reverb/roomSizefff0.
7200000.
0100002.
000000#/bowed/Spat/pan_anglefff0.
6000000.
0000001.
000000#/bowed/Spat/spatial_widthfff0.
5000000.
0000001.
000000TherearemanymoreexamplesandFaust-STKexamplestolookinto.
Thisisjustastart.
OSCAliasesSeetheFaustOSCdocumentation(Section6.
8)intheFaustQuickReference,30formoreadvancedtechniquessuchastheuseofOSCaliaseswhichallowarbitraryOSCmessages31tobemappedtocontrollerparameters(forusewithremotecontrollerssuchasTouchOSConAndroidthatcanonlytransmitpredenedmessages).
TheFaustOSCdocumentationprovidesadditionalinformation.
14ConclusionsInsummary,writingsignalprocessingapplicationsintheFaustlanguageisrewardinginseveralrespects.
First,thelanguageishigh-level,yetitcompilestoecientC++code.
Thedevelopmentcycleisveryshort,typicallyinvolvingonly(1)syntaxdebugging,(2)block-diagraminspection,and(3)tryingouttheapp/plugin.
Whenprecisevericationisrequired,theoutputsignalscanbeprintedorloadedintoMatlab/Octavefordetailedanalysis.
Finally,writinginFaustmakesitveryeasytogenerateapplicationsandpluginsforawiderangeofhostingenvironments.
30https://github.
com/grame-cncm/faust/blob/master-dev/documentation/faust-quick-reference.
pdf31Example:vslider("Volume[osc:/1/fader1]",0,0,1,0.
1)willmaptheOSCpath/1/fader1tothisVol-umeslider.
48AAppendixA:State-SpaceModelstoFaustAdigitalstate-spacemodelisnormallywrittenmathematicallyasy(n)=Cx(n)+Du(n)x(n+1)=Ax(n)+Bu(n)wherex(n)∈RN=statevectorattimenu(n)=p*1vectorofinputsy(n)=q*1outputvectorA=N*NstatetransitionmatrixB=N*pinputcoecientmatrixC=q*NoutputcoecientmatrixD=q*pdirectpathcoecientmatrixThematricesB,CandDmakeupthefeedforwardpart,whileAisthefeedbackpart.
Notethatallfourmatricesmaychangeeachsampleinstantntoimplementageneraltime-varyinglinearsystem.
AFaustexampleforthegenerallinearstate-spacemodelisshowninFig.
19.
TheFaust-generatedblockdiagramisshowninFig.
20.
Sinceastate-spacemodelcanimplementanyNth-orderlinearsystemwithpinputsandqoutputs,allwehavetodoiscomeupwiththe(A,B,C,D)matrixentriesandusethegeneralstate-spaceformulationinFaustgiveninFig.
19.
Herearethestepsforndingthestate-spacematrices:1.
Labeleachdelayelementasastatevariablexi.
Delaylinescanbetreatedasone"generalizeddelay"(FeedbackDelayNetworksareoftenwrittenthisway).
Intermsofthemathematicaldescriptionabove,theithdelayinputisxi(n+1),andtheoutputisxi(n).
2.
Bytracingconnectionsintheblockdiagram,writexi(n+1)asalinearcombinationofeitherinputsu(n)orstatesx(n)foreachi=1,2,N.
PlacethesecoecientswheretheygointheithrowofB(forinputs)andA(forstates),andenterzerosforinputsandstatesnotneededtocreatexi(n+1).
3.
Nowdothesameforeachoutputyi(n),i=1,q,whichissimilarlyalinearcombinationofinputsand/orstates.
UsethesecoecientstopopulatetheithrowofD(forinputs)andC(forstates).
4.
Nowyou'velledyour(A,B,C,D)matrices,sotheycanbepluggedintoFaustcodebasedonFig.
19.
Asimpleexamplefortryingoutandcheckingthisprocesscanbefoundbystartingatstep3of"ConvertingtoState-SpaceFormbyHand"[11].
32Thedetailsappearbelowin§A.
1.
Alsobeawareofthematlabfunctiontf2ssforconvertingatransferfunctiontostate-spaceform.
32https://ccrma.
stanford.
edu/~jos/StateSpace/ConvertingStateSpaceFormHand.
html49//GeneralLinearState-SpaceModelExampleimport("stdfaust.
lib");p=2;//numberofinputsq=3;//numberofoutputsN=5;//numberofstatesA=matrix(N,N);//statetransitionmatrixB=matrix(N,p);//input-to-statesmatrixC=matrix(q,N);//states-to-outputmatrixD=matrix(q,p);//direct-termmatrix,bypassingstatematrix(M,N)=tgroup("Matrix:%Mx%N",par(in,N,_)si.
bus(N);//vectorsumoftwoN-vectorsimpulse=1-1';//Forzeroinitialstate,setimpulse=0orsimplifycodex0=par(i,N,i*impulse);//initialstate=(0,1,2,3,.
.
.
,N-1)system=si.
bus(p)si.
bus(q);process=system;Figure19:Faustexampleillustratingageneralstate-spacemodelhaving2inputs,3outputs,and5statevariables.
DBdAx0CprocessFigure20:State-spacemodelinFausthaving2inputs,3outputs,and5statevariables.
50A.
1State-SpaceBiQuadinFaustTheblockdiagramofageneralBiQuadltersectionrealizedinDirectFormIIisshowninFig.
21[10].
33u(n)a2y(n)x1(n)x2(n)b1b2x1(n+1)b0a1z1z1Figure21:Direct-Form-IIimplementationofa2nd-orderltersection,withstatevariableslabeledasthedelayoutputsx1(n)andx2(n).
Fromthisdiagram,wendthestate-spacematricestobeA=a1a210B=10C=b1b0a1b2b0a2D=[b0]TheFaustcodeforthestate-spacerealizationofaspecicresonatorisshowninFig.
22.
33https://ccrma.
stanford.
edu/~jos/filters/DirectFormII.
html51//State-SpaceBiQuadExampleimport("stdfaust.
lib");process=tpss;//state-spaceform//process=tpdirect;//directform//Testtocompareoutputsofthetwo://process=1-1'si.
bus(M);A=matrix(N,N,a);B=matrix(N,p,b);C=matrix(q,N,c);D=matrix(q,p,d);Bd=par(i,p,mem):B;//inputdelayneededforconventionaldefinitionvsum(N)=si.
bus(2*N):>si.
bus(N);//vectorsumoftwoN-vectorstpss=si.
bus(p)si.
bus(q);Figure22:Fauststate-spaceBiQuadlter,comparingtodirectform.
52References[1]E.
BerdahlandJ.
O.
Smith,"Anintroductiontothesynth-a-modelercompiler:Modularandopen-sourcesoundsynthesisusingphysicalmodels,"inProceedingsofthe10thInternationalLinuxAudioConference(LAC-12),CCRMA,Stanford,http://lac.
linuxaudio.
org/,2012,paper:http://lac.
linuxaudio.
org/2012/papers/34.
pdf,software:http://github.
com/eberdahl/SaM.
git.
[2]D.
Fober,Y.
Orlarey,andS.
Letz,"FaustarchitecturesdesignandOSCsupport,"inProceedingsofthe14thInternationalConferenceonDigitalAudioEects(DAFx-11),Paris,France,September19–23,2011.
[3]E.
GaudrainandY.
Orlarey,"AFausttutorial,"Sept.
2007,Seehttps://www.
grame.
fr.
[4]A.
Gr¨af,"InterfacingPureDatawithFaust,"inProceedingsofthe5thInternationalLinuxAudioConference(LAC-07),TUBerlin,http://www.
kgw.
tu-berlin.
de/~lac2007/proceedings.
shtml,2007.
[5]A.
Gr¨af,"TermrewritingextensionfortheFaustprogramminglanguage,"inProceedingsofthe8thInternationalLinuxAudioConference(LAC-10),Utrecht,http://lac.
linuxaudio.
org/,2010,http://lac.
linuxaudio.
org/2010/papers/30.
pdf.
[6]P.
Hudak,"Conception,evolution,andapplicationoffunctionalprogramminglanguages,"ACMComputingSurveys,vol.
21,pp.
359–411,Sept.
1989,Availablewithoutfeefornoncommercialuse:https://ccrma.
stanford.
edu/~jos/pdf/FunctionalProgramming-p359-hudak.
pdf.
[7]Y.
Orlarey,D.
Fober,andS.
Letz,"SyntacticalandsemanticalaspectsofFaust,"SoftComputing,vol.
8,no.
9,pp.
623–632,2004.
[8]Y.
Orlarey,A.
Gr¨af,andS.
Kersten,"DSPprogrammingwithFaust,QandSuperCollider,"inProceedingsofthe4thInternationalLinuxAudioConference(LAC2006),ZKMKarlsruhe,http://lac.
zkm.
de/2006/proceedings.
shtml,pp.
39–40,2006,http://lac.
zkm.
de/2006/proceedings.
shtml#orlareyetal.
[9]A.
Schmeder,A.
Freed,andD.
Wessel,"Bestpracticesforopensoundcontrol,"inLinuxAudioConference,(Utrecht,NL),01/05/20102010.
[10]J.
O.
Smith,IntroductiontoDigitalFilterswithAudioApplications,https://ccrma.
stanford.
edu/~jos/filters/,Sept.
2007,onlinebook.
[11]J.
O.
Smith,PhysicalAudioSignalProcessing,https://ccrma.
stanford.
edu/~jos/pasp/,Dec.
2010,onlinebook.
[12]S.
Wilson,N.
Collins,andD.
Cottle,eds.
,TheSuperColliderBook,Cambridge,MA:MITPress,2011.
53
提速啦的来历提速啦是 网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑提速啦的市场定位提速啦主要代理市场稳定速度的云服务器产品,避免新手购买云服务器的时候众多商家不知道如何选择,妮妮云就帮你选择好了产品,无需承担购买风险,不用担心出现被跑路 被诈骗的情况。提速啦的售后保证提速啦退款 通过于合作商的友好协商,云服务器提供3天内全额退款,超过3天不退款 物理机部分支持当天全额退款提速啦提现 充...
木木云怎么样?木木云品牌成立于18年,此为贵州木木云科技有限公司旗下新运营高端的服务器的平台,目前已上线美国中部大盘鸡,母鸡采用E5-267X系列,硬盘全部组成阵列。目前,木木云美国vps进行了优惠促销,1核1G/500M带宽/1T硬盘/4T流量,仅35元/月。点击进入:木木云官方网站地址木木云优惠码:提供了一个您专用的优惠码: yuntue目前我们有如下产品套餐:DV型 1H 1G 500M带宽...
iON Cloud怎么样?iON Cloud是Krypt旗下的云服务器品牌,成立于2019年,是美国老牌机房(1998~)krypt旗下的VPS云服务器品牌,主打国外VPS云服务器业务,均采用KVM架构,整体性能配置较高,云服务器产品质量靠谱,在线率高,国内直连线路,适合建站等用途,支付宝、微信付款购买。支持Windows server 2012、2016、2019中英文版本以及主流Linux发行...
fedora15为你推荐
sherylsandbergLean In是一个怎样的组织比肩工场比肩之意是什么意思www.jjwxc.net有那个网站可以看书?www.jjwxc.net晋江文学网 的网址是什么?www.se333se.com米奇网www.qvod333.com 看电影的效果好不?抓站工具抓鸡要什么工具?sodu.tw台湾的可以看小说的网站www.175qq.com求带名字的情侣网名!www.qqq147.comhttp://www.qq官人放题戴望舒的《狱中题壁》
厦门域名注册 私服服务器租用 韩国vps俄罗斯美女 国外vps租用 lnmp sugarhosts 服务器配置技术网 便宜服务器 php主机 512au web服务器架设软件 个人免费空间 789电视网 t云 吉林铁通 外贸空间 vul 帽子云排名 photobucket 防cc攻击 更多