{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7e7e972a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 86744 characters]",
      "text/plain": [
       "<Figure size 640x480 with 4 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Parameter für Sinus-Wellen\n",
    "frequency_e2 = 82.4  # Hz\n",
    "frequency_g2 = 98    # Hz\n",
    "frequency_b2 = 123.5 # Hz\n",
    "amplitude = 1       # Fixe Amplitude\n",
    "sampling_rate = 1000  # Datenpunkte/Sekunde\n",
    "duration = 0.1     # Dauer der Betrachtung\n",
    "\n",
    "# Zeit für X-Achse anlegen\n",
    "t = np.linspace(0, duration, sampling_rate, endpoint=False)\n",
    "\n",
    "# Sinus-Wellen generieren\n",
    "sine_e2 = amplitude * np.sin(2 * np.pi * frequency_e2 * t)\n",
    "sine_g2 = amplitude * np.sin(2 * np.pi * frequency_g2 * t)\n",
    "sine_b2 = amplitude * np.sin(2 * np.pi * frequency_b2 * t)\n",
    "interference = sine_e2+sine_g2+sine_b2\n",
    "\n",
    "\n",
    "# Create the plot\n",
    "\n",
    "# plt.figure(figsize=(10, 6)) # Set figure size for better visibility\n",
    "# plt.subplot(4,1,1)\n",
    "# plt.plot(t, sine_e2)\n",
    "# plt.title(f'E2 ({frequency_e2} Hz)')\n",
    "# plt.xlabel('Time (s)')\n",
    "# plt.ylabel('Amplitude')\n",
    "# plt.subplot(4,1,2)\n",
    "# plt.plot(t, sine_g2)\n",
    "# plt.title(f'G2 ({frequency_g2} Hz)')\n",
    "# plt.xlabel('Time (s)')\n",
    "# plt.ylabel('Amplitude')\n",
    "# plt.subplot(4,1,3)\n",
    "# plt.plot(t, sine_b2)\n",
    "# plt.title(f'G2 ({frequency_b2} Hz)')\n",
    "# plt.xlabel('Time (s)')\n",
    "# plt.ylabel('Amplitude')\n",
    "# plt.subplot(4,1,4)\n",
    "# plt.plot(t, interference)\n",
    "# plt.title(f'E-Minor Chord')\n",
    "# plt.xlabel('Time (s)')\n",
    "# plt.ylabel('Amplitude')\n",
    "\n",
    "fig, ax = plt.subplots(4, 1 ,sharex=True, sharey=True)\n",
    "fig.tight_layout()\n",
    "ax[0].plot(t, sine_e2)\n",
    "ax[1].plot(t, sine_g2)\n",
    "ax[2].plot(t, sine_b2)\n",
    "ax[3].plot(t, interference, c='orange')\n",
    "\n",
    "ax[0].set_title(f'E2 ({frequency_e2} Hz)')\n",
    "ax[1].set_title(f'G2 ({frequency_g2} Hz)')\n",
    "ax[2].set_title(f'B2 ({frequency_b2} Hz)')\n",
    "ax[3].set_title('E Minor Chord')\n",
    "\n",
    "ax[3].set_xlabel('time(s)')\n",
    "ax[0].set_ylabel('Amplitude')\n",
    "ax[1].set_ylabel('Amplitude')\n",
    "ax[2].set_ylabel('Amplitude')\n",
    "ax[3].set_ylabel('Amplitude')\n",
    "\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
