Tiny FX: Addressing the 6 Mono Outputs

I’m working on a project using the Tiny FX and making good progress. I would like to have 5 of the 6 mono outputs each blinking an LED at random; the 6th output is doing it’s own thing.

Would the most efficient way to code that be to create 5 separate functions?

And, can you group outputs such as:
group1 = tiny.outputs[0, 1, 2]
group2 = tiny.outputs[3, 4]

Thanks for the help.

Hi @RGS,

The PicoFX library used by Tiny FX includes support for playing effects like you ask, via the FlickerFX class. This class is like the RandomFX except it alternates an LED between two brightness levels (e.g. on and off) with random on and off durations between defined ranges.

If you look at this example for playing a single flicker effect (picofx/examples/tiny_fx/examples/effects/mono/single_flicker.py at main · pimoroni/picofx · GitHub) it can be scaled for the 5 outputs, by creating a new FlickerFX object for where it currently says None. E.g.

# Create and set up 5 random effects to play
player.effects = [
    FlickerFX(),
    FlickerFX(),
    FlickerFX(),
    FlickerFX(),
    FlickerFX(),
    None,
]

Then you can either leave the last effect as None, letting you control it from your main loop to do its own thing, or assign it one of the many other effects that exist.

Hope that helps. If I completely misunderstood your requirements please let me know.

1 Like

Thank you so much, I’ll give it a try. I’m really enjoying the Tiny FX… it’s a great product!

1 Like

One last question…

It appears that I can control the audio volume when playing tones but it appears that I can not when playing a .WAV file. Is that accurate?

That is correct, with the current library implementation.

Tone playback pre-computes the requested wave before sending it to playback, so adding volume to that is trivial. Having .WAV playback change volume (or changing volume of an actively playing tone) would require scaling each audio sample as it comes in. In theory it would be possible to add this functionality, but I have concerns that the extra processing overhead will break audio playback.

For now my advice is to pre-scale your audio in a program such as Audacity.

Thank you for all the help. I’ll scale the audio with Audacity.

1 Like