How to get multiple integer values into a script2 object at once


#1

Hey guys, I need some help building a spectrum analyzer using Axoloti, another microcontroller and an LED matrix. The goal is to visualize the amplitudes of multiple frequencies of an audio signal on the LED Matrix. I already achieved the following:

  • create a patch containing the spectrum analyzer using four band bass filters: analyzer.axp (8.0 KB)
  • send serial messages from the Axoloti to the microcontroller using a script2 object.

Now I'm struggling to get the values from the band pass filters into the script2 object, where I want to process them in order to send information to the other microcontroller. For one integer value it would be easy to just connect it to the input of the script object. But how to deal with four, eight or even more values at once?

Hopefully my question is comprehensible and some of you can help me. It would be appreciated :slight_smile:


#2

use the object editor to create your own object with the necessary number of inputs.

easiest approach is to use the patch/object which will create an 'embedded object' i.e. one that lives in the patch.

note: use axoloti 1.0.10 if you are not already.

tip: keep in mind object execution order to ensure all your inputs are from the same execution cycle, and remember all inputs are then present at the same time, so you can combine the data going to the other controller.


#3

Thanks! I managed to create a custom object with the inputs I need. This topic was helpful understanding the basics (although you can edit it using the object editor): https://sebiik.github.io/community.axoloti.com.backup/t/creating-axo-objects/481

What I need now is to react on the band pass filter output values. The problem is: I don't need to get all values at k-rate, because I want to send out serial messages using my custom object every ~100ms. I guess I have to dig deeper into signal processing/sampling to get this working. I did something similar years ago in pure data, but the approach in axoloti will probably be different. Does anyone have some input on this?


#4

I'd suggest making a version of "spectral/analyzer 24" with control rate outlets, and wiring these to your custom script2-based object. Your object can then sample the k-rate values every ~100ms.