Skip to content

Commit

Permalink
Building Features and Fixing Dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
reynardo-tjhin committed Aug 1, 2023
1 parent c8d86e4 commit 8df846c
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 53 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
features:
cd src/features; \
python3 build_audio_features.py

data:
cd src/data; \
python3 make_dataset.py
Expand Down
42 changes: 21 additions & 21 deletions dataset.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
audio_name,clap_start,clap_end,music_start,music_end,end_clap_start,audio_end
audio0,0,11,32,2551,2553,2607.16
audio1,0,22,34,2418,2419,2451.75
audio2,0,17,41,2423,2424,2488.09
audio3,0,15,35,2017,2018,2096.62
audio4,0,5,13,2128,2129,2191.2
audio5,34,49,60,2480,2481,2554.71
audio6,5,40,49,2180,2182,2190.18
audio7,0,16,20,1712,1714,1767.36
audio8,0,16,31,1947,1948,2048.23
audio9,15,21,32,1665,1667,1847.66
audio10,0,30,64,1992,1994,2062.28
audio11,0,32,55,2390,2391,2432.45
audio12,0,14,30,2262,2264,2288.93
audio13,3,10,12,3970,3974,4048.86
audio14,0,35,38,384,386,398.8
audio15,0,19,30,1557,1558,1579.77
audio16,16,48,57,1984,1985,2080.37
audio17,0,31,41,2399,2401,2432.85
audio18,0,20,41,1990,1994,2072.06
audio19,0,26,44,1660,1662,1681.57
audio_name,clap_start,clap_end,music_start,music_end,end_clap_start,end_clap_end,audio_end
audio0,0,11,32,2551,2553,2602,2607.16
audio1,0,22,34,2418,2419,2451.75,2451.75
audio2,0,17,41,2423,2424,2488.09,2488.09
audio3,0,15,35,2017,2018,2096.62,2096.62
audio4,0,5,13,2128,2129,2191.2,2191.2
audio5,34,49,60,2480,2481,2547,2554.71
audio6,5,40,49,2180,2182,2189.5,2190.18
audio7,0,16,20,1712,1714,1767.36,1767.36
audio8,0,16,31,1947,1948,2048.23,2048.23
audio9,15,21,32,1665,1667,1847.66,1847.66
audio10,0,30,64,1992,1994,2061,2062.28
audio11,0,32,55,2390,2391,2431,2432.45
audio12,0,14,30,2262,2264,2288.93,2288.93
audio13,3,10,12,3970,3974,4043,4048.86
audio14,0,35,38,384,386,398.8,398.8
audio15,0,19,30,1557,1558,1579.77,1579.77
audio16,16,48,57,1984,1985,2059,2080.37
audio17,0,31,41,2399,2401,2432.85,2432.85
audio18,0,20,41,1990,1994,2072.06,2072.06
audio19,0,26,44,1660,1662,1681.57,1681.57
71 changes: 46 additions & 25 deletions notebooks/data-display.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -41,6 +41,7 @@
" <th>music_start</th>\n",
" <th>music_end</th>\n",
" <th>end_clap_start</th>\n",
" <th>end_clap_end</th>\n",
" <th>audio_end</th>\n",
" </tr>\n",
" </thead>\n",
Expand All @@ -53,6 +54,7 @@
" <td>32</td>\n",
" <td>2551</td>\n",
" <td>2553</td>\n",
" <td>2602.00</td>\n",
" <td>2607.16</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -64,6 +66,7 @@
" <td>2418</td>\n",
" <td>2419</td>\n",
" <td>2451.75</td>\n",
" <td>2451.75</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
Expand All @@ -74,6 +77,7 @@
" <td>2423</td>\n",
" <td>2424</td>\n",
" <td>2488.09</td>\n",
" <td>2488.09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
Expand All @@ -84,6 +88,7 @@
" <td>2017</td>\n",
" <td>2018</td>\n",
" <td>2096.62</td>\n",
" <td>2096.62</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
Expand All @@ -94,6 +99,7 @@
" <td>2128</td>\n",
" <td>2129</td>\n",
" <td>2191.20</td>\n",
" <td>2191.20</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
Expand All @@ -103,6 +109,7 @@
" <td>60</td>\n",
" <td>2480</td>\n",
" <td>2481</td>\n",
" <td>2547.00</td>\n",
" <td>2554.71</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -113,6 +120,7 @@
" <td>49</td>\n",
" <td>2180</td>\n",
" <td>2182</td>\n",
" <td>2189.50</td>\n",
" <td>2190.18</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -124,6 +132,7 @@
" <td>1712</td>\n",
" <td>1714</td>\n",
" <td>1767.36</td>\n",
" <td>1767.36</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
Expand All @@ -134,6 +143,7 @@
" <td>1947</td>\n",
" <td>1948</td>\n",
" <td>2048.23</td>\n",
" <td>2048.23</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
Expand All @@ -144,6 +154,7 @@
" <td>1665</td>\n",
" <td>1667</td>\n",
" <td>1847.66</td>\n",
" <td>1847.66</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
Expand All @@ -153,6 +164,7 @@
" <td>64</td>\n",
" <td>1992</td>\n",
" <td>1994</td>\n",
" <td>2061.00</td>\n",
" <td>2062.28</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -163,6 +175,7 @@
" <td>55</td>\n",
" <td>2390</td>\n",
" <td>2391</td>\n",
" <td>2431.00</td>\n",
" <td>2432.45</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -174,6 +187,7 @@
" <td>2262</td>\n",
" <td>2264</td>\n",
" <td>2288.93</td>\n",
" <td>2288.93</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
Expand All @@ -183,6 +197,7 @@
" <td>12</td>\n",
" <td>3970</td>\n",
" <td>3974</td>\n",
" <td>4043.00</td>\n",
" <td>4048.86</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -194,6 +209,7 @@
" <td>384</td>\n",
" <td>386</td>\n",
" <td>398.80</td>\n",
" <td>398.80</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
Expand All @@ -204,6 +220,7 @@
" <td>1557</td>\n",
" <td>1558</td>\n",
" <td>1579.77</td>\n",
" <td>1579.77</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
Expand All @@ -213,6 +230,7 @@
" <td>57</td>\n",
" <td>1984</td>\n",
" <td>1985</td>\n",
" <td>2059.00</td>\n",
" <td>2080.37</td>\n",
" </tr>\n",
" <tr>\n",
Expand All @@ -224,6 +242,7 @@
" <td>2399</td>\n",
" <td>2401</td>\n",
" <td>2432.85</td>\n",
" <td>2432.85</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
Expand All @@ -234,6 +253,7 @@
" <td>1990</td>\n",
" <td>1994</td>\n",
" <td>2072.06</td>\n",
" <td>2072.06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
Expand All @@ -244,6 +264,7 @@
" <td>1660</td>\n",
" <td>1662</td>\n",
" <td>1681.57</td>\n",
" <td>1681.57</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand Down Expand Up @@ -272,30 +293,30 @@
"18 audio18 0 20 41 1990 1994 \n",
"19 audio19 0 26 44 1660 1662 \n",
"\n",
" audio_end \n",
"0 2607.16 \n",
"1 2451.75 \n",
"2 2488.09 \n",
"3 2096.62 \n",
"4 2191.20 \n",
"5 2554.71 \n",
"6 2190.18 \n",
"7 1767.36 \n",
"8 2048.23 \n",
"9 1847.66 \n",
"10 2062.28 \n",
"11 2432.45 \n",
"12 2288.93 \n",
"13 4048.86 \n",
"14 398.80 \n",
"15 1579.77 \n",
"16 2080.37 \n",
"17 2432.85 \n",
"18 2072.06 \n",
"19 1681.57 "
" end_clap_end audio_end \n",
"0 2602.00 2607.16 \n",
"1 2451.75 2451.75 \n",
"2 2488.09 2488.09 \n",
"3 2096.62 2096.62 \n",
"4 2191.20 2191.20 \n",
"5 2547.00 2554.71 \n",
"6 2189.50 2190.18 \n",
"7 1767.36 1767.36 \n",
"8 2048.23 2048.23 \n",
"9 1847.66 1847.66 \n",
"10 2061.00 2062.28 \n",
"11 2431.00 2432.45 \n",
"12 2288.93 2288.93 \n",
"13 4043.00 4048.86 \n",
"14 398.80 398.80 \n",
"15 1579.77 1579.77 \n",
"16 2059.00 2080.37 \n",
"17 2432.85 2432.85 \n",
"18 2072.06 2072.06 \n",
"19 1681.57 1681.57 "
]
},
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -308,7 +329,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -487,7 +508,7 @@
"19 https://www.youtube.com/watch?v=hXTyxNccdjM "
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
13 changes: 7 additions & 6 deletions notebooks/display.ipynb

