mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 13:30:07 +01:00
Improve Audio Spectrum demo
- Draw fake reflections for spectrum bars. - Increase the bars' height to better make use of the window space. - Use Compatibility rendering method for greater performance and compatibility. - Update screenshot and icon. - Remove a stray `.import` file.
This commit is contained in:
@@ -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
|
||||
|
||||

|
||||

|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 3.8 KiB |
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 630 B |
BIN
audio/spectrum/screenshots/spectrum.webp
Normal file
BIN
audio/spectrum/screenshots/spectrum.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user