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]
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.
# 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.
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.