Where can I find details on object expressions?

0 favourites
  • 7 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I'm sure I am missing something here, but...

    Construct 2 has lots of internal functions / object expressions which can be accessed, however I can't find detailed help anywhere about the internal parameters of the object expressions from the plug-ins section.

    For example, let's take the expression 'AnalyserFreqBinAt', which isn't exactly intuitive! There are examples which help a bit, and you can access the expressions panel when creating an action, but the most I can extract about the usage are the name of the parameters: Audio.AnalyserFreqBinAt(Tag, Index, Bin).

    The manual doesn't mention the parameters either, and just gives the following explanation: "Get the magnitude of an analyser's Nth frequency bin. Advanced audio must be supported, and an analyser effect already added to a tag."

    How I am supposed to know what Tag, Index and Bin stand for, what is their range, what kind of variables are them? I'm sorry if it is already covered and the answer is right in front of me, but I couldn't find a handy and comprehensive command reference anywhere if not for the system expressions.

    Thanks everyone!

  • There is an "Audio analyser.capx" file in the examples folder shipped with C2 that gives more explanations as well as commented code about this advanced audio feature.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Kyatric, that specific function was an example, but all the functions from the plug-in objects come without explanations about the internal parameter.

    Also, the example about the analyser gives some insight but you have to guess the most out of it.

    Are we supposed to guess on all of them?

  • Some of those terms are fairly common, and its probably expected that the user would either know them, or at least be able to get some idea as to the usage from the context.

    Index for example is a numerical value that goes in order from zero up, and is often used to distinguish multiple items from each other.

    Tag on the other hand is a generic term often used in html as a label that a user can give to an object giving them the ability to reference that object by name later on. Here it is used by the Audio object to name a sound.

    Im not sure what bin means here, but you can be fairly sure its a number, and can be used with some experimentation.

  • It's just that in the languages I've used in the past I'm familiar with a comprehensive command reference which details every parameter. I just took this expression as an example, but there are hundreds which aren't described and it requires a lot of unnecessary tinkering if the only way is trial and error.

  • Every single expression in Construct 2 should have at least a brief description in the manual. There are definitely should not be hundreds which are missing. Could you list any you find that are missing so we can review them?

    The Audio object is probably a little different in that it assumes some knowledge of digital audio. It's not really the manual's place to teach you how FFTs work, what frequency bins are, what the trade-off between FFT size and frequency resolution is, etc. It's a big and complex subject and there are many places to learn about that, so the manual entry simply skips it. You're right that those specific expressions were a little too brief, so I've edited the manual entry to try and make it clearer. Again if you find any other parts of the documentation you think ought to be clearer, let us know and we can try to improve it.

    With the Audio object, you play sounds with a tag, e.g. "gunfire" or "music". You can add effects to a tag, so the effect only changes the sounds with that tag. You can add multiple effects to a tag, so each tag has a list of effects. And then the analyser returns a frequency domain analysis of the audio, which is a list of "frequency bins" (a standard audio term) with values representing the magnitude of energy over that frequency range. Therefore the "Tag" is the tag of the audio you added the analyser to, the "Index" is the index of the effect in the list, and "Bin" is the number of the frequency bin to retrieve from.

  • I'm sorry, I certainly got carried away!

    Most of the object expressions do not have internal parameters and don't need detailed descriptions, but I'm confused when I read the commands without the parameters among with a variable type, I.E. "AnalyserFreqBinAt" instead of "AnalyserFreqBinAt(Tag, Index, Bin)" or even better "AnalyserFreqBinAt(Tag$, Index, Bin)", expecially when the description also do not tell the range of values which Bin returns.(anyway, kudos as I'm just amazed at how steadily features get added and how solid the releases are, and the fast update to the command reference from my still very newbie input just shows the dedication!)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)