Skip to content

Commit

Permalink
Merge pull request #273 from shorepine/piano-3d
Browse files Browse the repository at this point in the history
piano_heterodyne: Add axis labels to 3D waterfall plot.
  • Loading branch information
dpwe authored Jan 8, 2025
2 parents abd2222 + 5f8c465 commit c98f780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Binary file modified docs/3d-envelopes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions experiments/piano_heterodyne.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@
" return mags, recons_d, freqs, avg_freqs, est_f0\n",
"\n",
"filename = filename_for_note('D', 4, 'ff')\n",
"waveform, sr = read_and_trim(os.path.join(directory, filename), channel=0, duration=5.0, rel_threshold=0.015, abs_threshold=0.0006, do_plot=True, pre_time=0.002)\n",
"waveform, sr = read_and_trim(os.path.join(directory, filename), channel=0, duration=5.0, rel_threshold=0.015, abs_threshold=0.0006, pre_time=0.002)\n",
"\n",
"d = waveform\n",
"\n",
Expand Down Expand Up @@ -1454,8 +1454,13 @@
" poly = PolyCollection(verts, facecolors=facecolors, alpha=.7)\n",
" axes.add_collection3d(poly, zs=np.arange(len(harms_dict[filename]), 0, -1), zdir='y')\n",
" axes.set_zlim(0, 120)\n",
" axes.set_zlabel('level / dB')\n",
" \n",
" plt.title(filename)\n",
" plt.xlabel('time / s')\n",
" plt.ylabel('harm #')\n",
" plt.yticks(np.arange(2, 22, 2), np.arange(19, -1, -2))\n",
" #plt.zlabel('level / dB')\n",
"\n",
" #plt.zlim([-100, -20])\n",
" #plt.legend(1 + np.arange(nharms))\n",
Expand All @@ -1466,7 +1471,7 @@
"\n",
"#fig = plt.figure(figsize=(8, 6))\n",
"\n",
"plt.figure(figsize=(16, 6))\n",
"plt.figure(figsize=(18, 6))\n",
"axes = plt.subplot(131, projection='3d')\n",
"note = 'C'\n",
"octave = 4\n",
Expand Down

0 comments on commit c98f780

Please sign in to comment.