VoxCommando

Help and Support (Using VoxCommando) => Other Plugins => Topic started by: marcusvdt on June 18, 2015, 03:07:37 PM

Title: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 03:07:37 PM
Hi all!
I've tried using png files instead of jpg file so I could try to get transparency while using a custom talking head.
Unfortunatelly it did not work.
Is this possible?

It would open more possibilities for a nice interface.

Also, is it possible to make the talking head to cover 100% of the screen instead of specifying fixed pixel size?

Thanks!
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 03:16:41 PM
And if animated and transparent gif files could be allowed, than there are much more possibilities....
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 03:31:40 PM
No it's not possible. Even if I made it possible to use transparent images that would only allow you to see through to the background colour of the window containing the images.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 04:16:53 PM
No it's not possible. Even if I made it possible to use transparent images that would only allow you to see through to the background colour of the window containing the images.
It seems enough. I'm planning the coolest thing. Instead of a talking head, I'll have an animated blinking "circle" a la Jarvis style.
This circle would be placed in the center of the screen,over the desktop wallpaper. The wallpaper has the remaining art, making the screen to look like a real Jarvis. Once the computer talks to me, the animated circle would kind of blink (using the custom visemes) just over the desktop wallpaper, making it look like the desktop is animated.
The geometry of the light coming from the circle would mimic the movement of the mouth for the same phonetic sound.
It would be nice to have this animated circle over all the windows with some good transparency that allows for clearly seeing what is behind it. To make it perfect, I would have a command to hide it when I want.

Animated gifs are better because I can make a smoth transition from one image to another, making each image kind of smoothly glowing.


What do you think?

Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 04:21:56 PM
As I said, it is not possible.  Maybe I misunderstood your last post, but I think it is more likely that you misunderstood mine.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 04:23:09 PM
to be clear the background colour of the window will be grey, it is not the colour BEHIND the window it is the colour of the blank form which belongs to VoxCommando, on which the image is placed.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 05:06:42 PM
to be clear the background colour of the window will be grey, it is not the colour BEHIND the window it is the colour of the blank form which belongs to VoxCommando, on which the image is placed.
Ok, got it. That's fine then.
I was researching about it and expecting you could make not only the image transparent, but the form itself. I thought it would be something easy for you to implement, kind of something like this:
http://www.c-sharpcorner.com/UploadFile/scottlysle/XparentFormsCS10282007212944PM/XparentFormsCS.aspx

This is kind of a feature that is just cool, but don't add any functionality at all. But either way, do you see any chance of implementing it somewhere in the future? I understand that being something visual only, it must be in the bottom of your priorities, but it would be so cool...
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 05:57:09 PM
I have tried this method for a few different things and never found it worth doing.

I can set a transparency colour key but this results in a very messy looking image.  There is only one exact colour that will be transparent with no blending.  This means every pixel must be either 100% transparent or 100% opaque.  The result is an "aliased" (scratchy step-ladder) edge that looks terrible.  Although it can be done pretty easily, I'm not really sure if it is worth it.

To create true transparency with aliasing according to an opacity layer like that in png or gif with transparency requires much more hacking, and it is not something that I would be interested in spending a lot of time on.

Even just using the transparency key (single colour is set as transparent) seems to intorduce a lot of lag in the image redrawing.  While this might look OK with your abstract images in mind I don't think it would look very nice with actual lip sync.

If you would like I can send you a sample TTS dll with a specific background colour set as transparent.  Just let me know what colour I should use.  Black, white, lime green.?  It must be a colour that you do not intend to use in your animation images.  For now I think we should stick with jpgs since actual transparency is of no use to use when using a transparent colour key.  Jpegs make the edge look even worse because of compression so you should make sure to use very little compression when saving your jpg files.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 06:02:46 PM
You can always try to do with with Guile3D instead, but I'm not sure if it is possible with the "cheap" version.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: Kalle on June 18, 2015, 06:08:09 PM
Here is a video with Guile3D and VoxCommado - there are a lot of other avatar available, but the software is not cheap  :o





and here the link to the tutorial for using it with VoxCommando: http://voxcommando.com/forum/index.php?topic=1650.msg14800#msg14800
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 06:57:14 PM
Regarding the dll, I would like to try it if you don't mind.
As I understand, the same bg color that I want to be transparent on my images should be set as the transparent bg of the form, right? If so, then black should be transparent.

Thanks for the support.

As a very humble suggestion, and obviously only if it can be done, I think you guys should think about implementing some visual feedback like that. I mean, Jarvis has a very strong appeal.I understand that it basically adds nothing to the core functionality of the software,  but it's that cool thing that a software can have or not.

