-
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Description
When applying the pitchShiftFilter
and changing timeStretch
, the original sound becomes heavily distorted, resulting in a "robovoice"-like effect.
Even after resetting the value back to 1.0
, the distortion does not go away and the sound remains degraded.
Steps To Reproduce
- Initialize
SoLoud
and load an audio file. - Activate the
pitchShiftFilter
. - Change the
timeStretch
value using a slider (e.g., from 1.0 to 0.5 or 2.0).
Expected Behavior
The quality should not deteriorate when changing the timeStretch.
Additional Context
• Flutter version: 3.35.2
• flutter_soloud version: 3.3.6
• Platform(s): Android/iOS
Code Sample
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SoLoud.instance.init();
runApp(MaterialApp(home: const HomeScreen()));
}
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
double _speed = 1.0;
AudioSource? audioSource;
SoundHandle? soundHandle;
@override
void initState() {
loadSound();
super.initState();
}
Future<void> loadSound() async {
final sound = await SoLoud.instance.loadAsset('assets/sound.mp3');
sound.filters.pitchShiftFilter.activate();
audioSource = sound;
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Speed: $_speed'),
Slider(
value: _speed,
onChanged: (value) {
_speed = value;
setState(() {});
if (audioSource != null && soundHandle != null) {
audioSource!.filters.pitchShiftFilter.timeStretch(
soundHandle!,
value,
);
}
},
min: 0.2,
max: 2,
),
ElevatedButton(
onPressed: () async {
if (audioSource != null) {
soundHandle = await SoLoud.instance.play(
audioSource!,
looping: true,
);
}
},
child: Text('Play'),
),
],
),
);
}
}
Metadata
Metadata
Assignees
Labels
No labels