Skip to content

Commit abfc636

Browse files
chore(refactor): updated the quickstart to use gcs (GoogleCloudPlatform#1238)
1 parent 56e90d3 commit abfc636

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

speech/quickstart.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,16 @@
2626
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
2727

2828
# The name of the audio file to transcribe
29-
$audioFile = __DIR__ . '/test/data/audio32KHz.raw';
30-
31-
# get contents of a file into a string
32-
$content = file_get_contents($audioFile);
29+
$gcsURI = "gs://cloud-samples-data/speech/brooklyn_bridge.raw";
3330

3431
# set string as audio content
3532
$audio = (new RecognitionAudio())
36-
->setContent($content);
33+
->setUri($gcsURI);
3734

3835
# The audio file's encoding, sample rate and language
3936
$config = new RecognitionConfig([
4037
'encoding' => AudioEncoding::LINEAR16,
41-
'sample_rate_hertz' => 32000,
38+
'sample_rate_hertz' => 16000,
4239
'language_code' => 'en-US'
4340
]);
4441

0 commit comments

Comments
 (0)