LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeScripting

A forum for information about scripting with CastleOS. Get samples, suggestions, and other help here

custom .wav file on castleos Messages in this topic - RSS

B
B
Posts: 79


10/10/2014
B
B
Posts: 79
Hello,
Kept getting close, and with a little clarity at the end (Thank You Chris!), I was able to get a custom .wav file to play. using the custom commands in the Kinect configurator.
here is what the script that works looked like.
the ("@"C:\Users\Public\Music\wiggle.wav"); should reflect wherever on the pc is the .wav you want to play.
I used AVS Audio Editor to trim up the audio file and convert to a .wav file.
this script will play the music from the pc's speaker's... It will not play from the sonos (though I think that would be the best.
this file is saved on the pc running the castleos kinnect service.
it is saved here:
C:\ProgramData\CastleOS\CastleOS Kinect Service\Scripts
you can then go into the castleos Kinect configurator and in Custom commands create a command and then tie the custom script file to it.
Worked for me.
good luck Brian
edited by ccicchitelli on 12/27/2014
0 link
B
B
Posts: 79


10/10/2014
B
B
Posts: 79
B wrote:
Hello,
Kept getting close, and with a little clarity at the end (Thank You Chris!), I was able to get a custom .wav file to play.
using the custom commands in the Kinect configurator.
here is what the script that works looked like.
the ("@"C:\Users\Public\Music\wiggle.wav"); should reflect wherever on the pc is the .wav you want to play.
I used AVS Audio Editor to trim up the audio file and convert to a .wav file.
this script will play the music from the pc's speaker's... It will not play from the sonos (though I think that would be the best.
this file is saved on the pc running the castleos kinnect service.
it is saved here:
C:\ProgramData\CastleOS\CastleOS Kinect Service\Scripts
you can then go into the castleos Kinect configurator and in Custom commands create a command and then tie the custom script file to it.
Worked for me.
good luck Brian

edited by ccicchitelli on 12/27/2014
0 link
Michael Little
Michael Little
Posts: 45


11/19/2014
Michael Little
Michael Little
Posts: 45
Hi - I have a question for you. Where is the documentation for scripting so that I can create my own custom commands in CastleOS? I have a bunch of Insteon devices and I want to trigger them using some short commands, if / then etc.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


11/21/2014
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Michael Little wrote:
Hi - I have a question for you. Where is the documentation for scripting so that I can create my own custom commands in CastleOS? I have a bunch of Insteon devices and I want to trigger them using some short commands, if / then etc.



Hey Michael, there is a sample script in C:\ProgramData\CastleOS\CastleOS Kinect Service\Scripts, and a scripts list in the Kinect Configurator. All you need to do is enter the command text, and pick a script from the list. To add more scripts just add them to the scripts folder. That's it!
0 link
Dominique Garcia
Dominique Garcia
Posts: 55


12/27/2014
Dominique Garcia
Dominique Garcia
Posts: 55
I have to agree with Michael, there is no real method of teaching people on the forum who have no knowledge of scripting how to add custom commands.
0 link
tony john
tony john
Posts: 75


12/27/2014
tony john
tony john
Posts: 75
Totally agree, I know Chris is busy, but I think his software and business would reach a lot more people if there were simple videos on "how to". I would like to see one on how to script, and have computer talk back to you or confirm a command.
0 link
Dominique Garcia
Dominique Garcia
Posts: 55


12/27/2014
Dominique Garcia
Dominique Garcia
Posts: 55
tony john wrote:
Totally agree, I know Chris is busy, but I think his software and business would reach a lot more people if there were simple videos on "how to". I would like to see one on how to script, and have computer talk back to you or confirm a command.



In Chris's defense, teaching someone how to script is no easy task. There are a lot of variables.
0 link
Nick Bento
Nick Bento
Posts: 221


12/27/2014
Nick Bento
Nick Bento
Posts: 221
I think the issue people are running into may just be a misunderstanding. CastleOS has a Scripting API (Advanced Programming Interface). This isn't so much a language, but rather an interface compatible with an existing programming language (in this case .NET C#). The only thing unique to castleOS is the ScriptingAPI.Speak method inside of the CastleOSKinectService package. Everything else in the script is entirely C#, and could be written and ran without even having CastleOS installed. So I think the larger issue is that you really need some experience/basic understanding of C# to really utilize the full potential of the custom commands/scripting. The demo script included is really basic and doesn't really cover any of the real advanced structure or functions of C#.
That all being said, maybe a few simple example codes would be helpful to people to get them started so that they can start to learn the coding language, though I would say in Chris's defense that's not really the responsibility of his company; Other companies make these API's for their products, such as Nest, Sonos, Google, etc. in a variety of languages and leave it up to the user to figure out how to use them.
Generally what I try to do if I'm stuck is google around for something like "How to open program in C# .NET" or something similar, and you'll probably find some code examples you can use as a guide to get started.
Just for an example of something more advanced that can be done with C#, I've attached a script I originally was using on a different HA platform, that I then ported to CastleOS (it was written in VB.NET using API calls from HomeSeer, which I then converted to C# and have using API calls from CastleOS). It interfaces to a Plex Media Server and queries it to see what new shows are on deck, then tells me whether or not new shows are on deck and what they are, speaking the items and response out loud via CastleOS. It uses a good amount of some more advanced features of the C# language, hopefully it is helpful to someone!

(Also just want to say I don't work for CastleOS or anything, I'm just a Computer Scientist graduate, who is a programmer/IT professional by trade smile )

--
-Nick B.


Attachments:
PlexOnDeckCheck.cs
0 link
Dominique Garcia
Dominique Garcia
Posts: 55


12/28/2014
Dominique Garcia
Dominique Garcia
Posts: 55
Nick Bento wrote:
I think the issue people are running into may just be a misunderstanding. CastleOS has a Scripting API (Advanced Programming Interface). This isn't so much a language, but rather an interface compatible with an existing programming language (in this case .NET C#). The only thing unique to castleOS is the ScriptingAPI.Speak method inside of the CastleOSKinectService package. Everything else in the script is entirely C#, and could be written and ran without even having CastleOS installed. So I think the larger issue is that you really need some experience/basic understanding of C# to really utilize the full potential of the custom commands/scripting. The demo script included is really basic and doesn't really cover any of the real advanced structure or functions of C#.
That all being said, maybe a few simple example codes would be helpful to people to get them started so that they can start to learn the coding language, though I would say in Chris's defense that's not really the responsibility of his company; Other companies make these API's for their products, such as Nest, Sonos, Google, etc. in a variety of languages and leave it up to the user to figure out how to use them.
Generally what I try to do if I'm stuck is google around for something like "How to open program in C# .NET" or something similar, and you'll probably find some code examples you can use as a guide to get started.
Just for an example of something more advanced that can be done with C#, I've attached a script I originally was using on a different HA platform, that I then ported to CastleOS (it was written in VB.NET using API calls from HomeSeer, which I then converted to C# and have using API calls from CastleOS). It interfaces to a Plex Media Server and queries it to see what new shows are on deck, then tells me whether or not new shows are on deck and what they are, speaking the items and response out loud via CastleOS. It uses a good amount of some more advanced features of the C# language, hopefully it is helpful to someone!

(Also just want to say I don't work for CastleOS or anything, I'm just a Computer Scientist graduate, who is a programmer/IT professional by trade smile )



Personally, I think you are correct. However, a lot of people do not have the knowledge or time to sit there and learn something for what some probably see as a hobby. Some sort of template and a real YouTube video tutorial is needed for those who have no interest in learning C#.

I've seen this same problem with other piece of software, in the end people did not take the time to learn even though it opened up what their software could do.

I want CastleOS to succeed, if they plan on becoming a world renowned company one day, they need to address issues like this now.
0 link
tony john
tony john
Posts: 75


12/29/2014
tony john
tony john
Posts: 75
The simple answer is, and simple for a computer software programmer to write would be for example...
Please write what question or statement you would like? E.g 'hi computer, how are you?'
Please write what the computer answer will be? E.g 'I'm doing quite fine thank you'


Now to start someone off like this, instead of finding the right answer and putting in "" your question, then saving it then trying to find it on your PC to answer the question/statement, would it be easier if a program was written into castleOs in the first place.
I'm sure all you coders would be able to create it?
Or is that to hard?
Simple is best!
0 link
Nick Bento
Nick Bento
Posts: 221


12/29/2014
Nick Bento
Nick Bento
Posts: 221
I'd agree that would be useful for a scenario like that, could be a good feature suggestion (I think I might have even seen that on the feature requests forums at one point, not sure). I think the purpose of the scripting is for things that go above and beyond the core set of features of the software though (like interfacing with software that either isn't incorporated into the core yet, or for interfacing with other services/servers). For doing a simple verbal question/response type of thing a script may be a bit complex for many to implement, and people may not want to write a bunch of 3 line scripts over and over for different responses, I can understand that.

--
-Nick B.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


12/30/2014
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Hey everyone, sorry for the confusion! Nick, thanks for helping to explain things, you're right on point! We don't try to teach scripting or C# - to be perfectly honest not only are we not good at that, there are a lot of great resources out there that do it extremely well already. We chose C# as our scripting language because it's either known by many people, or easily learned by anyone with experience scripting, as well as being extremely powerful and flexible - you can literally do anything with it.

That said what we will do is teach how the CastleOS Scripting API can be used as it evolves. Right now it only ships with the Speak capability.. ironically Tony's example of what we could show is the only example we do ship with the software. The "hi computer how are you?" question would be the custom command, and the "i'm doing quite fine thank you" response would go in the ScriptingAPI.Speak("i'm doing quite fine thank you"); code method.

We do want you to help each other though, so please continue to post here, and we also suggest the MSDN forums, StackOverflow, even Khan Academy.

Thanks!!

-Chris
0 link
tony john
tony john
Posts: 75


12/31/2014
tony john
tony john
Posts: 75
Hi Chris, have tried in vain to do what you just stated, getting nowhere to be honest.
Also the kinect replies to any voice command sporadically at best.
Really need video tutorials on how to do things like basic scripting, connecting a nas drive and voice controlling media on it and tv.
Regards Tony
0 link
Dominique Garcia
Dominique Garcia
Posts: 55


12/31/2014
Dominique Garcia
Dominique Garcia
Posts: 55
tony john wrote:
Hi Chris, have tried in vain to do what you just stated, getting nowhere to be honest.
Also the kinect replies to any voice command sporadically at best.
Really need video tutorials on how to do things like basic scripting, connecting a nas drive and voice controlling media on it and tv.
Regards Tony


I am new here and currently trying my best to learn. Once I do, I will be making some.
+1 link
tony john
tony john
Posts: 75


1/1/2015
tony john
tony john
Posts: 75
Looking forward very much to your contributions Dominique Garcia, much appreciated.
0 link