diff --git a/demo_f0.ipynb b/demo_f0.ipynb index 46804a6..e99cd58 100644 --- a/demo_f0.ipynb +++ b/demo_f0.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "a1f6fe1a", "metadata": {}, "outputs": [], @@ -49,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "67aa9b4e", "metadata": {}, "outputs": [], @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "7e4fd4a2", "metadata": {}, "outputs": [], @@ -93,78 +93,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ab6f0e3f", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
startf0
00.25261.63
10.75329.63
21.25392.00
31.75523.25
42.250.00
\n", - "
" - ], - "text/plain": [ - " start f0\n", - "0 0.25 261.63\n", - "1 0.75 329.63\n", - "2 1.25 392.00\n", - "3 1.75 523.25\n", - "4 2.25 0.00" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create Nx2-dimenstioinal numpy.ndarray time_f0\n", "time_f0 = np.column_stack((time_positions, C_Major_Triad_f0s))\n", @@ -184,35 +116,10 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "40c923b7", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sonified C Major triad:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Sonification using libsoni\n", "sonified_C_Major_Triad_f0 = f0.sonify_f0(time_f0=time_f0, fs=Fs)\n", @@ -238,35 +145,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "f8f4e39b", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sonified C Major Triad with custom parials:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Set custom_partials\n", "custom_partials = np.array([1,2,3,4])\n", @@ -297,31 +179,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "a9251bd7", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'amplitudes': [0.3952569169960475,\n", - " 0.23715415019762848,\n", - " 0.11857707509881424,\n", - " 0.0790513833992095,\n", - " 0.05928853754940712,\n", - " 0.03952569169960475,\n", - " 0.0316205533596838,\n", - " 0.019762845849802375,\n", - " 0.011857707509881424,\n", - " 0.00790513833992095],\n", - " 'envelope': None,\n", - " 'partials': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# get information about preset \n", "violin_preset = get_preset('violin')\n", @@ -338,48 +199,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "3ffb6243", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
altobassbassoonclarinetsaxophonesopranotenorviolin
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "with open(os.path.join('libsoni', 'util', 'presets.json'), \"r+\") as jsonFile:\n", " PRESETS = json.load(jsonFile)\n", @@ -417,35 +240,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "d931ba8a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\"Ach Gott und Herr\", by J. S. Bach:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "bach_audio, _ = librosa.load(os.path.join('data_audio','demo_f0','01-AchGottundHerr.wav'), sr=Fs)\n", "\n", @@ -464,85 +262,10 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "2b57b1e5", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Extract from violin_df:\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
startf0
1001.00494.484541
1011.01495.252512
1021.02498.796651
1031.03498.796651
1041.04498.796651
\n", - "
" - ], - "text/plain": [ - " start f0\n", - "100 1.00 494.484541\n", - "101 1.01 495.252512\n", - "102 1.02 498.796651\n", - "103 1.03 498.796651\n", - "104 1.04 498.796651" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Load .csv-data for each instrument\n", "violin_df = pd.read_csv(os.path.join('data_csv','demo_f0','01-AchGottundHerr_violin.csv'), sep=';')\n", @@ -564,55 +287,10 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "8275c03f", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'soprano': {'preset': 'violin',\n", - " 'time_f0': array([[0. , 0. ],\n", - " [0.01, 0. ],\n", - " [0.02, 0. ],\n", - " ...,\n", - " [6.57, 0. ],\n", - " [6.58, 0. ],\n", - " [6.59, 0. ]]),\n", - " 'gain': 1.0},\n", - " 'alto': {'preset': 'clarinet',\n", - " 'time_f0': array([[0. , 0. ],\n", - " [0.01, 0. ],\n", - " [0.02, 0. ],\n", - " ...,\n", - " [6.57, 0. ],\n", - " [6.58, 0. ],\n", - " [6.59, 0. ]]),\n", - " 'gain': 1.0},\n", - " 'tenor': {'preset': 'saxophone',\n", - " 'time_f0': array([[0. , 0. ],\n", - " [0.01, 0. ],\n", - " [0.02, 0. ],\n", - " ...,\n", - " [6.57, 0. ],\n", - " [6.58, 0. ],\n", - " [6.59, 0. ]]),\n", - " 'gain': 1.0},\n", - " 'bass': {'preset': 'bassoon',\n", - " 'time_f0': array([[0. , 0. ],\n", - " [0.01, 0. ],\n", - " [0.02, 0. ],\n", - " ...,\n", - " [6.57, 0. ],\n", - " [6.58, 0. ],\n", - " [6.59, 0. ]]),\n", - " 'gain': 1.0}}" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create dictionary\n", "bach_dict = {\n", @@ -651,84 +329,10 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dedb42f7", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'soprano', 'bass', 'tenor', 'alto'}\n", - "Original audio:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sonified with libsoni:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Original audio with sonification (stereo):\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "bach_sonified = f0.sonify_f0_with_presets(bach_dict)\n", "\n", @@ -761,35 +365,10 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "863f27d6", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\"Locus Iste\" by Anton Bruckner:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "satb_audio, _ = librosa.load(os.path.join('data_audio','demo_f0','DCS_LI_QuartetA_Take04_StereoReverb_STM.wav'), sr=Fs)\n", "\n", @@ -808,85 +387,10 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "8e36d7b1", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Extract from soprano_df:\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
startf0
1000.580499532.093
1010.586304531.004
1020.592109530.270
1030.597914529.670
1040.603719529.322
\n", - "
" - ], - "text/plain": [ - " start f0\n", - "100 0.580499 532.093\n", - "101 0.586304 531.004\n", - "102 0.592109 530.270\n", - "103 0.597914 529.670\n", - "104 0.603719 529.322" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Load .csv-data for each instrument\n", "soprano_df = pd.read_csv(os.path.join('data_csv','demo_f0','DCS_LI_QuartetA_Take04_S2_LRX.csv'), sep=';')\n", @@ -908,84 +412,10 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "11abc971", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'soprano', 'bass', 'tenor', 'alto'}\n", - "Original audio:\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sonified with libsoni\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Original audio with sonification (stereo)\n" - ] - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Create dictionary\n", "satb_dict = {\n",