Beispiel #1
0
 /**
  * Creates a playable .wav file
  *
  * @param Voice $voice
  * @return string
  */
 public function getOutput(Voice $voice)
 {
     $files = [];
     foreach ($this->getSpeech() as $word) {
         $files[] = $voice->getDataFolder() . $word . ".wav";
         //Create a full path
     }
     return $this->joinwavs($files);
 }
 public function __construct()
 {
     parent::__construct();
     // load all my voice models
     $this->_load_models();
     $this->log("Controller Create_Ocean loaded.");
 }
 public function __construct()
 {
     parent::__construct();
     // get config and store to private var
     $this->_config = c_get_config();
     // load all my voice models
     $this->_load_models();
     $this->log("Controller Search loaded.");
 }
Beispiel #4
0
 public function __clone()
 {
     $voice = new Voice($this->getIndex());
     $voice->setEmpty($this->isEmpty());
     $voice->setDirection($this->getDirection());
     $voice->getDuration()->copyFrom($this->getDuration());
     for ($i = 0; $i < $this->countNotes(); $i++) {
         $note = $this->notes[$i];
         $voice->addNote(clone $note);
     }
     return $voice;
 }
Beispiel #5
0
 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['chat'])) {
         $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']);
     }
     if (isset($attributes['forward_from'])) {
         $this->forward_from = User::create($attributes['forward_from']);
     }
     if (isset($attributes['forward_from_chat'])) {
         $this->forward_from_chat = Chat::create($attributes['forward_from_chat']);
     }
     if (isset($attributes['reply_to_message'])) {
         $this->reply_to_message = Message::create($attributes['reply_to_message']);
     }
     if (isset($attributes['entities'])) {
         $this->entities = array_map(function ($entity) {
             return MessageEntity::create($entity);
         }, $attributes['entities']);
     }
     if (isset($attributes['audio'])) {
         $this->audio = Audio::create($attributes['audio']);
     }
     if (isset($attributes['document'])) {
         $this->document = Document::create($attributes['document']);
     }
     if (isset($attributes['photo'])) {
         $this->photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['photo']);
     }
     if (isset($attributes['sticker'])) {
         $this->sticker = Sticker::create($attributes['sticker']);
     }
     if (isset($attributes['video'])) {
         $this->video = Video::create($attributes['video']);
     }
     if (isset($attributes['voice'])) {
         $this->voice = Voice::create($attributes['voice']);
     }
     if (isset($attributes['contact'])) {
         $this->contact = Contact::create($attributes['contact']);
     }
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
     if (isset($attributes['venue'])) {
         $this->venue = Venue::create($attributes['venue']);
     }
     if (isset($attributes['new_chat_member'])) {
         $this->new_chat_member = User::create($attributes['new_chat_member']);
     }
     if (isset($attributes['left_chat_member'])) {
         $this->left_chat_member = new User($attributes['left_chat_member']);
     }
     if (isset($attributes['new_chat_photo'])) {
         $this->new_chat_photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['new_chat_photo']);
     }
 }
 public function parseVoice($voiceObject)
 {
     $voice = new Voice();
     $voice->setFileId($voiceObject->file_id);
     $voice->setDuration($voiceObject->duration);
     if (property_exists($voiceObject, 'mime_type')) {
         $voice->setMimeType($voiceObject->mime_type);
     }
     if (property_exists($voiceObject, 'file_size')) {
         $voice->setFileSize($voiceObject->file_size);
     }
     return $voice;
 }