3D Stem

Music Beat Detection Analysis

Audio analysis showing detected beats across frequency bands with strength indicators.

Output
Music Beat Detection Analysis
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(444)

# Beat detection in music
n_beats = 30
beat_time = np.cumsum(np.random.uniform(0.4, 0.6, n_beats))
beat_strength = np.random.uniform(0.5, 1.0, n_beats)
frequency_band = np.random.choice([0, 0.33, 0.66, 1], n_beats)  # Bass, Mid, High, Full

x = beat_time / beat_time.max()
y = frequency_band
z = beat_strength

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

markerline, stemlines, baseline = ax.stem(x, y, z, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#f97316', linewidth=2, alpha=0.7)
plt.setp(markerline, color='#fb923c', markersize=8)

ax.set_xlabel('Time (normalized)', color='#1f2937', fontsize=10)
ax.set_ylabel('Frequency Band', color='#1f2937', fontsize=10)
ax.set_zlabel('Beat Strength', color='#1f2937', fontsize=10)
ax.set_title('Music Beat Detection Analysis', color='#1f2937', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support