[RELEASE] Personal Trainer

Webteases are great, but what if you're in the mood for a slightly more immersive experience? Chat about Tease AI and other offline tease software.

Moderator: 1885

Post Reply
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

[RELEASE] Personal Trainer

Post by figroll »

Personal Trainer is a desktop application that provides a fully scriptable stroke trainer to prepare you for competition. It features:

1. Metronome.
2. Picture display including gallery support.
3. Trainer voice through either subtitles or TextToSpeech.
4. Trainer taunts and instructions from simple text files (random examples ripped from captions included)
5. Built in timers, randomisation, etc.
6. Fully scriptable in C#.

Personal Trainer is Windows only I'm afraid.

In a Nutshell

On start up, Personal Trainer will display a list of scripts like so:

Image

If you then select one of the scripts your Personal Trainer will guide your stroking with spoken instructions, pictures and/or a metronome.

Image

The scripting language is designed to be very simple with very Milovana style features but also powerful so you can write any sort of Stroke script / content you want.

Note Personal Trainer contains no content (pictures or video) and only a basic set of scripts to demonstrate what is possible.

It's completely open source for security reasons. In theory, I am also open to pull requests.

Getting Started

1. Download the release from here : https://github.com/figrollapps/Personal ... s/tag/v0.9
2. Expand the zip into a directory.
3. Edit the file settings.txt to point to some content (see below).
4. Run PersonalTrainer.exe, pick a script and click start.

Settings

Settings.txt should be quite straightforward. It looks like this and can be edited in any text editor (e.g. Notepad).

Code: Select all

UseTTS: true
DefaultVoice: Amy
ContentLocation: D:\files\Trainer\art
1. Set ContentLocation to point to some pictures. Personal Trainer will load everything in that directory with each sub directory being a "Gallery" that can be loaded from a Script.

2. If you don't want TTS set UseTTS to false and you wikll just get subtitles.

3. If you do use TTS enter the name of your preferred voice.

Why?

This code is really old and was mostly just for my own use. My main motivation was a frustration with the difficult to use XML formats of things like GuideMe. And because I only really want offline content with quality pictures.

It can be used as a pictures + metronome trainer or just a metronome while you watch a video.

Note that for a number of reasons it's not really an alternative to GuideMe or Milovana Teases although obviously it's a very Milovana sort of thing :-)

Future Plans?

Not sure how much I am going to progress this and it has a number of limitations, most obviously providing any control over the UI (e.g. buttons). Like I said it's very old and if I was doing ti all again I would probably do it in Javascript so it can be cross platform. As it is, I imagine this app will be of most interest to people who want to make their own customisable stroke trainer rather than for building teases (although you can certainly do that).

But if people find it useful, I have plenty of ideas...
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

Writing Code

Just create a file with a text editor, preferably a programmers editor that understands C# (I recommend https://code.visualstudio.com/).

1. Easiest way to see the available features is to look at the C# interfaces here: https://github.com/figrollapps/Personal ... Domain/API

2. There is a very basic tutorial here : https://mega.nz/#!HNQxma6R!6LM6Sb49kTn6 ... ne3Rdm05Yg

3. If you make a mistake you will get an compiler error message when you try to run it in Personal Trainer.

4. It's meant to be easy, so if you have any programming or scripting experience you can probably make your own scripts. it will be very easy for C~ programmers. (Also Java programmers as long as you can handle proper generics ;-) )

5. If you want to do something more complicated than a basic script then you probably want to download the source code and do it in an IDE with Intellisense and so on.

Examples

Some code examples will give you the idea.

Code: Select all

int sets = 1;
int pictureRest = 10;
int pictureCount = 60;

_.Metronome.BPM = 60;

int n = 0;
while (sets-- > 0)
{
    _.Trainer.Say("Set " + n++);

    var gallery = _.Content.Galleries.Shuffle().First();
    var pictures = gallery.Pictures.Take(pictureCount);

    _.Metronome.Start();
   
    foreach (var picture in pictures)
    {
        _.Viewer.Display(picture, pictureRest);
    }
    
    _.Metronome.Stop();
    _.Viewer.Clear();
    _.Trainer.Say("Test complete.");
}

Code: Select all

var caps = LoadVocals("captions");

void Round(int speed)
{
	_.Metronome.BPM = speed;
	_.Metronome.Start();

	_.Timer.Wait(_.RNG.Between(1, 3) * 5);
	SayAny(caps);
	_.Timer.Wait(_.RNG.Between(3, 5) * 5);

	_.Trainer.Say("Stop");
	_.Metronome.Stop();
}

void Tabata(int speed)
{
	int i = 0;
	while (i++ < 7)
	{
		Round(_.RNG.Between(2, 5) * 30);
		_.Trainer.Say("Rest.", _.RNG.Between(2, 5) * 5);
	}

	_.Trainer.Say("Last round, double time.");
	Round(speed * 2);
}

void Run()
{
	_.Trainer.Say("Prepare.", 2);
	Tabata(_.RNG.Between(2, 5) * 30);
}

Run();
Note it really is C# so you can use things like LINQ:

Code: Select all

       
       var firstHalf = gallery.Pictures.Take(half).Shuffle().Take(nPictures / 2);
       var secondHalf = gallery.Pictures.Skip(half).Shuffle().Take(nPictures / 2);
       var pictures = firstHalf.Union(secondHalf).OrderBy(p => p.Name); 

        foreach (var picture in pictures)
        {
            _.Viewer.Display(picture, 1);
            Stroke(count, speed);
        }
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

<Optimistically reserved for future use>
kolonomo1234
Curious Newbie
Curious Newbie
Posts: 3
Joined: Thu Dec 24, 2020 9:40 pm

Re: [RELEASE] Personal Trainer

