saysynth.cli.commands.chord

Synthesize a polyphonic chord.

 1"""
 2Synthesize a polyphonic chord.
 3"""
 4import click
 5from midi_utils import note_to_midi
 6
 7from saysynth.cli.options import (adsr_opts, chord_opts, duration_opts,
 8                                  log_configurations, phoneme_opts, say_opts,
 9                                  segment_opts, start_opts, text_opt,
10                                  velocity_opts, volume_level_opts)
11from saysynth.core import Chord, controller
12
13
14def run(**kwargs):
15    """
16    Given a note name (or midi note number), stream text required to generate a continuous drone for input to say
17    """
18    # generate chord
19    chord = Chord(**kwargs)
20    chord.cli(**kwargs)
21
22
23@click.command()
24@click.argument("root", type=note_to_midi, default="A2")
25@text_opt
26@chord_opts
27@start_opts
28@duration_opts
29@velocity_opts
30@volume_level_opts
31@adsr_opts
32@phoneme_opts
33@segment_opts
34@click.option(
35    "-o",
36    "--output-file",
37    type=str,
38    help="A filepath to write the generated text to. This filepath will be used as a pattern to generate multiple text files, one per note in the chord.",
39)
40@say_opts
41def cli(**kwargs):
42    """
43    Generate a polyphonic chord.
44    """
45    if kwargs["yaml"]:
46        return log_configurations("chord", **kwargs)
47    kwargs = controller.handle_cli_options("chord", **kwargs)
48    return run(**kwargs)
def run(**kwargs):
15def run(**kwargs):
16    """
17    Given a note name (or midi note number), stream text required to generate a continuous drone for input to say
18    """
19    # generate chord
20    chord = Chord(**kwargs)
21    chord.cli(**kwargs)

Given a note name (or midi note number), stream text required to generate a continuous drone for input to say

cli = <Command cli>

Generate a polyphonic chord.