I'll take a look at Guile3D as soon as I arrive home. Thanks for the suggestion.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 07:17:14 PM
OK.

You can also try something like this which is even cooler I think:
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 07:26:32 PM
Just wanted to make it clear that I love VC with the transparency or not. It's cool either way.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 18, 2015, 09:11:43 PM
Here is the TTS plugin with a black transparency key.  Anything in your image that is completely black (RGB = 0,0,0) should be transparent and show whatever is beneath the window.

Make sure to completely close VC then replace the dll and make sure that windows is not blocking it by right-clicking the dll and checking properties.

Good luck

[NB: dll attached to post deleted. These features are now a standard part of the TTS plugin in VC.]
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 18, 2015, 11:59:58 PM
Here is the TTS plugin with a black transparency key.  Anything in your image that is completely black (RGB = 0,0,0) should be transparent and show whatever is beneath the window.

Make sure to completely close VC then replace the dll and make sure that windows is not blocking it by right-clicking the dll and checking properties.

Good luck

Thanks!
I've tried with 2.1.4.2 (currently working version for my Py MySensors Controller) and it did not recognize the plugin. Tried after that with 2.1.4.5 and then 2.1.4.8 with the same result.

Interestingly, both 2.1.4.5 and 2.1.4.8 gave me weird errors with my Py MySensors Controller. Will get back to it tomorrow...

Of course, I have made a backup and got back to 2.1.4.2 and original TTS.dll for now...
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: nime5ter on June 19, 2015, 08:08:56 AM
Make sure to completely close VC then replace the dll and make sure that windows is not blocking it by right-clicking the dll and checking properties.

@marcusvdt -- as James explained, you should make sure that Windows is not blocking the dll. It almost always will when you first download  a dll file.

This screenshot is just from the Web. The same thing applies here.
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Fwinaero.com%2Fblog%2Fwp-content%2Fuploads%2F2013%2F12%2Faerolite.theme-Properties.png&hash=cd092e61d2d31fdffc45c5a855987b43c02971bb)
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 19, 2015, 11:02:35 AM
Thanks!
I must have done something wrong yesterday. Maybe I was too asleep?!?!
I admit I did not check this button yesterday. Today I renamed the original DLL again, copied the modified DLL to the respective folder and then I checked if such button was there in the properties dialog for the modified DLL: it was not there!. Anyway, I decided to try one last time and ran VC. It worked! WoohoooooO!

This fits my needs for now!

Btw, the standard window size for the talking head is always 430x320 or it is calculated based on the screen resolution? I'm asking this because I want to create the images for the animation so they fit the standard size of this window.
On a quick sample test, I've noticed that upsizing the window through tts.movehead will significantly decrease redraw performance, making it unusable (at least on this slow PC that I'm using for VC, and I upsized to fit the entire screen).


I'll be preparing the images as soon as you respond the above question and I'll see if I can minimize the jerky edges to end up with something beautiful. It would be easier if the outside edges where not round as in a circle! But anyway, I'll try...
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 19, 2015, 12:53:04 PM
It's a standard size always.  I don't know off-hand what the exact size is.  You can set it to anything you want though so I don't think it matters.  Changing the size should not slow performance in and of itself, it's just that the bigger you go the more work it will need to do I guess.  It will probably also depends on the size of your images.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 19, 2015, 09:36:46 PM
I'm happy to say that it worked fine but I had to kind of tweak the source images. Jpeg images won't give acceptable results anyway and I ended up using pngs. As soos as I get back to the computer I'll record a video to show the first draft to you guys, it is really cool! Then I'll write more about it so I can try to convince you to allow pngs instead of jpegs.
Btw, the size of the window is 430x240
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 20, 2015, 02:40:55 AM
Here is the link for the video. I think it got so cool for a draft. See how I made it look to be an animated part of my rainmeter theme. I made it to look like semi transparent over the rainmeter components. This is so cool and the possibilities are endless for creative minds.
https://youtu.be/Cd6jsa76Jmc


Please ignore the bg sound. My son was playing GTA 5 online and talking to his friends through the kinect while I was recording. Also I think the quality of the image is not so good as the image that I see here... I was recording a Team Viewer session on a slow PC. But anyway, you will get the idea.

Another thing to notice just in case you understand portuguese, the light that is near me on the small webcam window is what I call in my commands as "abajur". I've mounted the node for that light on a box and after I mounted it I noticed the wiring for the relay was inverted, hence when I turn it off by a voice command (I say "desligado", and VC sends a logic zero to the node), it is resulting in the light turning on. For the "ligado" command, the light is turning off. This is not a problem with VC, it is just that I have other priorities now and I'm not going to open the box to fix it so soon. All of this stuff are prototypes as of now.

