flutter_soloud
flutter_soloud copied to clipboard
Make filters easier to use and pitchshift filter
Description
Removed the main example which was too much complicate for a first approach. In the futere I'll make a new GitHub repository with that. For now there are 2 little example:
- a metronome
- a filter use case
Added pitch shift
filter to somehow resolve #98.
This filter has these parameters:
-
shift
: a value of 0.5 means one octave down (12 semitones down), a value of 2.0 means one octave up (12 semitones up). -
semitones
: increases or decrease using semitones (¹/12 of an octave).
This filter can be used in conjunction with SoLoud.setRelativePlaySpeed()
to for example play a sound with voices at double speed without changing the tone speech.
The filters can now be used for single sounds instead of using them only globally.
IMPORTANT: filters for individual sounds are not supported on the web platform. On the other platforms the filter must be added before playing. Only voice handles played after adding the filter will play with the filter chosen.
Filters can now be accessed globally using SoLoud.instance.filters
or for single [AudioSource] sounds with sound.filters
to resolve #108. With something like:
/// For global filters.
final ps = SoLoud.instance.filters.pitchShiftFilter;
ps.activate();
ps.shift(soundHandle: soundHandle).value = 0.6; // set value.
final shift = ps.shift(soundHandle: soundHandle).value; // get value.
ps.fadeFilterParameter(to: 3, time: const Duration(milliseconds: 2500));
ps.oscillateFilterParameter(from: 0.5 to: 1.5, time: const Duration(milliseconds: 2500));
ps.queryShift.[min | max | def] // to get filter min, max and default values.
/// For single sound filters.
final ps = sound.filters.pitchShiftFilter;
[as for global]
Look at the respective documentation to see how to use them.
Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [x] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore