Is it possible to create an Oscillator?

For developers using the Construct 2 Javascript SDK

Post » Tue Feb 17, 2015 8:32 am

I posted a thread in the "How Do I.." section a couple days ago and got no replies on if there was a way to do this without digging into the SDK and creating my own plugin, but that seem to not be the case. I'm just starting to learn the SDK, but my real question is if this is even possible.

What I'd like to do is create a plugin that extends off of C2's Web Audio support to create an oscillator. I know how to create what I'm looking to achieve in Javascript, my problem however is implementing it into the plugin. I'd really appreciate some help or feedback on this.

Thanks!
B
13
S
2
G
1
Posts: 47
Reputation: 1,191

Post » Tue Feb 17, 2015 9:07 am

Anything that can be done in js, can be done with the Sdk. It may be tricky to get it to hook in to the audio plugin if you want a seperate plugin. Another option is just to modify the audio plugin, but any bugs introduced won't be supported officially.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Tue Feb 17, 2015 9:41 am

I should first try and make a plugin that adds 2 input numbers with each others, just to check if your base files work. Once this works you can add new functions and write the oscilator plug-in.

This isn't really simple. Another problem you can get is that your plugin does not work on all the platforms construct supports.
B
14
S
4
Posts: 43
Reputation: 992

Post » Tue Feb 17, 2015 10:03 am

Yeah, I'm starting to realize this is more of an issue then I originally anticipated. I tried messing around with what @R0J0hound suggested which was editing the audio plugin itself. This seems like the best option and then just access the Oscillator through the audio plugin. In Audio's edittime.js I managed to add the action needed:
Code: Select all
AddAction(34,0,"Add Oscillator", "General", "Add Oscillator", "Create Oscillator that generates sound at a given frequency.", "AddOsc");


My problem, is when I go into Audio's runtime.js I'm not sure how to work with Web Audio since it looks much different then plain WA.

Creating an oscillator in plain JS is as simple as:
Code: Select all
var ctx = new AudioContext();
osc = ctx.createOscillator();
osc.connect(ctx.destination);
osc.start(0);


Forgive me if this seems obvious, I'm just learning the SDK today! :P
B
13
S
2
G
1
Posts: 47
Reputation: 1,191

Post » Mon Mar 23, 2015 1:59 am

This is something I've also been very interested in lately. It seems like one could turn Construct 2 into a powerful synthesis tool. The implications for dynamic audio would be incredible.

But I'm kind of in the same boat, just barely familiar with the SDK.

Have you made any progress in this area? I'm considering taking a serious crack at it, but I don't want to duplicate anyone's work.
B
18
S
4
G
3
Posts: 39
Reputation: 2,697

Post » Thu Nov 10, 2016 8:30 am

Here is a plugin of tone.js , which could add an oscillator nodes or other effect nodes into audio pipes.
B
108
S
26
G
260
Posts: 4,434
Reputation: 146,191

Post » Tue Nov 15, 2016 9:22 am

Hi
B
3
Posts: 6
Reputation: 187

Post » Tue Nov 15, 2016 9:31 am

DIPCrystal wrote:Hi


@DIPCrystal

Please stop making meaningless, non-thread related spam posts.

If you continue, you are likely to be considered a spam bot and your account will be banned.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Fri Nov 18, 2016 7:59 am

zenox98 wrote:
DIPCrystal wrote:Hi


@DIPCrystal

Please stop making meaningless, non-thread related spam posts.

If you continue, you are likely to be considered a spam bot and your account will be banned.

OK! I am not.
B
3
Posts: 6
Reputation: 187


Return to Javascript SDK

Who is online

Users browsing this forum: rayolf and 0 guests