-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO implement project default expression setting TODO implement Undo & Redo in expression Edit
- Loading branch information
Showing
16 changed files
with
329 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Avalonia.Threading; | ||
using Mirivoice.Engines; | ||
using Mirivoice.ViewModels; | ||
using Mirivoice.Views; | ||
using R3; | ||
using Serilog; | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using VYaml.Annotations; | ||
using VYaml.Serialization; | ||
using Mirivoice.Mirivoice.Core.Format; | ||
using Mirivoice.Mirivoice.Plugins.Builtin.Phonemizers; | ||
|
||
namespace Mirivoice.Mirivoice.Core.Format | ||
{ | ||
[YamlObject] | ||
public partial class MExpressionsWrapper | ||
{ | ||
// For VITS2 | ||
public float VITS2Speed { get; set; } = 1.0f; | ||
public float VITS2Noise1 { get; set; } = 0.667f; | ||
public float VITS2Noise2 { get; set; } = 0.8f; | ||
|
||
public MExpressionsWrapper() | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using Avalonia.Layout; | ||
using Mirivoice.Engines; | ||
using Mirivoice.Mirivoice.Core.Format; | ||
using Mirivoice.Views; | ||
using ReactiveUI; | ||
using System; | ||
|
||
namespace Mirivoice.ViewModels | ||
{ | ||
public class ExpressionEditViewModelVITS2: ViewModelBase | ||
{ | ||
public StackPanel CurrentExpression { get; set; } | ||
private readonly LineBoxView l; | ||
public int MaxSpeed { get; set; } = 100; | ||
public int MinSpeed { get; set; } = 0; | ||
|
||
public int MaxNoise1 { get; set; } = 100; | ||
public int MinNoise1 { get; set; } = 0; | ||
|
||
public int MaxNoise2 { get; set; } = 100; | ||
public int MinNoise2 { get; set; } = 0; | ||
|
||
private int _vits2Speed; | ||
public int VITS2Speed | ||
{ | ||
get => _vits2Speed; | ||
set | ||
{ | ||
this.RaiseAndSetIfChanged(ref _vits2Speed, value); | ||
l.Exp.VITS2Speed = ScaleValue(100 - value, 0.5f, 1.5f); | ||
l.IsCacheIsVaild = false; | ||
OnPropertyChanged(nameof(VITS2Speed)); | ||
OnPropertyChanged(nameof(l.Exp.VITS2Speed)); | ||
} | ||
} | ||
|
||
private int _vits2Noise1; | ||
public int VITS2Noise1 | ||
{ | ||
get => _vits2Noise1; | ||
set | ||
{ | ||
this.RaiseAndSetIfChanged(ref _vits2Noise1, value); | ||
l.Exp.VITS2Noise1 = ScaleValue(value, -0.3335f, 1.6675f); | ||
l.IsCacheIsVaild = false; | ||
OnPropertyChanged(nameof(VITS2Noise1)); | ||
OnPropertyChanged(nameof(l.Exp.VITS2Noise1)); | ||
} | ||
} | ||
|
||
private int _vits2Noise2; | ||
public int VITS2Noise2 | ||
{ | ||
get => _vits2Noise2; | ||
set | ||
{ | ||
this.RaiseAndSetIfChanged(ref _vits2Noise2, value); | ||
|
||
l.Exp.VITS2Noise2 = ScaleValue(value, -0.4f, 2f); | ||
l.IsCacheIsVaild = false; | ||
OnPropertyChanged(nameof(VITS2Noise2)); | ||
OnPropertyChanged(nameof(l.Exp.VITS2Noise2)); | ||
} | ||
} | ||
public ExpressionEditViewModelVITS2(LineBoxView l) | ||
{ | ||
this.l = l; | ||
|
||
VITS2Speed = 100 - GetSliderValue(l.Exp.VITS2Speed, 0.5f, 1.5f); | ||
VITS2Noise1 = GetSliderValue(l.Exp.VITS2Noise1, -0.3335f, 1.6675f); | ||
VITS2Noise2 = GetSliderValue(l.Exp.VITS2Noise2, -0.4f, 2f); | ||
|
||
} | ||
|
||
|
||
|
||
public static float ScaleValue(int input, float minValue, float maxValue) | ||
{ | ||
|
||
return minValue + input / 100f * (maxValue - minValue); | ||
|
||
} | ||
|
||
public static int GetSliderValue(float value, float minValue, float maxValue) | ||
{ | ||
return (int)((value - minValue) / (maxValue - minValue) * 100f); | ||
} | ||
public void ClrVITS2Speed() | ||
{ | ||
VITS2Speed = 50; | ||
} | ||
|
||
public void ClrVITS2Noise1() | ||
{ | ||
VITS2Noise1 = 50; | ||
} | ||
|
||
public void ClrVITS2Noise2() | ||
{ | ||
VITS2Noise2 = 50; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:vm="using:Mirivoice.ViewModels" | ||
xmlns:views="clr-namespace:Mirivoice.Views" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="Mirivoice.ExpressionEditViewVITS2"> | ||
|
||
<Border BorderBrush="DarkSlateGray" BorderThickness="1" Background="Gray"> | ||
<ScrollViewer AllowAutoHide="False" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"> | ||
<StackPanel Background="White"> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock Text="{DynamicResource edits.expression.speedVITS2} " MaxLines="2" TextWrapping="Wrap" TextElement.FontWeight="Bold" Foreground="DarkSlateGray" TextAlignment="Center" Width="50" FontSize="14" Margin="13 15 15 15" /> | ||
|
||
<NumericUpDown Value="{Binding VITS2Speed}" Minimum="{Binding MinSpeed}" Maximum="{Binding MaxSpeed}" HorizontalContentAlignment="Center" TextElement.FontSize="15" ParsingNumberStyle="Integer" Increment="1" Margin="13 5 15 5" /> | ||
<Slider PointerPressed="ClearVITS2Speed" Value="{Binding VITS2Speed}" Minimum="{Binding MinSpeed}" Width="300" Maximum="{Binding MaxSpeed}" SmallChange="1" LargeChange="10" Margin="13 5 15 5" /> | ||
|
||
</StackPanel> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock Text="{DynamicResource edits.expression.noise1VITS2} " MaxLines="2" TextWrapping="Wrap" TextElement.FontWeight="Bold" Foreground="DarkSlateGray" TextAlignment="Center" Width="50" FontSize="14" Margin="13 15 15 15" /> | ||
|
||
<NumericUpDown Value="{Binding VITS2Noise1}" Minimum="{Binding MinNoise1}" Maximum="{Binding MaxNoise1}" HorizontalContentAlignment="Center" TextElement.FontSize="15" ParsingNumberStyle="Integer" Increment="1" Margin="13 5 15 5" /> | ||
<Slider PointerPressed="ClearVITS2Noise1" Value="{Binding VITS2Noise1}" Minimum="{Binding MinNoise1}" Width="300" Maximum="{Binding MaxNoise1}" SmallChange="1" LargeChange="10" Margin="13 5 15 5" /> | ||
|
||
</StackPanel> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock Text="{DynamicResource edits.expression.noise2VITS2} " MaxLines="2" TextWrapping="Wrap" TextElement.FontWeight="Bold" Foreground="DarkSlateGray" TextAlignment="Center" Width="50" FontSize="14" Margin="13 15 15 15" /> | ||
|
||
<NumericUpDown Value="{Binding VITS2Noise2}" Minimum="{Binding MinNoise2}" Maximum="{Binding MaxNoise2}" HorizontalContentAlignment="Center" TextElement.FontSize="15" ParsingNumberStyle="Integer" Increment="1" Margin="13 5 15 5" /> | ||
<Slider PointerPressed="ClearVITS2Noise2" Value="{Binding VITS2Noise2}" Minimum="{Binding MinNoise2}" Width="300" Maximum="{Binding MaxNoise2}" SmallChange="1" LargeChange="10" Margin="13 5 15 5" /> | ||
|
||
</StackPanel> | ||
</StackPanel> | ||
</ScrollViewer> | ||
</Border> | ||
</UserControl> |
Oops, something went wrong.