saysynth.cli.commands.font
Given a scale and other parameters, generate a sound-font of each note as an .aiff or .wav file.
1""" 2Given a scale and other parameters, generate a sound-font of each note as an .aiff or .wav file. 3""" 4import click 5from midi_utils import ROOT_TO_MIDI, SCALES 6 7from saysynth.cli.options import (adsr_opts, duration_opts, phoneme_opts, 8 say_opts, segment_opts, text_opt, 9 velocity_opts, volume_level_opts) 10from saysynth.core import Font 11 12 13def run(**kwargs): 14 font = Font(**kwargs) 15 font.play(**kwargs) 16 17 18@click.command() 19@click.option( 20 "-cs", 21 "--scale-start-at", 22 type=str, 23 default="C3", 24 help="Note name/number to start at", 25) 26@click.option( 27 "-ce", 28 "--scale-end-at", 29 type=str, 30 default="G5", 31 show_default=True, 32 help="Note name/number to end at", 33) 34@click.option( 35 "-c", 36 "--scale", 37 type=click.Choice([s.lower() for s in SCALES]), 38 default="minor", 39 show_default=True, 40 help="Scale name to use", 41) 42@click.option( 43 "-k", 44 "--key", 45 type=click.Choice(ROOT_TO_MIDI.keys()), 46 default="C", 47 show_default=True, 48 help="Root note of scale", 49) 50@click.option( 51 "-od", 52 "--output-dir", 53 default="./", 54 type=str, 55 show_default=True, 56 help="Directory to write to", 57) 58@click.option( 59 "-f", 60 "--format", 61 type=click.Choice(["wav", "aiff"]), 62 default="aiff", 63 show_default=True, 64 help="Format of each note's file.", 65) 66@duration_opts 67@phoneme_opts 68@text_opt 69@velocity_opts 70@volume_level_opts 71@adsr_opts 72@segment_opts 73@say_opts 74def cli(**kwargs): 75 """ 76 Given a scale and other parameters, generate a soundfont 77 of each note as an .aiff or .wav file. 78 """ 79 return run(**kwargs)
def
run(**kwargs):
cli = <Command cli>
Given a scale and other parameters, generate a soundfont of each note as an .aiff or .wav file.