Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
musicinformationretrieval-com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
A.S.
musicinformationretrieval-com
Commits
312f83ee
Commit
312f83ee
authored
Oct 06, 2014
by
Steve Tjoa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pitch transcription, lsh
parent
68a8d23c
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
211 additions
and
74 deletions
+211
-74
lsh_fingerprinting.ipynb
notebooks/lsh_fingerprinting.ipynb
+81
-15
pitch_transcription_answer.ipynb
notebooks/pitch_transcription_answer.ipynb
+32
-51
pitch_transcription_exercise.ipynb
notebooks/pitch_transcription_exercise.ipynb
+98
-8
No files found.
notebooks/lsh_fingerprinting.ipynb
View file @
312f83ee
{
"metadata": {
"name": "",
"signature": "sha256:1
e57ed1516a61260e593f53b74843c63ebc0cf1bf4a9edcdd0616da4d46b32be
"
"signature": "sha256:1
f044aa25a32fe434bce4255de83af940291fe22648bb0bd1aa00a36fab6d135
"
},
"nbformat": 3,
"nbformat_minor": 0,
...
...
@@ -47,7 +47,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number":
79
"prompt_number":
2
},
{
"cell_type": "heading",
...
...
@@ -68,7 +68,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number":
80
"prompt_number":
3
},
{
"cell_type": "code",
...
...
@@ -83,7 +83,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number":
81
"prompt_number":
4
},
{
"cell_type": "code",
...
...
@@ -99,13 +99,13 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number":
82
,
"prompt_number":
5
,
"text": [
"2
6
"
"2
4
"
]
}
],
"prompt_number":
82
"prompt_number":
5
},
{
"cell_type": "heading",
...
...
@@ -146,7 +146,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number":
83
"prompt_number":
6
},
{
"cell_type": "code",
...
...
@@ -154,7 +154,8 @@
"input": [],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "code",
...
...
@@ -187,7 +188,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number":
84
"prompt_number":
7
},
{
"cell_type": "code",
...
...
@@ -237,7 +238,8 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "heading",
...
...
@@ -256,7 +258,8 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "heading",
...
...
@@ -275,7 +278,8 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "heading",
...
...
@@ -294,7 +298,68 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"../train/brahms_s1_1_perlman_02.wav 8.69369369369\n",
"../train/bach_p3_1_perlman_01.wav 8.22522522523\n",
"../train/Beethoven_vln_sonata5_Francescatti_05.wav 8.22413793103\n",
"../train/Beethoven_vln_sonata5_Francescatti_03.wav 7.79518072289\n",
"../train/brahms_s1_1_perlman_04.wav 7.40540540541\n",
"../train/brahms_s1_1_perlman_01.wav 7.31531531532\n",
"../train/Beethoven_vln_sonata5_Zukerman_03.wav 6.53684210526\n",
"../train/brahms_s1_1_perlman_05.wav 6.18918918919\n",
"../train/Beethoven_vln_sonata5_Zukerman_01.wav 6.15094339623\n",
"../train/Beethoven_vln_sonata5_Francescatti_01.wav 6.125\n",
"../train/Beethoven_vln_sonata5_Francescatti_02.wav 5.984375\n",
"../train/Beethoven_vln_sonata5_Oistrakh_02.wav 5.95275590551\n",
"../train/brahms_s1_1_perlman_03.wav 5.94594594595\n",
"../train/Beethoven_vln_sonata5_Francescatti_04.wav 5.79245283019\n",
"../train/lady_madonna_crop.wav 5.70535714286\n",
"../train/brahms_rhapsody_02.wav 5.48823529412\n",
"../train/brahms_s1_1_perlman_06.wav 5.43243243243\n",
"../train/moonlight.wav 5.4\n",
"../train/office_theme.wav 5.39959839357\n",
"../train/brandenburg3_01.wav 5.37688442211\n",
"../train/lady_madonna.wav 5.21385542169\n",
"../train/Beethoven_vln_sonata5_Oistrakh_01.wav 5.11403508772\n",
"../train/bach_s3_3_szeryng_01.wav 4.89189189189\n",
"../train/bach_p3_1_heifetz_04.wav 4.87387387387\n",
"../train/konstantine.wav 4.87072243346\n",
"../train/Bach Vln Partita3 - Milstein 1955 - 01.wav 4.81233933162\n",
"../train/Beethoven_vln_sonata5_Zukerman_02.wav 4.62222222222\n",
"../train/Beethoven_vln_sonata5_Zukerman_04.wav 4.57391304348\n",
"../train/dont_stop_believin.wav 4.57256461233\n",
"../train/bach_p3_1_perlman_05.wav 4.4954954955\n",
"../train/Beethoven_vln_sonata5_Zukerman_05.wav 4.45833333333\n",
"../train/Beethoven_vln_sonata5_Oistrakh_03.wav 4.39772727273\n",
"../train/bach_p3_1_perlman_04.wav 4.33333333333\n",
"../train/Bach Vln Partita3 - Milstein 1955 - 03.wav 4.24712643678\n",
"../train/bach_p3_1_heifetz_01.wav 4.22522522523\n",
"../train/bach_p3_1_perlman_03.wav 4.17117117117\n",
"../train/Beethoven_vln_sonata5_Oistrakh_05.wav 4.07518796992\n",
"../train/Beethoven_vln_sonata5_Oistrakh_04.wav 4.01785714286\n",
"../train/Bach Vln Partita3 - Fischbach 2004 - 01.wav 3.77605321508\n",
"../train/bach_p3_1_perlman_02.wav 3.72972972973\n",
"../train/bach_s3_3_szeryng_05.wav 3.64864864865\n",
"../train/bach_p3_1_perlman_06.wav 3.51351351351\n",
"../train/brahms_rhapsody_01.wav 3.38855421687\n",
"../train/Bach Vln Partita3 - Fischbach 2004 - 03.wav 3.17877094972\n",
"../train/bach_p3_1_heifetz_03.wav 3.02702702703\n",
"../train/bach_p3_1_heifetz_02.wav 3.00900900901\n",
"../train/bach_s3_3_szeryng_06.wav 2.95495495495\n",
"../train/bach_s3_3_szeryng_02.wav 2.74774774775\n",
"../train/Bach Vln Sonata1 - Milstein 1954 - 02.wav 2.70438799076\n",
"../train/bach_p3_1_heifetz_05.wav 2.63963963964\n",
"../train/bach_s3_3_szeryng_04.wav 2.61261261261\n",
"../train/bach_s3_3_szeryng_03.wav 2.36936936937\n",
"../train/Bach Vln Sonata1 - Fischbach 2004 - 02.wav 2.36225596529\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "code",
...
...
@@ -302,7 +367,8 @@
"input": [],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 11
}
],
"metadata": {}
...
...
notebooks/pitch_transcription_answer.ipynb
View file @
312f83ee
This diff is collapsed.
Click to expand it.
notebooks/pitch_transcription_exercise.ipynb
View file @
312f83ee
{
"metadata": {
"name": "",
"signature": "sha256:
bf70df398956b11061c08c16b7ac0d48021c764eb731784865a2d5d1b9f1ce89
"
"signature": "sha256:
3a3278f7c6fb206a34581be477af529e901600f877d2eeeb0456448031912235
"
},
"nbformat": 3,
"nbformat_minor": 0,
...
...
@@ -29,23 +29,25 @@
"collapsed": false,
"input": [
"import essentia.standard as ess\n",
"loader = ess.MonoLoader(filename='
defaul
t.wav', sampleRate=44100)\n",
"loader = ess.MonoLoader(filename='
../test/tes
t.wav', sampleRate=44100)\n",
"signal_in = loader()"
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import Audio\n",
"Audio(data=signal_in, rate=44100)"
"
#
Audio(data=signal_in, rate=44100)"
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "heading",
...
...
@@ -55,6 +57,80 @@
"Find each note and its pitch."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def get_onsets(signal_in):\n",
" onset_times, onset_rate = ess.OnsetRate()(signal_in)\n",
" return onset_times"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"yin = ess.PitchYinFFT()\n",
"spectrum = ess.Spectrum()\n",
"\n",
"def get_pitch(segment):\n",
" if len(segment) < 4096:\n",
" N = len(segment) if len(segment) % 2 == 0 else len(segment) - 1\n",
" else:\n",
" N = 4096\n",
" pitch, pitch_conf = yin(spectrum(segment[:N]))\n",
" return pitch"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def generate_sine(pitch, n_duration):\n",
" #print midi, f0\n",
" n = arange(n_duration)\n",
" return 0.2*sin(2*pi*pitch*n/44100.0)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def transcribe_pitch(signal_in):\n",
" \n",
" signal_out = zeros(len(signal_in))\n",
" \n",
" # get onsets\n",
" onsets = get_onsets(signal_in)\n",
" \n",
" # get pitches\n",
" for i in range(len(onsets)-1):\n",
" n0 = int(onsets[i]*44100)\n",
" n1 = int(onsets[i+1]*44100)\n",
" pitch = get_pitch(signal_in[n0:n1])\n",
" \n",
" signal_out[n0:n1] = generate_sine(pitch, n1-n0)\n",
" \n",
" return signal_out\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": true,
...
...
@@ -63,7 +139,8 @@
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "heading",
...
...
@@ -77,11 +154,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
"Audio(data=signal_out, rate=44100)"
"import essentia\n",
"#Audio(data=signal_out, rate=44100)\n",
"signal_out = sum([signal_out, signal_in], axis=0)\n",
"ess.MonoWriter(filename='../test/out.wav')(essentia.array(signal_out))"
],
"language": "python",
"metadata": {},
"outputs": []
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
}
],
"metadata": {}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment