Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Search the Community

Showing results for tags 'text-to-speech'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 3 results

  1. Here is a code lib to control Sonos - it's under development. The goal is to have a code base that's easy to integrate in other projects or build custom QAs. https://raw.githubusercontent.com/jangabrielsson/fibemu/refs/heads/main/lib/Sonos/SonosLib.lua It's based on the local LAN API and using websockets listening for Sonos status changes - no polling(!) Sonos commands sonos:play(playerName) -- Start playing group that player belong to sonos:pause(playerName) -- Pause group that player belong to sonos:volume(playerName,volume) -- Set volume to group that player belong to sonos:relativeVolume(playerName,delta) -- Set relative volume to group that player belong to sonos:mute(playerName,state) -- Mute group that player belong to sonos:togglePlayPause(playerName) -- Toggle play/pause group that player belong to sonos:skipToNextTrack(playerName) -- Skip to next track in group that player belong to sonos:skipToPreviousTrack(playerName) -- Skip to previous track in group that player belong to sonos:playFavorite(playerName,favorite,action,modes) -- Play favorite on group that player belong to sonos:playPlaylist(playerName,playlist,action,modes) -- Play playlist on group that player belong to sonos:playerVolume(playerName,volume) -- Set volume of player sonos:playerRelativeVolume(playerName,delta) -- Set relative volume of player sonos:playerMute(playerName,state) -- Mute player sonos:clip(playerName,url,volume) -- Play audio clip on player sonos:say(playerName,text,volume,lang) -- Play TTS on player sonos:playerGroup(playerName) -- group that player belong to sonos:playersInGroup(playerName) -- players in group that player belong to sonos:createGroup(playerNames,...) -- group players. sonos:removeGroup(groupName) -- remove group. Ex. sonos:removeGroup(sonos:playerGroup(playerName)) sonos:getPlayer(playerName) -- Get player object. Ex. p = sonos:getPlayer(playerName); p:pause() sonos:cb(cb) -- wrap call in callback. Ex. sonos:cb(function(h,data) print(json.encode(h)) end):pause(playerName) Example of use: local function delay(args) local t=0 for i=1,#args,4 do local d,cond,f,doc=args[i],args[i+1],args[i+2],args[i+3] local function f0() print(">"..doc) f() end if cond then t=t+d setTimeout(f0,1000*t) end end end function QuickApp:onInit() self:debug("onInit",self.name,self.id) local clip = "https://github.com/joepv/fibaro/raw/refs/heads/master/sonos-tts-example-eng.mp3" Sonos("192.168.1.225",function(sonos) self:debug("Sonos Ready") function sonos:eventHandler(event) print(event) -- Just print out events, could be used to ex. update UI end print("Players:",sonos.playerNames) print("Groups:",sonos.groupNames) local playerA = sonos.playerNames[1] local playerB = sonos.playerNames[2] local PA = sonos._player[playerA] print("PlayerA:",PA.name,PA.id) local PB = sonos._player[playerB] print("PlayerB:",PB.name,PB.id) local favorite1 = (sonos.favorites[1] or {}).name local playlist1 = (sonos.playlists[1] or {}).name print(("PlayerA='%s', PlayerB='%s'"):format(playerA,playerB)) print(("Favorite1='%s', Playlist1='%s'"):format(favorite1,playlist1)) local function callback(headers,data) print("Callback",headers,data) end delay{ 1,playerA,function() sonos:say(playerA,"Hello world",25) end, "TTS clip to player", 2,playerB,function() sonos:say(playerB,"Hello world again",25) end, "TTS clip to player", 2,playerA,function() sonos:clip(playerA,clip,25) end, "Audio clip to player with volume", 2,playerA,function() sonos:play(playerA) end, "Play group that player belongs to", 2,playerA,function() sonos:pause(playerA) end, "Pause group that player belongs to", 2,playerB,function() sonos:play(playerB) end, "Play group that player belongs to", 2,playerB,function() sonos:cb(callback):pause(playerB) end, "Pause group that player belongs to", 2,playerB and favorite1,function() sonos:playFavorite(playerB,favorite1) end, "Play favorite in group that player belongs to", 4,playerB,function() sonos:pause(playerB) end, "Pause group that player belongs to", 4,playerB and playlist1,function() sonos:playPlaylist(playerB,playlist1) end, "Play favorite in group that player belongs to", 4,playerB,function() sonos:pause(playerB) end, "Pause group that player belongs to", 5,playerA and playerB,function() sonos:createGroup(playerB,playerA) end, "Create group with players", 10,playerA,function() sonos:play(playerA) end, "Play group that playerA belongs to (both players)", 4,playerA,function() sonos:removeGroup(sonos:playerGroup(playerA)) end, "Destroy group playerA belongs to", 4,playerA,function() sonos:play(playerA) end, "Play group that playerA belongs to (only playerA)", } sonos:volume(playerA,40) -- set volume to group that player belongs to sonos:playerVolume(playerA,30) -- set player volume local pl = sonos:getPlayer(playerA) pl:pause() local group = sonos:playerGroup(playerA) -- get group that player belongs to local players = sonos:playersInGroup(sonos:playerGroup(playerA)) -- get players in group end,{socket=true}) -- debug flags end end The sonos object when created does some initialization and when ready call a callback function, in this case the main of the example, logging and testing functionality. More to come... Here is an example of a QA that uses the library. The QA is very reactive on changes in the system. Because the current HC3 UI model is a mess this QA is just a proof-of-concept. The QA's type is com.fibaro.player which doesn't render in the mobile app withe the new UI... However, it works in the web UI. Switching to the old UI model makes the interface a bit ugly as drop-downs miss labels etc... In the future it will hopefully be possible to create more beautiful app compatible QAs... It's also hardcoded to the IP of my sonos, so it requires some coding to get running on your system 😉 SonosPlayer.fqa ---@diagnostic disable: undefined-global -- Player type should handle actions: play, pause, stop, next, prev, setVolume, setMute --%%name=SonosPlayer --%%type=com.fibaro.player local player,sonos -- UI buttons - send command to Sonos function QuickApp:play() sonos:play(player) end function QuickApp:pause() sonos:pause(player) end function QuickApp:stop() sonos:pause(player) end function QuickApp:next() sonos:skipToNextTrack(player) end function QuickApp:prev() sonos:skipToPreviousTrack(player) end function QuickApp:setVolume(volume) sonos:volume(player,volume) end function QuickApp:setMute(mute) sonos:mute(player,mute~=0) end function QuickApp:selectPlayer(ev) player = ev.values[1] self:updatePlayer() end local function mode(m) local group = sonos._group[sonos._player[player].groupId] return (group.playModes or {})[m]==true end function QuickApp:doShuffle() sonos:setModes(player,{shuffle=not mode('shuffle')}) end function QuickApp:doRepeat() sonos:setModes(player,{['repeat']=not mode('repeat')}) end function QuickApp:doRepeat1() sonos:setModes(player,{repeatOne=not mode('repeatOne')}) end function QuickApp:doCrossFade() sonos:setModes(player,{crossfade=not mode('crossfade')}) end function QuickApp:speakTime() sonos:say(player,"Time is "..os.date("%H:%M")) end function QuickApp:favoriteSelected(ev) sonos:playFavorite(player,tostring(ev.values[1])) end function QuickApp:playlistSelected(ev) sonos:playPlaylist(player,tostring(ev.values[1])) end local groupsSelected = {} function QuickApp:groupSelected(ev) groupsSelected=ev.values[1] end function QuickApp:applyGrouping(ev) print("SEL:",json.encode(groupsSelected)) -- sonos.createGroup(groupsSelected) end function QuickApp:setLabel(name,str) --self:updateView(name,"text",string.format("<font size='2'><b>%s</b></font>",str)) self:updateView(name,"text",str) end function QuickApp:updatePlayer() local group = sonos._group[sonos._player[player].groupId] self:updateView('playerLabel','text',"Player: "..(player or "")) self:updateView("statusLabel","text","Status: "..(group.status or "")) self:updateView("artistLabel","text","Artist: "..(group.currentArtist or "")) self:updateView("trackLabel","text","Track: "..(group.currentTrack or "")) self:updateProperty("state",group.status or "") self:updateProperty("volume",group.volume or 0) self:updateProperty("mute",group.muted or false) local modes = group.playModes or {} local m = {} for k,v in pairs(modes) do if v then m[#m+1]=k end end self:updateView("modesLabel","text","Modes: "..table.concat(m,",")) end function QuickApp:setOptions(name,list,fun) local options = {} for _,item in ipairs(list) do local text,value = fun(item) options[#options+1] = {text=text,type='option',value=value} end self:updateView(name,"options",options) end -- Events from the Sonos player local EVENT = {} function EVENT.groupVolume(event) quickApp:updatePlayer() end function EVENT.playerVolume(event) end function EVENT.playbackStatus(event) quickApp:updatePlayer() end function EVENT.metadata(event) quickApp:updatePlayer() end function EVENT.favoritesUpdated() local function fun(i) return i.name,i.id end quickApp:setOptions("favoriteSelector",sonos.favorites,fun) end function EVENT.playlistsUpdated() local function fun(i) return i.name,i.id end quickApp:setOptions("playlistSelector",sonos.playlists,fun) end function QuickApp:onInit() self:debug("Player") quickApp = self Sonos("192.168.1.6",function(_sonos) self:debug("Sonos Ready") sonos = _sonos function sonos:eventHandler(event) if EVENT[event.type] then EVENT[event.type](event) else print("Unhandled event:",json.encode(event)) end end local function fun(i) return i,i end self:setOptions("playerSelector",sonos.playerNames,fun) self:setOptions("groupSelector",sonos.playerNames,fun) player = sonos.playerNames[1] self:updateView("playerSelector","selectedItem", player) self:updateView("playerLabel","text","Player:"..player) end,{socket=true}) -- debug flags end Support will be added for grouping of players. The logic is there but not connected to the UI. The family is using the Sonos player at the moment so I'm not allowed to play with them to verify the code... ;.-)
  2. Version 1.0.0

    144 downloads

    Sending Text-to-Speech message from your Fibaro hub to Alexa devices and Alexa app on mobile phones (Android and iOS). Give a voice to your smart home. Alexa on your mobile will speak all messages/alerts or any other monitoring messages that you need to know at real time. You will know real time what happens, wherever you are.... (internet connection requires) The QA uses 3rd party "Voice Monkey" skill for free. You are just a few minutes away to make your home speaks.📣🔊 The provided QA is an open source and feel free to change it per your requirements.
  3. Hi, I have been working for a while to get an android device working as a text-to-speech engine and to generate speech from text that I can play in any speaker at home, and now I have finally got it working! Android has a pretty good tts engine and you can even configure custom voices that creates speech on languages not yet supported by android itself. Description The scenario is the following: HC2 or some other device wants a text translated to speech, it sends an http request including the text towards the android device, on the android device there is a http server started that receives the request and generates the synthesized speech using androids builtin TextToSpeech api, the android device can then either immediately play the speech in the device and/or store the synthesized content in a file. After successfully generated the speech file the android device sends a request to a configurable "callback url" to notify that the generated .wav file can now be downloaded. I realized during the work, that there are more scenarios than I from the beginning thought of, but the setup I was looking at was the following: However it is not really needed to convert and cache the file, you could also just notify your wifi speaker to play it. A third solution would be to let the android device itself play the speech, either through its internal speaker or via a speaker connected to headphone jacket. Ok so that was the idea and description of different use cases, if you want to try this out you need: Download and install the app on a android device 2. Start the app in Text-to-speech mode 3. Initial configuration 4. Test it 5. Create a scene/vd that sends tts requests. 6. Create a scene/vd that is invoked when tts speech is completed. 7. Download the speech file or tell your speaker system to download and play it. Download and install the app on a android device The app can be downloaded from here (app-debug.apk), you need to allow installation from unknown sources in android this is normally configured through "Android Settings" --> "Security" --> "Unknown Sources" I have tested the app on devices running android 5.0 and 6.0, earlier I also tested it on 4.4 but my samsung s2 finally seemed to give up so I dont know the current status on 4.4. The app needs "Storage" permissions to store the wav file on device. You can find and set the needed permission that by Android Settings --> apps --> --> permissions --> ZenitGatekeeper Short background around the app, I wrote the app originally with another thought in mind and that was to make it easy for the rest of the family to arm/disarm the home alarm (I am currently using the fibaro system as my security system at home), so it is wall mounted in the entrance and works like a keypad where you can arm the alarm or enter a pin to disarm the alarm. Since the device is always on and always connected to wifi I thought I would try to re-use the app also for generating text-to-speech. The app will start a web server and wait for requests, it currently supports a few different types of requests, - /ping : will just respond with 200 ok - /wakeup : will turn on the device screen (I use a fibaro motion sensor that triggers this event) - /tts=msg : will generate a tts file based on the provided message. - /ttsFetch : will return the latest generated speech file. - /log : returns the application logfile At successful text-to-speech generation the app will invoke an configured url to notify that the .wav file is ready. Start the app in Text-to-speech mode Start the app and push the text-to-speech button to start text-to-speech mode. As described above, the app was originally written to be used as a keypad, but I have added a "TTS mode" which only starts the app to be used as a TTS engine. Initial configuration The app needs some basic configuration to work properly, following configuration describes what is needed to get text-to-speech mode to work. Click "Settings" button (default password to settings menu is "1234") -> Application Settings -> Http services -> * "Enable http services" : will start the http server that listens on port 8080. * "Enable Text-To-Speech service" : will enable the text-to-speech function * "Play speech in device" : will play the speech in the device speakers if enabled. * "Text-To-Speech callback URL" : an callback url used to notify the requester that the speech is completed and can be downloaded. Push back button until you get to the TTS mode main page again, now it should look something like this and you should be ready to test it out: Test it To start with you could just open a webbrowser and type http://<ipadress to android device>:8080/tts=hey%20it%20works If it works out properly your android device should now play the speech and you should also receive a callback to your configured callback url. Next step would be to invoke it from your scenes/vd but I guess that is up to you decide how to do. For the interested reader source is available at https://github.com/davandev/AlarmController New releases of the app will be available at https://github.com/davandev/AlarmController/releases Let me know if you run into problems. Cheers
×
×
  • Create New...