|
28 | 28 | $inputDefinition = new InputDefinition([ |
29 | 29 | new InputArgument('text', InputArgument::REQUIRED, |
30 | 30 | 'Text/SSML to synthesize.') |
| 31 | + |
| 32 | +]); |
| 33 | + |
| 34 | +$inputDefinitionEffectsProfile = new InputDefinition([ |
| 35 | + new InputArgument('text', InputArgument::REQUIRED, |
| 36 | + 'Text/SSML to synthesize.'), |
| 37 | + new InputArgument('effects_profile_id', InputArgument::REQUIRED, |
| 38 | + 'Audio Profile.') |
31 | 39 | ]); |
32 | 40 |
|
33 | 41 | $inputDefinitionFile = new InputDefinition([ |
34 | 42 | new InputArgument('path', InputArgument::REQUIRED, 'File to synthesize.') |
35 | 43 | ]); |
36 | 44 |
|
| 45 | +$inputDefinitionEffectsProfileFile = new InputDefinition([ |
| 46 | + new InputArgument('path', InputArgument::REQUIRED, 'File to synthesize.'), |
| 47 | + new InputArgument('effects_profile_id', InputArgument::REQUIRED, |
| 48 | + 'Audio Profile.') |
| 49 | +]); |
| 50 | + |
37 | 51 |
|
38 | 52 | $application->add(new Command('list-voices')) |
39 | 53 | ->setDescription('List the available voices') |
|
78 | 92 | }) |
79 | 93 | ); |
80 | 94 |
|
| 95 | +$application->add((new Command('synthesize-text-effects-profile')) |
| 96 | + ->setDefinition($inputDefinitionEffectsProfile) |
| 97 | + ->setDescription('Synthesizes speech from the input string of text using Audio Profiles') |
| 98 | + ->setHelp(<<<EOF |
| 99 | +The <info>%command.name%</info> command synthesizes speech from the input string |
| 100 | +of text using Google Cloud Text-to-Speech API using Audio Profiles. |
| 101 | + <info>php %command.full_name% "hello there" "wearable-class-device"</info> |
| 102 | +EOF |
| 103 | + ) |
| 104 | + ->setCode(function ($input) { |
| 105 | + $text = $input->getArgument('text'); |
| 106 | + $effectsProfileId = $input->getArgument('effects_profile_id'); |
| 107 | + synthesize_text_effects_profile($text, $effectsProfileId); |
| 108 | + }) |
| 109 | +); |
| 110 | + |
81 | 111 | $application->add((new Command('synthesize-ssml-file')) |
82 | 112 | ->setDefinition($inputDefinitionFile) |
83 | 113 | ->setDescription('Synthesizes speech from the input file of ssml') |
|
108 | 138 | }) |
109 | 139 | ); |
110 | 140 |
|
| 141 | +$application->add((new Command('synthesize-text-effects-profile-file')) |
| 142 | + ->setDefinition($inputDefinitionEffectsProfileFile) |
| 143 | + ->setDescription('Synthesizes speech from the input file of text using Audio Profiles') |
| 144 | + ->setHelp(<<<EOF |
| 145 | +The <info>%command.name%</info> command synthesizes speech from the input file |
| 146 | +of text using Google Cloud Text-to-Speech API using Audio Profiles. |
| 147 | + <info>php %command.full_name% path/to/file.txt "wearable-class-device"</info> |
| 148 | +EOF |
| 149 | + ) |
| 150 | + ->setCode(function ($input) { |
| 151 | + $path = $input->getArgument('path'); |
| 152 | + $effectsProfileId = $input->getArgument('effects_profile_id'); |
| 153 | + synthesize_text_effects_profile_file($path, $effectsProfileId); |
| 154 | + }) |
| 155 | +); |
| 156 | + |
111 | 157 | // for testing |
112 | 158 | if (getenv('PHPUNIT_TESTS') === '1') { |
113 | 159 | return $application; |
|
0 commit comments