Speech/src/SpeechHelpersTrait.php
public function createAudioStreamFromResource($resource, $chunkSize = 32000)
    {
        while (!feof($resource)) {
            $chunk = fread($resource, $chunkSize);
            if (strlen($chunk) > 0) {
                yield $chunk;
            }
        }
    }
public function createAudioStreamFromResource($resource, $chunkSize = 32000)
    {
        while (!feof($resource)) {
            $chunk = fread($resource, $chunkSize);
            if (strlen($chunk) > 0) {
                yield $chunk;
            }
        }
    }
public function createAudioStreamFromResource ( $ resource , $ chunkSize = 32000 ) { while ( ! feof ( $ resource ) ) { $ chunk = fread ( $ resource , $ chunkSize ) ; if ( strlen ( $ chunk ) > 0 ) { yield $ chunk ; } } }
Convert a PHP resource instance into an iterable of data "chunks".

@param resource $resource   The resource object to read data from.
@param int      $chunkSize  The chunk size to use, in bytes. Defaults to 32000
@return \Generator<string>   An iterable of strings that have been read from the resource.
Convert a PHP resource instance into an iterable of data chunks .