Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion TensorStack.Audio.Windows/AudioInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace TensorStack.Audio
/// </summary>
public class AudioInput : AudioInputBase
{
private readonly string _sourceFile;
private string _sourceFile;

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

/// <summary>
/// Initializes a new instance of the <see cref="AudioInput"/> class.
/// </summary>
/// <param name="audioTensor">The audio tensor.</param>
public AudioInput(AudioTensor audioTensor)
: base(audioTensor) { }

/// <summary>
/// Initializes a new instance of the <see cref="AudioInput"/> class.
/// </summary>
Expand All @@ -44,6 +51,9 @@ protected AudioInput(string filename, AudioTensor audioTensor)
/// <param name="filename">The filename.</param>
public override void Save(string filename)
{
if (string.IsNullOrEmpty(_sourceFile))
_sourceFile = filename;

AudioManager.SaveAudio(filename, this);
}

Expand All @@ -55,6 +65,9 @@ public override void Save(string filename)
/// <param name="cancellationToken">The cancellation token.</param>
public override async Task SaveAsync(string filename, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(_sourceFile))
_sourceFile = filename;

await AudioManager.SaveAudioAync(filename, this, cancellationToken);
}

Expand Down
19 changes: 19 additions & 0 deletions TensorStack.TextGeneration/Pipelines/Supertonic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Supertonic TTS
https://github.com/supertone-inc/supertonic


```csharp
// [model] https://huggingface.co/TensorStack/Supertonic-onnx

var provider = Provider.GetProvider(GraphOptimizationLevel.ORT_ENABLE_ALL);
var modelPath = "M:\\Models\\Supertonic-onnx";
var pipeline = SupertonicPipeline.Create(modelPath, provider);
var options = new SupertonicOptions
{
TextInput = "On a quiet morning in the old town, a clockmaker named Ellis unlocked his tiny shop",
VoiceStyle = "Female1"
};

var generateResult = await pipeline.RunAsync(options);
AudioManager.SaveAudio("Output.wav", generateResult);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using TensorStack.Common;

namespace TensorStack.TextGeneration.Pipelines.Supertonic
{
public record SupertonicConfig
{
public int SampleRate { get; init; } = 44100;
public int BaseChunkSize { get; init; } = 512;
public int LatentDim { get; init; } = 24;
public int ChunkCompressFactor { get; init; } = 6;
public int TextEmbedSize { get; init; } = 256;
public int ScaleFactor { get; init; } = 3072;
public string IndexerPath { get; init; }
public string VoiceStylePath { get; init; }
public ModelConfig PredictorConfig { get; init; }
public ModelConfig EncoderConfig { get; init; }
public ModelConfig EstimatorConfig { get; init; }
public ModelConfig DecoderConfig { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using TensorStack.Common.Pipeline;

namespace TensorStack.TextGeneration.Pipelines.Supertonic
{
public record SupertonicOptions : IRunOptions
{
public string TextInput { get; set; }
public string VoiceStyle { get; set; }
public int Steps { get; set; } = 5;
public float Speed { get; set; } = 1f;
public float SilenceDuration { get; set; } = 0.3f;
}
}
Loading