示例#1
0
def alankaara_varisai_from_book(arrange_notes_to_speed_and_thaaLa=True, raaga_name=None, save_to_file=None):
    """
        Generate alankaara varisai (from carnatic music lessons book) for the specified raaga
            @param    arrange_notes_to_speed_and_thaaLa    True the notations generated will be fit to speed and thaaLa
            @param    raaga_name    If not specified default raaga from settings will be used
            @param    save_to_file - File name (if specified) to save the results to.
            :return:   alankaara varisai for the selected raaga
    """
    if raaga_name==None:
        raaga_index=settings.RAAGA_INDEX
    else:
        raaga.set_raagam(raaga_name)
        raaga_index = settings.RAAGA_INDEX
    aroganam_length = len(settings.RAAGA_DICT[raaga_index]["Aroganam"].split())
    lesson_file = _ALANKARAM_FILE_PREFIX + str(aroganam_length) + ".inp"
    print('lesson_file',lesson_file)
    if os.path.isfile(lesson_file):
        _, result = cparser.parse_file(lesson_file, arrange_notes_to_speed_and_thaaLa)
        if save_to_file:
            file_object = open(save_to_file,"w")
            file_object.write(result)
            file_object.close()
    else:
        raise ValueError("Feature not implemented for supplied arguments (raaga_index)",raaga_index)
    return result
示例#2
0
def play_notations_from_file(notation_file,
                             instrument=None,
                             include_percussion_layer=False):
    """
        To play notes from the notation file
        @param notation_file    File containing commands, notations - see help
        @param instrument:             Play using the instrument specified. 
                                    Will be overwritten by instruments if specified in the notation_file 
        @param include_percussion_layer    True: Includes Percussion according to the set ThaaLam and Jaathi
                                            ThaaLam and Jaathi can be set using thaaLa.set_thaaLam(thaaLam_Name, Jaathi_Name) 
    """
    if (instrument != None):
        set_instrument(instrument)
    file_carnatic_note_list, _ = cparser.parse_file(notation_file)
    play_notes(file_carnatic_note_list, include_percussion_layer)
示例#3
0
def alankaara_varisai_from_algorithm(arrange_notes_to_speed_and_thaaLa=True, raaga_name=None, thaaLa_name=None, jaathi_name=None, save_to_file=None):
    """
        Generate alankaara varisai (from computer generated algorithm) for the specified raaga
            @param    arrange_notes_to_speed_and_thaaLa    True the notations generated will be fit to speed and thaaLa
            @param    raaga_name    If not specified default raaga from settings will be used
            @param    thaaLa_name   If not specified default thaaLa from settings will be used
            @param    jaathi_name   If not specified default jaathi from settings will be used
                       Use raaga.get_raaga_list() to get the list of raaga names
                       Use thaaLa.get_thaaLam_names() to get the list of thaaLa names
                       Use thaaLa.get_jaathi_names() to get the list of jaathi names
            @param    save_to_file - File name (if specified) to save the results to.
            :return:   alankaara varisai for the selected raaga
    """
    if raaga_name==None:
        raaga_index=settings.RAAGA_INDEX
    else:
        raaga.set_raagam(raaga_name)
        raaga_index = settings.RAAGA_INDEX
    if thaaLa_name==None:
        thaaLa_name = settings.THAALA_NAMES[settings.THAALA_INDEX]
    if jaathi_name==None:
        jaathi_name = settings.JAATHI_NAMES[settings.JAATHI_INDEX]
    thaaLa.set_thaaLam(thaaLa_name, jaathi_name)
    thaaLa_index=settings.THAALA_INDEX
    jaathi_index = settings.JAATHI_INDEX
    #print('lessons','settings.THAALA_INDEX,settings.JAATHI_INDEX,settings.NADAI_INDEX',settings.THAALA_INDEX,settings.JAATHI_INDEX,settings.NADAI_INDEX)
    aroganam_length = len(settings.RAAGA_DICT[raaga_index]["Aroganam"].split())
    f_tmp = str(aroganam_length)+"_"+str(thaaLa_index)+"_"+str(jaathi_index)
    lesson_file = _ALANKARAM_FILE_PREFIX + f_tmp + ".inp"
    print('lesson_file',lesson_file)
    if os.path.isfile(lesson_file):
        _, result = cparser.parse_file(lesson_file, arrange_notes_to_speed_and_thaaLa)
        if save_to_file:
            file_object = open(save_to_file,"w")
            file_object.write(result)
            file_object.close()
    else:
        raise ValueError("Feature not implemented for supplied arguments (raaga_index,thaaLa_index,jaathi_index)",raaga_index,thaaLa_index,jaathi_index)
    return result
示例#4
0
def __melsthaayi_varisai(arrange_notes_to_speed_and_thaaLa=True, raaga_index=None, thaaLa_index=None, jaathi_index=None):
    if raaga_index==None:
        raaga_index=settings.RAAGA_INDEX
    else:
        settings.RAAGA_INDEX = raaga_index
    if thaaLa_index==None:
        thaaLa_index=settings.THAALA_INDEX
    else:
        settings.THAALA_INDEX = thaaLa_index
    if jaathi_index==None:
        jaathi_index = settings.JAATHI_INDEX
    else:
        settings.JAATHI_INDEX = jaathi_index
    tac = thaaLa.total_akshara_count(thaaLa_index, jaathi_index, 0)
    f_tmp = _TAC_LESSON_DICT[tac]
    aroganam_length = len(settings.RAAGA_DICT[raaga_index]["Aroganam"].split())
    lesson_file = _MELSTHAAYI_FILE_PREFIX + str(aroganam_length)+"_a"+str(f_tmp)+".inp"
    print('lesson_file',lesson_file)
    if os.path.isfile(lesson_file):
        _, result = cparser.parse_file(lesson_file, arrange_notes_to_speed_and_thaaLa)
    else:
        raise ValueError("Feature not implemented for supplied arguments (raaga_index,thaaLa_index,jaathi_index)",raaga_index,thaaLa_index,jaathi_index)
    return result