Post by kolonomo1234 »

Hi figroll,

Can you please reupload the very basic tutorial? (the mega link is dead)

I like the personal trainer and i just want to customize a tease to my own taste, but i just so dumb to C# programming :blush:

Thanks in advance!
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

My first user! :-)

Have uploaded tutorial here : https://mega.nz/file/7dIxkASY#daNIS7TE- ... J5EjZ-Wvnw

Expand the zip into the content directory where you put the program and Tutorial should appear in the menu so you can run them. The actual tutorial is just a bunch of scripts with comments explaining how it all works so open these in some kind of text editor -- Notepad will do or a programmers editor (Visual Studio Code, Notepad++, etc.) if you want syntax colouring.

To see all the full API look at the definitions in these source files: https://github.com/figrollapps/Personal ... Domain/API

Hopefully that will help. Can help, although replies are likely to be slow-ish.

Although note this project is unlikely to develop any further as nobody seemed to like the idea and it had some problems I could never really fix (e.g. how to put buttons on the screen from a script).

Good luck!
User avatar
avatarbr
Experimentor
Experimentor
Posts: 1187
Joined: Fri Aug 18, 2006 3:33 am
Gender: Male
Sexual Orientation: Straight

Re: [RELEASE] Personal Trainer

Post by avatarbr »

I should had posted before, but I tested the app a little too. :blush:

I didn't try to edit too much (just the pic folder), so a few modes didn't work. I will take a look at the tutorial too see what I was missing. Thanks for the app
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

User #2! :-)

If stuff is not working it might well be a bug in that particular script. I wrote the tool for my own interest as I wanted to make scripts exactly as I wanted but much more quickly than was possible with the various Milovana alternatives, so they are meant to be quite throwaway. I tidied them up a bit when I published this thread but it wouldn't surprise me if there were problems.

The general idea was really that if you had a bit of programming you could make our own custom experiences and make them quickly as the mood takes you, which was how I used the thing.
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

There is also, I should say, a bug where if you run scripts for a long time beats and pictures can get out of sync and you have to restart the app. It was never a huge problem for me given how I used this, but it does mean nobody should be going off and writing anything serious as it likely will run into problems.

This is very old code and if I were writing it again today I would use very different technology to do this sort of thing. It's based on a very old C# scripting package for which there are now much better alternatives.

I also don't intend to do any more work on this project at this point, although I am happy (within reason) to answer questions and help with scripts.
kolonomo1234
Curious Newbie
Curious Newbie
Posts: 3
Joined: Thu Dec 24, 2020 9:40 pm

Re: [RELEASE] Personal Trainer

Post by kolonomo1234 »

Thank you for your help! (and sorry for the late response)

I dug trough the tutorials, and and the existing script, but unfortunately i can't figure out what i wanted to do. It's because I can't program in C :-)

Can I ask for a little help?
From programming point of view, I think it might no more than 5 lines what I don't now how to do :-D (I'll do the rest for myself)

So my idea: random "commands" with random pictures, and the picture stays the same until the task finished.

for example:

//command 1
_.Viewer.Display(random picture);
_.Trainer.Say("ten");
_.Timer.Wait(1);
_.Metronome.BPM = 120;
_.Metronome.Play(10);
_.Metronome.WaitUntilPlayStops();
_.Timer.Wait(1);


//command 2
_.Viewer.Display(random picture);
_.Trainer.Say("twenty");
_.Timer.Wait(1);
_.Metronome.BPM = 120;
_.Metronome.Play(20);
_.Metronome.WaitUntilPlayStops();
_.Timer.Wait(1);

.
.
.
and so on... (I'll do my own commands, I can make it work)

But I can't figure out how to "randomize" the commands, and how to display random pictures "inside a command".
(I use just one folder, with 100ish pics)

The TTS function is an absolute winner for me, I don't like to read :-) (BTW can I hide the subtitles somehow?)
Sorry for bugging you, but the software you wrote is perfect, I just want to customize it a little bit.

Thanks is advance
figroll
Explorer At Heart
Explorer At Heart
Posts: 140
Joined: Mon Jun 23, 2014 7:03 am

Re: [RELEASE] Personal Trainer

Post by figroll »

Sorry for slow reply, I don't check here that often. Something like this will do what you want:

Code: Select all

#load "common\standard.csx"

// Obey a command for each picture.

var _ = Require<TrainingSession>();

ApplyUserSettings();
LoadDefaultContent();

void Command1()
{
    _.Trainer.Say("Ten slow strokes.", 1);
    Stroke(10, 60);
}

void Command2()
{
    Stroke(20, 90);
}

void Command3()
{
    Stroke(20, 120);
}

void Command4()
{
    Stroke(20, 180);
}

void Run()
{
    var randomGallery = _.Content.Galleries.Shuffle().First();

	foreach (var picture in randomGallery.Pictures.Shuffle())
    {
        _.Viewer.Display(picture, 1);

        int n = _.RNG.Between(1,100);

        if (n < 25)
        {
            Command1();
        }
        else if (n < 50)
        {
            Command2();
        }
        else if (n < 75)
        {
            Command3();
        }
        else if (n < 100)
        {
            Command4();
        }

        _.Viewer.Clear();
        _.Trainer.Say("Stop!", 10); // If you want a pause between commands.
    }
}

Run();
Sorry no way to disable subtitles. I just added the TTS option as I knew some people hated it.

Good luck.
kolonomo1234
Curious Newbie
Curious Newbie
Posts: 3
Joined: Thu Dec 24, 2020 9:40 pm

Re: [RELEASE] Personal Trainer

Post by kolonomo1234 »

Thanks for the help!
Works perfectly!!
Post Reply

Who is online

Users browsing this forum: No registered users and 108 guests