Regarding the animation and the DLL:
I produced the pngs for the animation without any transparent color. I used a pure black background to conform with the settings of the form. I used pngs and later renamed them to jpgs. I did it this way because of jpegs are always compressed, even if you choose the least amount of compression when saving them. The edges getting wrong is one of the possible consequences. I'm also a professional photographer and sometimes I experience this behavior with jpegs when I want a seamless bg to be pure white or pure black. It depends on the compression you apply. Even having a perfect black bg (RGB = 0,0,0), the black around the non black edges will get jerky and hence produce undesired results. The same applies to pure white (255,255,255). This is a known issue with jpegs.
So to avoid the need to rename the files, I would like to suggest that PNGs are used per default. Or maybe you can allow various file types. This is if you decide to implement the transparency as a standard plugin option. You could allow the user to choose on the plugin option window which RGB color will be transparent.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: nime5ter on June 20, 2015, 11:29:25 AM
Thanks for posting the video.

Although it's a bit hard to hear the TTS with the background noise, it looks like you've done a nice job integrating the TTS visual feedback with your Rainmeter desktop.

It's a cool example of how users can imagine and create custom solutions that work with their own personal systems (with a bit of effort of course!).

What happens when you run a program such as a web browser? Doesn't the TTS display window appear on top? Or are you using an event trigger to hide the "talking head" window when you are not displaying the Rainmeter desktop?

Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 20, 2015, 11:55:44 AM
For now, it remains on top.The initial idea was to keep it over anything but semi transparent, because I thought it would be easier for you guys to implement it. Now the idea is to selectively show or hide the talking circle, depending on what is running on the foreground.  I'm going for an event like you said or a custom action in Python.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: Haddood on June 20, 2015, 05:18:07 PM
while Jarvis is not my favorite interface, I think the idea of using abstract images is a stroke of a genius ... good job
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 20, 2015, 06:17:41 PM
I will release a new version of the plugin soon.  I don't think I'll put anything new into the UI for now, but instead add some actions that allow advanced users to specify a transparent colour for the background, and also one to fade the opacity of the entire talking head window.  That is, make the visible parts, slightly transparent.  You'll be able to set an opacity from 0 to 100, similar to what you can do with the status overlay using the OSD.SetOverlayFade action.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 20, 2015, 06:28:40 PM
@Haddood, thanks. I hope someone else may come with creative interfaces.

@James, that's fantastic. It simply covers all the needs very well!
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 20, 2015, 06:39:18 PM
OH, and I'll add support for pngs and animated gifs as well.  I don't think it will be too difficult.  I can't guarantee what kind of performance you'll get though in terms of speed.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 21, 2015, 11:19:13 PM
Great!
Let me know if you need a beta tester.
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 22, 2015, 11:37:38 AM
Everyone can be a beta tester ;)

New release with a few fixes and updates:

http://voxcommando.com/mediawiki/index.php?title=ChangeLog#Version_2.1.5.0

http://voxcommando.com/home/downloads/
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: Haddood on June 22, 2015, 08:58:43 PM
@james ... nice update to VC  :clap :clap
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 25, 2015, 03:23:31 PM
Just to let you guys know, with the new opacity parameter the integration with my desktop theme is even better.
Unfortunately I can't make much videos as I would like because the slow Atom mini PC that I'm using for VC does not handle it very well. Even capturing de video via TeamViewer results in the CPU rising to 100%.

The new version is working preety good, so +1 about the version 2.1.5.0, it is a fantastic update!

Thanks James! You rock!
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 26, 2015, 01:51:33 PM
For capturing video, I recommend either using a camera (e.g. on your phone etc.) or using Camtasia.  But yeah, on an atom it is going to struggle to even display this stuff, let alone capture it.

Anyway, glad to hear that the new plugin is working out for you. :)
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: marcusvdt on June 26, 2015, 03:38:22 PM
James, I'll try camtasia. I used it in the past and it was great.

One last thing I just noticed regarding the TTS Talking Head Graphic... The default window behavior is that it is clickable. If I purposedly click on that, that will show me the window geometry and I can then close it.
Why not adding an action to change the window behavior to a click through window?
Something like TTS.ClickThrough = True or False

I have no idea how difficult is that, so pardon me if I'm suggesting something stupid.

Thanks!
Title: Re: TTS talking head - use of PNGs instead on JPGs
Post by: jitterjames on June 26, 2015, 04:17:28 PM
I'll look into it.