Where can I find details on object expressions?

Discussion and feedback on Construct 2

Post » Mon Jun 17, 2013 9:45 pm

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!
B
14
S
4
G
1
Posts: 13
Reputation: 1,561

Post » Mon Jun 17, 2013 11:22 pm

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,311
Reputation: 71,086

Post » Tue Jun 18, 2013 12:09 pm

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?
B
14
S
4
G
1
Posts: 13
Reputation: 1,561

Post » Tue Jun 18, 2013 1:08 pm

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.
Image ImageImage
B
171
S
50
G
179
Posts: 8,392
Reputation: 113,478

Post » Tue Jun 18, 2013 1:13 pm

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.
B
14
S
4
G
1
Posts: 13
Reputation: 1,561

Post » Tue Jun 18, 2013 1:47 pm

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.
Scirra Founder
B
399
S
236
G
89
Posts: 24,535
Reputation: 195,412

Post » Tue Jun 18, 2013 3:32 pm

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!)EleBriscoe2013-06-18 15:36:44
B
14
S
4
G
1
Posts: 13
Reputation: 1,561


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 15 guests