Skip to content

Commit

Permalink
fix: make visualizer more appealing (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa authored Jul 31, 2024
1 parent fe8a001 commit 8f39aef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/music_player/widgets/music_visualizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ class MusicVisualizerState extends State<MusicVisualizer>
);
spectrogramIndex = 0;
spectrogram = (jsonDecode(spectrogramData) as List)
.map((e) => (e as List).map((e) => (e as num).toDouble()).toList())
.map(
(e) => (e as List)
// TODO(jolexxa): very bad hack to chop off the lowest and
// highest frequencies of the spectrograph. This makes the
// visualizer look more appealing.
.sublist(2, e.length - 2)
.map((e) => (e as num).toDouble())
.toList(),
)
.toList();

frequencyTweens = [
for (final frequency in spectrogram[spectrogramIndex])
ConstantTween<double>(frequency),
Expand Down

0 comments on commit 8f39aef

Please sign in to comment.