def process(request, pmei_id): # query db for the mei file containing the pitch information pmei = get_object_or_404(MeiPitch, pk=pmei_id) try: frets = int(request.GET['frets']) capo = int(request.GET['capo']) tuning = request.GET['tuning'] pitch_sanitize_prune = True if request.GET['sanitize'] == 'prune' else False except KeyError: return HttpResponse("Need to specify number of frets, capo position, and guitar tuning") guitar = GuitarModel( num_frets=frets, capo=capo, tuning=tuning ) guitar.save() taber = Tabulate(fk_pmei=pmei, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the start timestamp taber.save() # TODO: create spinner on interface taber.gen_tab() # redirect to tab display page return HttpResponseRedirect('/display/%d' % taber.fk_tmei.id)
def process(request, pmei_id): # query db for the mei file containing the pitch information pmei = get_object_or_404(MeiPitch, pk=pmei_id) try: frets = int(request.GET['frets']) capo = int(request.GET['capo']) tuning = request.GET['tuning'] pitch_sanitize_prune = True if request.GET[ 'sanitize'] == 'prune' else False except KeyError: return HttpResponse( "Need to specify number of frets, capo position, and guitar tuning" ) guitar = GuitarModel(num_frets=frets, capo=capo, tuning=tuning) guitar.save() taber = Tabulate(fk_pmei=pmei, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the start timestamp taber.save() # TODO: create spinner on interface taber.gen_tab() # redirect to tab display page return HttpResponseRedirect('/display/%d' % taber.fk_tmei.id)
def transcribe(self, frets, capo, tuning, pitch_sanitize_prune, audio_url): # get path of audio file being transcribed path = os.path.join(settings.MEDIA_ROOT, str(self.fk_audio.audio_file)) #################### # PITCH ESTIMATION # #################### guitar = GuitarModel( num_frets=frets, capo=capo, tuning=tuning ) guitar.save() pestimator = PitchDetect(fk_audio=self.fk_audio, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the analysis start timestamp pestimator.save() pestimator.estimate_pitches(audio_url) # attach the pitch detection analysis information to the transcription model self.fk_pid = pestimator ######################## # TABLATURE GENERATION # ######################## taber = Tabulate(fk_pmei=self.fk_pid.fk_pmei, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the analysis start timestamp taber.save() taber.gen_tab() # attach the tablature to the transcription model self.fk_tabid = taber self.save()
def transcribe(self, frets, capo, tuning, pitch_sanitize_prune, audio_url): # get path of audio file being transcribed path = os.path.join(settings.MEDIA_ROOT, str(self.fk_audio.audio_file)) #################### # PITCH ESTIMATION # #################### guitar = GuitarModel(num_frets=frets, capo=capo, tuning=tuning) guitar.save() pestimator = PitchDetect(fk_audio=self.fk_audio, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the analysis start timestamp pestimator.save() pestimator.estimate_pitches(audio_url) # attach the pitch detection analysis information to the transcription model self.fk_pid = pestimator ######################## # TABLATURE GENERATION # ######################## taber = Tabulate(fk_pmei=self.fk_pid.fk_pmei, fk_guitar=guitar, pitch_sanitize_prune=pitch_sanitize_prune) # writing to the database writes the analysis start timestamp taber.save() taber.gen_tab() # attach the tablature to the transcription model self.fk_tabid = taber self.save()