diff --git a/audio/spectrum/README.md b/audio/spectrum/README.md index 39fbba65..f28d3bd2 100644 --- a/audio/spectrum/README.md +++ b/audio/spectrum/README.md @@ -4,10 +4,10 @@ This is a demo showing how a spectrum analyzer can be built using Godot. Language: GDScript -Renderer: GLES 2 +Renderer: Compatibility Check out this demo on the asset library: https://godotengine.org/asset-library/asset/528 ## Screenshots -![Screenshot](screenshots/spectrum.png) +![Screenshot](screenshots/spectrum.webp) diff --git a/audio/spectrum/icon.png b/audio/spectrum/icon.png index 72b70d9f..5ede22b3 100644 Binary files a/audio/spectrum/icon.png and b/audio/spectrum/icon.png differ diff --git a/audio/spectrum/icon.png.import b/audio/spectrum/icon.png.import index 3ad0760a..bae64377 100644 --- a/audio/spectrum/icon.png.import +++ b/audio/spectrum/icon.png.import @@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte [params] compress/mode=0 +compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 -compress/bptc_ldr=0 compress/normal_map=0 compress/channel_pack=0 mipmaps/generate=false diff --git a/audio/spectrum/maldita.wav.import b/audio/spectrum/maldita.wav.import deleted file mode 100644 index 62393c96..00000000 --- a/audio/spectrum/maldita.wav.import +++ /dev/null @@ -1,21 +0,0 @@ -[remap] - -importer="wav" -type="AudioStreamSample" -path="res://.godot/imported/maldita.wav-82d9f1ad42df5bdfaeda0654a708cb7a.sample" - -[deps] - -source_file="res://maldita.wav" -dest_files=["res://.godot/imported/maldita.wav-82d9f1ad42df5bdfaeda0654a708cb7a.sample"] - -[params] - -force/8_bit=false -force/mono=false -force/max_rate=false -force/max_rate_hz=44100 -edit/trim=true -edit/normalize=true -edit/loop=false -compress/mode=0 diff --git a/audio/spectrum/project.godot b/audio/spectrum/project.godot index dd3cd57f..4128efd1 100644 --- a/audio/spectrum/project.godot +++ b/audio/spectrum/project.godot @@ -25,6 +25,8 @@ window/stretch/aspect="expand" [rendering] +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" environment/defaults/default_clear_color=Color(0.12549, 0.12549, 0.12549, 1) quality/driver/driver_name="GLES2" vram_compression/import_etc=true diff --git a/audio/spectrum/screenshots/spectrum.png b/audio/spectrum/screenshots/spectrum.png deleted file mode 100644 index fc48ee08..00000000 Binary files a/audio/spectrum/screenshots/spectrum.png and /dev/null differ diff --git a/audio/spectrum/screenshots/spectrum.webp b/audio/spectrum/screenshots/spectrum.webp new file mode 100644 index 00000000..1c2eae65 Binary files /dev/null and b/audio/spectrum/screenshots/spectrum.webp differ diff --git a/audio/spectrum/show_spectrum.gd b/audio/spectrum/show_spectrum.gd index 36e09576..9b8f35a6 100644 --- a/audio/spectrum/show_spectrum.gd +++ b/audio/spectrum/show_spectrum.gd @@ -4,7 +4,7 @@ const VU_COUNT = 16 const FREQ_MAX = 11050.0 const WIDTH = 800 -const HEIGHT = 200 +const HEIGHT = 250 const MIN_DB = 60 @@ -30,6 +30,20 @@ func _draw(): 2.0, true ) + + # Draw a reflection of the bars with lower opacity. + draw_rect( + Rect2(w * i, HEIGHT, w - 2, height), + Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 0.6) * Color(1, 1, 1, 0.125) + ) + draw_line( + Vector2(w * i, HEIGHT + height), + Vector2(w * i + w - 2, HEIGHT + height), + Color.from_hsv(float(VU_COUNT * 0.6 + i * 0.5) / VU_COUNT, 0.5, 1.0) * Color(1, 1, 1, 0.125), + 2.0, + true + ) + prev_hz = hz diff --git a/audio/spectrum/show_spectrum.tscn b/audio/spectrum/show_spectrum.tscn index 2a86ec55..68edf5d6 100644 --- a/audio/spectrum/show_spectrum.tscn +++ b/audio/spectrum/show_spectrum.tscn @@ -4,7 +4,7 @@ [ext_resource type="AudioStream" uid="uid://dl3ppges2sw77" path="res://maldita.ogg" id="2"] [node name="ShowSpectrum" type="Node2D"] -position = Vector2(136, 224) +position = Vector2(136, 80) script = ExtResource("1") [node name="Player" type="AudioStreamPlayer" parent="."] @@ -12,5 +12,5 @@ stream = ExtResource("2") autoplay = true [node name="Camera2D" type="Camera2D" parent="."] +position = Vector2(0, 144) offset = Vector2(440, 100) -current = true