def External_use(mid, divide_len, sampling_rate,
                 len_wav):  # 외부에서는 이 함수를 통해 이 모듈에 접근해야한다.

    import m4_1_middle_preprocessing
    import m4_2_middle2_preprocessing

    ticks = mid.ticks_per_beat

    middle_mid = m4_1_middle_preprocessing.External_use(mid, ticks)
    conceive_mid_data = m4_2_middle2_preprocessing.External_use(
        middle_mid, divide_len, sampling_rate, len_wav)

    return conceive_mid_data
Exemple #2
0

if __name__ == "__main__":
    import m4_1_middle_preprocessing as m4_1

    dir = 'C:\\Users\\TH\\Desktop\\music\\music composer\\01 Start\\'

    songname = 'to_1_8'

    mid_filename = dir + songname + '.mid'
    wav_filename = dir + songname + '.wav'

    import mido

    mid = mido.MidiFile(mid_filename)
    middle_mid = m4_1.External_use(mid, mid.ticks_per_beat)

    import mido
    import m3_1_conceive_mid_preprocessing
    from pydub import AudioSegment

    wav = AudioSegment.from_wav(wav_filename)
    wave = wave_opener(wav_filename)

    divide_len = 220
    sampling_rate = wav.frame_rate
    len_wav = len(wave[0])

    mid = mido.MidiFile(mid_filename)
    conceive_mid_data = m3_1_conceive_mid_preprocessing.External_use(
        mid, divide_len, sampling_rate, len_wav)
Exemple #3
0
        # Split the data into channels
        channels = [[] for channel in range(wav_file.getnchannels())]
        for index, datum in enumerate(signal):
            channels[index % len(channels)].append(datum)

        return channels


if __name__ == "__main__":

    mid_filename = "C:\\Users\\TH\\Desktop\\music composer\\midi\\way back home.mid"
    wav_filename = "C:\\Users\\TH\\Desktop\\music composer\\midi\\way back home.wav"

    import mido
    import m4_1_middle_preprocessing
    from pydub import AudioSegment
    import wave

    wav = AudioSegment.from_wav(wav_filename)
    wave = wave_opener(wav_filename)

    mid = mido.MidiFile(mid_filename)
    middle_mid = m4_1_middle_preprocessing.External_use(
        mid, mid.ticks_per_beat)

    divide_len = 220

    middle_flat = External_use(middle_mid, divide_len, wav.frame_rate,
                               len(wave[0]))
    print(middle_flat)