Mercurial > hg > pmhd
comparison start.py @ 13:844d341cf643 tip
Back up before ISMIR
author | Yading Song <yading.song@eecs.qmul.ac.uk> |
---|---|
date | Thu, 31 Oct 2013 13:17:06 +0000 |
parents | 80a9556123da |
children |
comparison
equal
deleted
inserted
replaced
12:80a9556123da | 13:844d341cf643 |
---|---|
87 content = '''<div style="text-align:center"> <p> You have chosen <b> %s </b> music </p></div>''' %userinput | 87 content = '''<div style="text-align:center"> <p> You have chosen <b> %s </b> music </p></div>''' %userinput |
88 html_tail = '''</div><div style="margin:0 auto;width:75%;text-align:center"><script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script><br /> <a href="javascript: history.go(-1)">Back</a> </div></body> </html>''' | 88 html_tail = '''</div><div style="margin:0 auto;width:75%;text-align:center"><script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script><br /> <a href="javascript: history.go(-1)">Back</a> </div></body> </html>''' |
89 audio_url = "" | 89 audio_url = "" |
90 | 90 |
91 #(tracktitle, trackid) = get_trackid_from_text_search(userinput,'Justin Bieber') | 91 #(tracktitle, trackid) = get_trackid_from_text_search(userinput,'Justin Bieber') |
92 (tracktitle, trackid) = get_trackid_from_text_search(userinput,'Justin Bieber') | 92 (tracktitle, trackid) = get_trackid_from_text_search(userinput,'') |
93 | |
93 audio_url = get_preview_from_trackid(trackid) | 94 audio_url = get_preview_from_trackid(trackid) |
94 | 95 |
95 content = content + '''<div style="text-align:center"><p><a href=" %s ">''' % audio_url + '''<b> %s </b>''' % userinput | 96 content = content + '''<div style="text-align:center"><p><a href=" %s ">''' % audio_url + '''<b> %s </b>''' % userinput |
96 | 97 |
97 file_name = tracktitle + u'.mp3' | 98 file_name = tracktitle + u'.mp3' |
103 file_name = "Baby.mp3" | 104 file_name = "Baby.mp3" |
104 # download the song in the same path folder | 105 # download the song in the same path folder |
105 path_name = './' + file_name | 106 path_name = './' + file_name |
106 mp3 = download_file(audio_url, path_name) | 107 mp3 = download_file(audio_url, path_name) |
107 | 108 |
109 os.system('ffmpeg -i Baby.mp3 -ac 1 Baby.wav') | |
108 os.system('./sonic-annotator-0.7-osx-x86_64/sonic-annotator -d vamp:mtg-melodia:melodia:melody Baby.wav -w csv --csv-one-file baby.txt --csv-separator " " ') | 110 os.system('./sonic-annotator-0.7-osx-x86_64/sonic-annotator -d vamp:mtg-melodia:melodia:melody Baby.wav -w csv --csv-one-file baby.txt --csv-separator " " ') |
109 os.system('ffmpeg -i Baby.mp3 -ac 1 Baby.wav') | 111 |
110 | 112 |
111 print "Pitch Shifting Done" | 113 print "Pitch Shifting Done" |
112 | 114 |
113 os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step1('Baby.wav');exit;\" ") | 115 os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step1('Baby.wav');exit;\" ") |
114 #os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step1('Baby.wav');exit;\" ") | 116 #os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step1('Baby.wav');exit;\" ") |
121 | 123 |
122 print "Done STEP 1" | 124 print "Done STEP 1" |
123 | 125 |
124 # light version | 126 # light version |
125 pitchshifting5('melody.wav','melody_ps5.wav') | 127 pitchshifting5('melody.wav','melody_ps5.wav') |
126 | 128 print "pitch shifting 5" |
127 # heaven version | 129 # heaven version |
128 pitchshifting12('melody.wav','melody_ps12.wav') | 130 pitchshifting12('melody.wav','melody_ps12.wav') |
129 | 131 |
130 | 132 |
131 os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step3('melody_ps5.wav');exit;\"") | 133 os.system("/Applications/MATLAB_R2012b.app/bin/matlab -nojvm -nosplash -nodisplay -r \"step3('melody_ps5.wav');exit;\"") |