Large diffs are not rendered by default.

Empty file added notebooks/features.ipynb
Empty file.
2 changes: 2 additions & 0 deletions notebooks/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rms
2
45 changes: 45 additions & 0 deletions notebooks/test.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"df = pd.DataFrame({\n",
" 'rms': []\n",
"})\n",
"\n",
"df.loc[len(df)] = 2\n",
"\n",
"df.reset_index(drop=True)\n",
"\n",
"df.to_csv(\"./test.csv\", index=False)"
]
}
],
"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.8.10"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file modified notebooks/test.wav
Binary file not shown.
6 changes: 5 additions & 1 deletion src/data/make_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def split(start: int, end: int, audio_name="/path/to/sample", audio_result_name=
clap_end_time = data.loc[i, 'clap_end'] * 1000
while (clap_start_time + duration < clap_end_time):

# print(f"{j}.wav is from {audio}.mp3")

if (os.path.exists("data/yes/" + f"{j}.wav")):
clap_start_time += duration
j += 1
Expand All @@ -146,9 +148,11 @@ def split(start: int, end: int, audio_name="/path/to/sample", audio_result_name=

# clapping after performance
end_clap_time = data.loc[i, 'end_clap_start'] * 1000
audio_end_time = data.loc[i, 'audio_end'] * 1000
audio_end_time = data.loc[i, 'end_clap_end'] * 1000
while (end_clap_time + duration < audio_end_time):

# print(f"{j}.wav is from {audio}.mp3")

if (os.path.exists("data/yes/" + f"{j}.wav")):
end_clap_time += duration
j += 1
Expand Down
Loading

0 comments on commit 8df846c

Please sign in to comment.