Skip to content

Commit 8e2bcac

Browse files
authored
Merge pull request #7 from TensorStack-AI/SupertonicTTS
Supertonic TTS
2 parents bfcb3ad + f6c6ea7 commit 8e2bcac

File tree

7 files changed

+791
-1
lines changed

7 files changed

+791
-1
lines changed

TensorStack.Audio.Windows/AudioInput.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace TensorStack.Audio
1212
/// </summary>
1313
public class AudioInput : AudioInputBase
1414
{
15-
private readonly string _sourceFile;
15+
private string _sourceFile;
1616

1717
/// <summary>
1818
/// Initializes a new instance of the <see cref="AudioInput"/> class.
@@ -21,6 +21,13 @@ public class AudioInput : AudioInputBase
2121
public AudioInput(string filename, string audioCodec = "pcm_s16le", int sampleRate = 16000, int channels = 1)
2222
: this(filename, AudioManager.LoadTensor(filename, audioCodec, sampleRate, channels)) { }
2323

24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="AudioInput"/> class.
26+
/// </summary>
27+
/// <param name="audioTensor">The audio tensor.</param>
28+
public AudioInput(AudioTensor audioTensor)
29+
: base(audioTensor) { }
30+
2431
/// <summary>
2532
/// Initializes a new instance of the <see cref="AudioInput"/> class.
2633
/// </summary>
@@ -44,6 +51,9 @@ protected AudioInput(string filename, AudioTensor audioTensor)
4451
/// <param name="filename">The filename.</param>
4552
public override void Save(string filename)
4653
{
54+
if (string.IsNullOrEmpty(_sourceFile))
55+
_sourceFile = filename;
56+
4757
AudioManager.SaveAudio(filename, this);
4858
}
4959

@@ -55,6 +65,9 @@ public override void Save(string filename)
5565
/// <param name="cancellationToken">The cancellation token.</param>
5666
public override async Task SaveAsync(string filename, CancellationToken cancellationToken = default)
5767
{
68+
if (string.IsNullOrEmpty(_sourceFile))
69+
_sourceFile = filename;
70+
5871
await AudioManager.SaveAudioAync(filename, this, cancellationToken);
5972
}
6073

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Supertonic TTS
2+
https://github.com/supertone-inc/supertonic
3+
4+
5+
```csharp
6+
// [model] https://huggingface.co/TensorStack/Supertonic-onnx
7+
8+
var provider = Provider.GetProvider(GraphOptimizationLevel.ORT_ENABLE_ALL);
9+
var modelPath = "M:\\Models\\Supertonic-onnx";
10+
var pipeline = SupertonicPipeline.Create(modelPath, provider);
11+
var options = new SupertonicOptions
12+
{
13+
TextInput = "On a quiet morning in the old town, a clockmaker named Ellis unlocked his tiny shop",
14+
VoiceStyle = "Female1"
15+
};
16+
17+
var generateResult = await pipeline.RunAsync(options);
18+
AudioManager.SaveAudio("Output.wav", generateResult);
19+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using TensorStack.Common;
2+
3+
namespace TensorStack.TextGeneration.Pipelines.Supertonic
4+
{
5+
public record SupertonicConfig
6+
{
7+
public int SampleRate { get; init; } = 44100;
8+
public int BaseChunkSize { get; init; } = 512;
9+
public int LatentDim { get; init; } = 24;
10+
public int ChunkCompressFactor { get; init; } = 6;
11+
public int TextEmbedSize { get; init; } = 256;
12+
public int ScaleFactor { get; init; } = 3072;
13+
public string IndexerPath { get; init; }
14+
public string VoiceStylePath { get; init; }
15+
public ModelConfig PredictorConfig { get; init; }
16+
public ModelConfig EncoderConfig { get; init; }
17+
public ModelConfig EstimatorConfig { get; init; }
18+
public ModelConfig DecoderConfig { get; init; }
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using TensorStack.Common.Pipeline;
2+
3+
namespace TensorStack.TextGeneration.Pipelines.Supertonic
4+
{
5+
public record SupertonicOptions : IRunOptions
6+
{
7+
public string TextInput { get; set; }
8+
public string VoiceStyle { get; set; }
9+
public int Steps { get; set; } = 5;
10+
public float Speed { get; set; } = 1f;
11+
public float SilenceDuration { get; set; } = 0.3f;
12+
}
13+
}

0 commit comments

Comments
 (0)