A useful tool to generate chord progressions according to melody MIDIs

Overview

CHORDERATOR

A useful tool to generate chord progressions according to melody MIDIs

Demo

import chorderator as cdt

# set your input MIDI path
cdt.set_melody('MIDI demos/inputs/4.mid')

# set phrase for your melody. If your melody have only one phrase, simply
# call set_phrase([1]) or remove the statement
cdt.set_phrase([1])

# set melody meta. tonic, mode, and meter must be specified
cdt.set_meta(tonic=cdt.Key.C, mode=cdt.Mode.MAJOR, meter=cdt.Meter.FOUR_FOUR)

# choose an output chord style; default is STANDARD
cdt.set_output_chord_style(cdt.ChordStyle.STANDARD)

# choose an output progression style; default is POP
cdt.set_output_progression_style(cdt.ProgressionStyle.POP)

# generate the progression. please specify the output MIDI path
cdt.generate('MIDI demos/outputs/generated.mid')
Comments
  • Tensor error

    Tensor error

    Hey @billyblu2000

    I am getting a strange tensor error on my test melody. So I was wondering if you can help me out to figure out what I am doing wrong...

    Here is the traceback:

    Searching for Phrase 1 Searching for Phrase 2 Searching for Phrase 3 Reference chosen: [(144, '倒带'), (144, '倒带'), (144, '倒带')] Pitch Transposition (Fit by Model): [-3, 2, 2] Generating... Traceback (most recent call last): File "demo.py", line 14, in <module> cdt.generate_save(demo_name + '_output_results') File "/content/AccoMontage2/chorderator/interaction.py", line 91, in generate_save return _core.generate_save(output_name=output_name, task=task, log=log, wav=wav, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 392, in generate_save log=True, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 361, in generate gen = self.run(cut_in, cut_in_arg, with_texture, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 294, in run **kwargs) File "/content/AccoMontage2/chorderator/utils/pipeline.py", line 62, in send_in self.final_output = self.__add_textures(self.chord_gen_output, self.final_output_log, **kwargs) File "/content/AccoMontage2/chorderator/utils/pipeline.py", line 113, in __add_textures processor.solve() File "/content/AccoMontage2/chorderator/utils/models/accomontage/AccoMontage.py", line 122, in solve midi = render_acc(piano_roll, chord_table, query_seg, path, shift, acc_pool, state_dict=self.state_dict) File "/content/AccoMontage2/chorderator/utils/models/accomontage/util_tools/AccoMontage.py", line 248, in render_acc est_x = model.inference(pr_matrix, gt_chord, sample=False) File "/content/AccoMontage2/chorderator/utils/models/accomontage/models/model.py", line 139, in inference dec_z = torch.cat([z_chd, z_rhy], dim=-1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 10 but got size 8 for tensor number 1 in the list.

    My demo.py file is setup as such:

    `import chorderator as cdt

    if name == 'main':

    demo_name = 'test'
    input_melody_path = 'MIDI demos/inputs/' + demo_name + '/melody.mid'
    
    cdt.set_melody(input_melody_path)
    cdt.set_meta(tonic=cdt.Key.D)
    cdt.set_segmentation('A4B8A4')
    cdt.set_texture_prefilter((0, 2))
    cdt.set_note_shift(0)
    cdt.set_output_style(cdt.Style.POP_STANDARD)
    cdt.generate_save(demo_name + '_output_results')`
    

    And the melody MIDI is attached.

    Thank you. melody.zip

    opened by asigalov61 7
  • Generating with custom melody

    Generating with custom melody

    Hello,

    First of all, I wanted to thank you very much for your great work! Its awesome and I really like it. :)

    I have a question... Is it possible to generate output with a custom melody? Or is it not supported yet?

    I tried replacing melody.mid with my own midi but it does not work.

    I attached my midi file for your review and your help with this issue would be really appreciated.

    Thank you.

    Here is the error I am getting on my midi: melody.zip

    @Chorderator 2022-09-03 20:12:51,076 - INFO - Melody length 4, generate progression with 63 templates no matched length Traceback (most recent call last): File "demo.py", line 14, in <module> cdt.generate_save(demo_name + '_output_results') File "/content/AccoMontage2/chorderator/interaction.py", line 91, in generate_save return _core.generate_save(output_name=output_name, task=task, log=log, wav=wav, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 392, in generate_save log=True, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 361, in generate gen = self.run(cut_in, cut_in_arg, with_texture, **kwargs) File "/content/AccoMontage2/chorderator/core.py", line 294, in run **kwargs) File "/content/AccoMontage2/chorderator/utils/pipeline.py", line 53, in send_in progression_list = self.__main_model(splited_melo, self.meta) File "/content/AccoMontage2/chorderator/utils/pipeline.py", line 78, in __main_model processor.solve() File "/content/AccoMontage2/chorderator/utils/models/DP.py", line 153, in solve max_score = max([self._dp[-1][i][1] for i in range(min([self.max_num, len(templates[-1])]))]) ValueError: max() arg is an empty sequence

    opened by asigalov61 7
  • Missing data files

    Missing data files

    Hi there @billyblu2000,

    Looks like very cool work you're doing here - thanks 🙂

    I tried to run your project, and I found that several data files required to be in the 'chorderator/static' directory are missing (as per your .gitignore file). For example, the 'chorderator/static/model_master_final.pt' seems to be missing, as also 'chorderator/static/phrase_data0714.npz' and 'edge_weights_0714.npz'.

    Would you be able to share these files by any chance please? It'd be great to try out your project 🙂

    Thanks & all the best, Shaun

    opened by smcio 7
  • Where are files model_master_final.pt and phrase_data0714.npz ?

    Where are files model_master_final.pt and phrase_data0714.npz ?

    Issue 1 says: https://github.com/billyblu2000/AccoMontage2/issues/1 But I can't find them. Where are files model_master_final.pt and phrase_data0714.npz ?

    opened by taktak1 3
  • Generating with pop 909 dataset

    Generating with pop 909 dataset

    I'm trying demo.pyusing one of data in pop909 dataset (only keep melody track), but it didn't work, full message as below. The file is as attach, can you help me to check whats the problem? Thanks!

      warnings.warn('Could not import FluidSynth, audio formats writing disabled')
    /mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/core.py:238: UserWarning: Meter auto set to 4/4/. Please set meter if this is not your expectation
      warnings.warn('Meter auto set to 4/4/. Please set meter if this is not your expectation')
    /mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/core.py:241: UserWarning: Mode auto set to major. Please set mode if this is not your expectation
      warnings.warn('Mode auto set to major. Please set mode if this is not your expectation')
    @Chorderator 2022-11-01 16:52:42,695 - INFO -  start read progressions from dict 
    @Chorderator 2022-11-01 16:52:48,565 - INFO -  read progressions done 
    @Chorderator 2022-11-01 16:52:48,566 - INFO -  start read progression library from source_base.pnt 
    @Chorderator 2022-11-01 16:52:55,625 - INFO -  read library done 
    @Chorderator 2022-11-01 16:52:55,626 - WARNING -  Pre-processing... 
    {'tonic': 'G', 'meter': '4/4', 'mode': 'maj', 'pos': ['x', 'x', 'x', 'x'], 'tempo': 61.000034566686246, 'unit': 0.24590150000000002}
    Traceback (most recent call last):
      File "demo.py", line 15, in <module>
        cdt.generate_save(demo_name + '_output_results')
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/interaction.py", line 91, in generate_save
        return _core.generate_save(output_name=output_name, task=task, log=log, wav=wav, **kwargs)
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/core.py", line 391, in generate_save
        gen, chord_gen, gen_log = self.generate(cut_in=cut_in, cut_in_arg=cut_in_arg, with_texture=with_texture,
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/core.py", line 361, in generate
        gen = self.run(cut_in, cut_in_arg, with_texture, **kwargs)
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/core.py", line 275, in run
        self.pipeline.send_in(self.midi_path,
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/utils/pipeline.py", line 49, in send_in
        self.melo, splited_melo, self.meta = self.__preprocess(midi_path, **kwargs)
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/utils/pipeline.py", line 71, in __preprocess
        return processor.get()
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/utils/models/PreProcessor.py", line 40, in get
        handle_exception(312)
      File "/mnt/e2203fdf-08ef-4193-9c98-04fcd3f8df26/AccoMontage2/chorderator/utils/excp.py", line 59, in handle_exception
        raise ValueError('[Error {e}] '.format(e=code) + msg + website)
    ValueError: [Error 312] Phrase length not accepted. Up to the current version, only the following length is supported: 4, 8, 12, 16, 24, 32. For more information, please visit https://...com.```
    
    
    [melody.zip](https://github.com/billyblu2000/AccoMontage2/files/9908706/melody.zip)
    
    opened by Wayne-wonderai 1
Owner
Billy Yi
Junior at NYU Shanghai, major in CS and DS
Billy Yi
Convert complex chord names to midi notes

ezchord Simple python script that can convert complex chord names to midi notes Prerequisites pip install midiutil Usage ./ezchord.py Dmin7 G7 C timi

Alex Zhang 2 Dec 20, 2022
Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files according to their common names

Batch Sorting Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files accord

David Mainoo 1 Oct 29, 2021
A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.

Audiomentations A Python library for audio data augmentation. Inspired by albumentations. Useful for deep learning. Runs on CPU. Supports mono audio a

Iver Jordal 1.2k Jan 7, 2023
A small project where I identify notes and key harmonies in a piece of music and use them further to recreate and generate the same piece of music through Python

A small project where I identify notes and key harmonies in a piece of music and use them further to recreate and generate the same piece of music through Python

null 5 Oct 7, 2022
A Python port and library-fication of the midicsv tool by John Walker.

A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.

Tim Wedde 52 Dec 29, 2022
A tool for retrieving audio in the past

Rewinder A tool for retrieving audio in the past. Ever felt like, I need to remember that discussion which happened 10 min back. Now you can! Rewind a

Bharat 1 Jan 24, 2022
A simple Python app that generates semi-random chord progressions.

chords-generator A simple Python app that generates semi-random chord progressions.

null 53 Sep 7, 2022
A collection of free MIDI chords and progressions ready to be used in your DAW, Akai MPC, or Roland MC-707/101

A collection of free MIDI chords and progressions ready to be used in your DAW, Akai MPC, or Roland MC-707/101

null 921 Jan 5, 2023
PyTorch implementation of the paper:A Convolutional Approach to Melody Line Identification in Symbolic Scores.

Symbolic Melody Identification This repository is an unofficial PyTorch implementation of the paper:A Convolutional Approach to Melody Line Identifica

Sophia Y. Chou 3 Feb 21, 2022
Convert complex chord names to midi notes

ezchord Simple python script that can convert complex chord names to midi notes Prerequisites pip install midiutil Usage ./ezchord.py Dmin7 G7 C timi

Alex Zhang 2 Dec 20, 2022
Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files according to their common names

Batch Sorting Using python to generate a bat script of repetitive lines of code that differ in some way but can sort out a group of audio files accord

David Mainoo 1 Oct 29, 2021
It is a useful project for developers that includes useful tools for Instagram

InstagramIG It is a useful project for developers that includes useful tools for Instagram Installation : pip install InstagramIG Logan Usage from In

Sidra ELEzz 14 Mar 14, 2022
A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/

This is a PyPI mirror client according to PEP 381 + PEP 503 http://www.python.org/dev/peps/pep-0381/. bandersnatch >=4.0 supports Linux, MacOSX + Wind

Python Packaging Authority 345 Dec 28, 2022
Bot simply search for the files from provided channel according to given query and gives link to those files as buttons!

Auto Filter Bot ㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤ You can call this as an Auto Filter Bot if you like :D Bot simply search for the files from provided channel according

TroJanzHEX 89 Nov 23, 2022
A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/

This is a PyPI mirror client according to PEP 381 + PEP 503 http://www.python.org/dev/peps/pep-0381/. bandersnatch >=4.0 supports Linux, MacOSX + Wind

Python Packaging Authority 345 Dec 28, 2022
A maubot plugin to invite users to Matrix rooms according to LDAP groups

LDAP Inviter Bot This is a maubot plugin that invites users to Matrix rooms according to their membership in LDAP groups.

David Mehren 14 Dec 9, 2022
An attendance bot that joins google meet automatically according to schedule and marks present in the google meet.

Google-meet-self-attendance-bot An attendance bot which joins google meet automatically according to schedule and marks present in the google meet. I

Sarvesh Wadi 12 Sep 20, 2022
Fetch torrent links from nyaa, according to releases by smoke index.

Nyaa - Smoke's index torrent fetcher Description This script parses the local (or online) anime release index (csv format) made by Big Smoke. And uses

Dinank 21 Jun 8, 2022
This YoloV5 based model is fit to detect people and different types of land vehicles, and displaying their density on a fitted map, according to their coordinates and detected labels.

This YoloV5 based model is fit to detect people and different types of land vehicles, and displaying their density on a fitted map, according to their

Liron Bdolah 8 May 22, 2022