Nice ! So I started a page here : https://github.com/grame-cncm/faustdoc/blob/master/src/tutorials/unity.md, then you can possibly fork the https://github.com/grame-cncm/faustdoc project and do Pull Request to add new content? At the end I can generate the final result, to be seen here: https://faustdoc.grame.fr
Stéphane > Le 1 nov. 2021 à 12:19, PARKER Martin <martin.par...@ed.ac.uk> a écrit : > > HI Stéphane, I like the idea of that. I have a draft of a tutorial here, made > for my students. It's not really ready to share with the Faust community as > it was made to support an in-person lecture so there is lots of detail > missing, but I'd be glad to help down the line with a tutorial. Github looks > like a good place to start... > > https://tinparkblog.blot.im/adapting-in-a-large-open-space-by-james-tenney-for-unity-game-engine > > Adapting In a large open space by James Tenney for Unity Game Engine - > tinparkBlog > Latest posts Install FFMPEG Using TEAMS for teaching and tutoring denoising > your home recordings pushToBlot - p2b.sh The sound of the Corona Spring In > the field, on the street randomising soundfile playing listening to film > Adapting In a large open space by James Tenney for Unity Game Engine > mpAmbiDecoder some examples instructions - academic writing in markdown > tinparkblog.blot.im > > > Best > Martin~ > > --- > Dr Martin Parker > Head of the Reid School of Music > Programme Director MSc Sound Design > --- > For Students and Tutees requesting urgent support. > If you require emergency advice or assistance out-with the University > operational hours of Monday-Friday 9am-5pm, we advise you to refer to the > contacts below: > · Crisis Support relating to Mental Health. Edinburgh Crisis Centre Free 0808 > 801 0414. Text: 07974429075 E: cri...@edinburghcrisiscentre.org.uk > · Mental Health Assessment Service – Royal Edinburgh : 0131 537 6000 > · University Security 24/7 Out of Hours Support Daily: 0131 650 2257 > · UoE Accommodation Security team: 651 2001 > · Police: 999 > If you are not in the UK and need mental health support urgently you can look > up crisis lines in your country through Befrienders > Worldwide:https://www.befrienders.org/ > - Details of further sources of support: > www.ed.ac.uk/contacts/out-of-hours-support > ______________ > Contact details for Martin Parker: > Reid School of Music > Edinburgh College of Art > University of Edinburgh > > +44(0)7813 217092 > +44(0)131 650 2333 > skype: tinpark > > Room 3.07 > Alison House > 12 Nicolson Square > Edinburgh, EH8 9DF > Scotland, UK > > map: > https://goo.gl/maps/trpjm55HiorwpreWA > > www.soundeducation.net > www.tinpark.com > > > > From: Stéphane Letz <l...@grame.fr> > Sent: 01 November 2021 11:15 > To: PARKER Martin <martin.par...@ed.ac.uk> > Cc: faudiostream-users@lists.sourceforge.net > <faudiostream-users@lists.sourceforge.net> > Subject: Re: [Faudiostream-users] Unity mono vs. stereo with pm instruments > > This email was sent to you by someone outside the University. > You should only click on links or attachments if you are certain that the > email is genuine and the content is safe. > > I started a «Faust and Unity » discussion here : > https://github.com/grame-cncm/faust/discussions/671 > > hoping the discussion and content can be moving there, until we get enough > content to create « Faust and Unity » tutorial? > > Stéphane > > > Le 1 nov. 2021 à 11:22, PARKER Martin <martin.par...@ed.ac.uk> a écrit : > > > > HI Rob, to get Unity's native spatialization to work on a Faust plugin in > > Unity, the following may help: > > > > • IN UNITY: On the AudioSource place a .wav file to play on a loop, > > on load. This wav file should have all sample values set to 1. Try this > > one:https://www.dropbox.com/s/dpc4mda051qmiyo/all1.wav?dl=0 Add your > > FaustPlugin to the game object with the audiosource on it and Unity's > > spatialisation parameters will be multiplied by the .wav file and fed into > > your Faust Plugin. > > > > • The Faust code needs something like the following at the process > > stage. In the IDE it will be silent, but in Unity, it will be multiplied by > > the house spatialisation. > > import("stdfaust.lib"); > > > > vol = hslider("volume [unit:dB]", -24, -96, 0, 0.1) : ba.db2linear : > > si.smoo ; > > freq = hslider("freq [unit:Hz]", 1000, 20, 24000, 1) : si.smoo ; > > > > process(in1,in2,in3,in4,in5,in6) = vgroup("Oscillator", os.osci(freq) * > > vol) <: (_*in1,_*in2,_*in3,_*in4,_*in5,_*in6); > > > > > > This will make your plugin surround panning ready in the Unity environment > > but if you're not going six channels, you can just process inputs 1 and 2. > > > > Good luck > > Best > > Martin~ > > > > From: Alberto Boem <boem.albe...@gmail.com> > > Sent: 01 November 2021 07:18 > > To: Rob Hamilton <robert.k.hamil...@gmail.com> > > Cc: faudiostream-users@lists.sourceforge.net > > <faudiostream-users@lists.sourceforge.net> > > Subject: Re: [Faudiostream-users] Unity mono vs. stereo with pm instruments > > > > This email was sent to you by someone outside the University. > > You should only click on links or attachments if you are certain that the > > email is genuine and the content is safe. > > Hi Rob, sorry I might have misunderstood your question. > > But somehow the problem you encountered seems unavoidable. > > > > I never actually encountered it before, because I never used panning in > > Unity. with Faust plugins...I always did in the way I suggested you :) > > > > Mostly -I think- comes down to how audio is generated and managed in Unity. > > Basically, the Faust plugin will fill an OnAudioFilterRead() which is the > > way you usually go for implementing custom DSP in Unity (aka > > filters/effects). > > > > Somehow (but I am far from an expert) when you create an > > OnAudioFilterRead() this will basically take over the functionalities of > > the Audio Source. > > Even if Pitch and Volume can be applied to the generated sound, this seems > > not to be the case for stereo panning. > > That's why, usually, you will need to make the panning yourself inside the > > OnAudioFilterRead(). > > > > I used Faust in projects for Oculus Quest, Hololens and nReal. If you use > > some sound spatializer plugins (such as the one from Oculus or the one from > > Microsoft or Steam Audio), usually they somehow fix the problem (sometimes > > you need to add a dummy audio file in the AudioClip of the Audio Source) > > > > I think who developed this > > https://github.com/LibPdIntegration/LibPdIntegration/wiki/spatialisation > > found an interesting way to deal with such a problem. > > Maybe it can be adapted in a similar way in Faust. > > > > > > Il giorno lun 1 nov 2021 alle ore 01:18 Rob Hamilton > > <robert.k.hamil...@gmail.com> ha scritto: > > Thanks for the speedy and helpful reply Alberto. > > > > I tested this example splitting the signal in two (which still resulted in > > audio in both channels regardless of Unity panners), but adding the > > left/right parameterization on those outputs allows me to separately adjust > > channel levels in Unity. > > > > As for replacing sliders with just numerical inputs, I built the example > > pasted below, but Unity throws an error within the associated > > FaustUtilities_ script, seemingly looking for UI elements: > > > > if (!FaustUI.fJSONParser(ref fJSON, out fUI)) { // Parses the JSON file > > UnityEngine.Debug.LogError("Error JSON Parser"); > > } > > > > Does violinModel by default require UI elements, even if sliders and the > > like aren't specified in the FAUST declaration? Or is the manner I declared > > it below confusing things... > > > > Again, any suggestions or guidances are extremely helpful. > > > > ------------- > > > > TEST SCRIPT (ATTEMPTING TO REMOVE UI ELEMENTS): > > > > import("stdfaust.lib"); > > > > my_violin= pm.violinModel(stringLength,bowPress,bowVel,bowPos)*outGain > > with{ > > stringLength = 0; > > bowVel = 0; > > bowPress = 0; > > bowPos = 0; > > outGain = 0; > > }; > > > > left = 0; > > right = 0; > > > > process = my_violin <: _ * left ,_ * right; > > > > > > > > On Sun, Oct 31, 2021 at 2:25 AM Alberto Boem <boem.albe...@gmail.com> wrote: > > Hi Rob, > > > > I think you need to specify this in your Faust code. > > > > Have you considered doing this for splitting the signal in two? > > > > process = my_violin_ui <: _,_; > > > > https://faustdoc.grame.fr/manual/syntax/#split-composition > > > > and maybe: > > > > left = hslider("[0]left",0,0,1,0.1); > > right = hslider("[0] right",0,0,1,0.1); > > > > process = my_violin_ui <: _ * left ,_ * right; > > > > in this way, you should gain control of the two channels separately. > > > > Or maybe, try to look at the example spat/panpot.dsp in the "Examples" of > > the Faust IDE. > > > > > > As a small suggestion. > > Sometimes I found that if you need to export a .dsp file as a unity plugin > > it is better to get rid of the UI elements of Faust. Replacing sliders with > > just numerical inputs seems to make everything more smooth and easier to > > process for Unity. > > > > Il giorno dom 31 ott 2021 alle ore 11:19 Rob Hamilton > > <robert.k.hamil...@gmail.com> ha scritto: > > Hi all, > > > > Long time fan, first time caller. > > > > I'm playing with some Faust violins in a Unity project and am unsure as to > > what I should expect to hear in terms of spatialization for the output I'm > > getting. With a simple violinModel ui example such as listed below (thanks > > 250A) loaded into a 2-dimensional unity scene, I seem to get two channels > > of audio, which show no consideration of the Unity AudioSource "Stereo Pan" > > parameter, either adjusted manually in the IDE or in code. For a standard > > mono wav asset, this would pan the single channel left to right (-1 to 1), > > and for a standard stereo wav asset this would increase/decrease the volume > > of channels 0 or 1 respectively. > > > > In the online Faust ide for this example, I can see that two channels are > > generated, so I assume stereo output. But the plugin output doesn't act as > > a stereo asset would. Or am I missing something (I assume the latter). > > > > I've tested routing these through Unity Mixer groups and can see audio > > level data in both channels too, so I'm sure it's not my home audio rig. > > And this is for a simple 2D project, no 3D spatialization, so I have > > Unity's "Spatial Blend" Audio Source parameter set to 2D (which then > > ignores the roll-off settings). > > > > Any suggestions would be great. > > > > thanks! > > > > Rob > > > > ***** CODE EXAMPLE ***** > > > > import("stdfaust.lib"); > > > > my_violin_ui > > = pm.violinModel(stringLength,bowPress,bowVel,bowPos)*outGain > > > > with{ > > stringLength > > = hslider("v:violin/v:[0]string/[0]length[midi: ctrl 72]",0.75,0,2,0.01) : > > si.smoo; > > > > bowVel > > = hslider("v:violin/v:[1]bow/[0]velocity[midi: ctrl 71]",0,0,1,0.01) : > > si.smoo; > > > > bowPress > > = hslider("v:violin/v:[1]bow/[1]pressure[midi: ctrl 74]",0.5,0,1,0.01) : > > si.smoo; > > > > bowPos > > = hslider("v:violin/v:[1]bow/[2]position[midi: ctrl 73]",0.7,0,1,0.01) : > > si.smoo; > > > > outGain > > = hslider("v:violin/outGain",0.5,0,1,0.01); > > > > }; > > > > process = > > my_violin_ui; > > > > > > _______________________________________________ > > Faudiostream-users mailing list > > Faudiostream-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > > > > > > -- > > Robert Hamilton > > Center for Computer Research in Music and Acoustics (CCRMA) > > Stanford University > > http://ccrma.stanford.edu/~rob > > The University of Edinburgh is a charitable body, registered in Scotland, > > with registration number SC005336. Is e buidheann carthannais a th’ ann an > > Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336. > > _______________________________________________ > > 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