예제 #1
0
파일: views.py 프로젝트: gburlet/robotaba
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)
예제 #2
0
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)
예제 #3
0
파일: models.py 프로젝트: gburlet/robotaba
    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()
예제 #4
0
    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()