Skip to content

Commit

Permalink
feat: add sample (Voisonatalk)
Browse files Browse the repository at this point in the history
  • Loading branch information
InuInu2022 committed Sep 12, 2023
1 parent cc8639e commit 9e89e27
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LibSasara.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SongToTalk", "sample\csharp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibSasara.VoiSona", "LibSasara.VoiSona\LibSasara.VoiSona.csproj", "{A1B274F9-227A-44FF-B677-4252B879614C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiSonaTalkLab", "sample\csharp\VoiSonaTalkLab\VoiSonaTalkLab.csproj", "{C2132952-7F78-40F2-82A2-33F21B96F281}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -47,10 +49,15 @@ Global
{A1B274F9-227A-44FF-B677-4252B879614C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1B274F9-227A-44FF-B677-4252B879614C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1B274F9-227A-44FF-B677-4252B879614C}.Release|Any CPU.Build.0 = Release|Any CPU
{C2132952-7F78-40F2-82A2-33F21B96F281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2132952-7F78-40F2-82A2-33F21B96F281}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2132952-7F78-40F2-82A2-33F21B96F281}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2132952-7F78-40F2-82A2-33F21B96F281}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0E866952-1DBC-4757-A050-E382730E77D9} = {1E661A3C-0FEC-4C5D-816C-2CDD4012E622}
{29235D96-E780-493D-A755-0BC160446433} = {0E866952-1DBC-4757-A050-E382730E77D9}
{EB1D4DB4-6861-4D24-B415-1442CF9D83D6} = {0E866952-1DBC-4757-A050-E382730E77D9}
{C2132952-7F78-40F2-82A2-33F21B96F281} = {0E866952-1DBC-4757-A050-E382730E77D9}
EndGlobalSection
EndGlobal
42 changes: 42 additions & 0 deletions sample/csharp/VoiSonaTalkLab/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using LibSasara.Model;
using LibSasara.VoiSona;
using LibSasara.VoiSona.Model.Talk;

ConsoleApp.Run<Label>(args);

public class Label: ConsoleAppBase
{
[RootCommand]
public async ValueTask<int> ExportAsync(
[Option("t", "path to a target tstprj file")]
string pathToPrj,
[Option("d", "path to export lab files")]
string? destination = ""
)
{
if(!Path.Exists(pathToPrj)){
return 1;
}
if(!Directory.Exists(destination)){
destination = Path.GetDirectoryName(pathToPrj);
if (string.IsNullOrEmpty(destination)) return 1;
}


var tstprj = await LibVoiSona
.LoadAsync<TstPrj>(pathToPrj);
var labs = tstprj
.GetAllTracks()
.SelectMany(v => v.Utterances)
.Where(v => v.Text != "")
.Select(v => (v.Text, v.Label))
;
foreach(var lab in labs){
var name = $"{destination}{Path.DirectorySeparatorChar}{lab.Text}.lab";
string content = lab.Label!.ToString();
await File
.WriteAllTextAsync(name, content);
}
return 0;
}
}
39 changes: 39 additions & 0 deletions sample/csharp/VoiSonaTalkLab/VoiSonaTalkLab.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>

<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
<DebuggerSupport>false</DebuggerSupport>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

<Target Name="MakeZipPackage" AfterTargets="Publish">
<MakeDir Directories="$(OutputPath)/../../../../../VoiSonaTalkLab/publish/" />
<Delete Files="$(OutputPath)/LibSasara.xml" />
<Delete Files="$(OutputPath)/LibSasara.VoiSona.xml" />
<Delete Files="$(OutputPath)/$(AssemblyName).pdb" />
<Delete Files="$(OutputPath)/publish/$(AssemblyName).pdb" />
<Delete Files="$(OutputPath)/publish/*.xml" />
<Delete Files="$(OutputPath)/publish/LibSasara.xml" />
<Delete Files="$(OutputPath)/publish/LibSasara.VoiSona.xml" />
<ZipDirectory SourceDirectory="$(OutputPath)/publish/" DestinationFile="$(OutputPath)/../../../../../VoiSonaTalkLab/publish/$(AssemblyName)-$(RuntimeIdentifier)-v.$(Version).zip" Overwrite="true" />
<Message Text="Actions After Publish" Importance="high" />
</Target>

<ItemGroup>
<PackageReference Include="ConsoleAppFramework" Version="4.2.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\LibSasara.VoiSona\LibSasara.VoiSona.csproj" />
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions sample/csharp/VoiSonaTalkLab/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Sample; VoiSonaTalkLab

timing label files (`*.lab`) exporter from VoiSona Talk project file (`*.tstprj`).

## Requirements

- Windows x64 (Win 7.0 >=)
- macOS x64 (macOS 10.12 Sierra >=)
- macOS arm64 (macOS 10.15 "Catalina" >=)
- Linux x64

*Only Windows has been tested.

## Download

[Releases](https://github.com/InuInu2022/LibSasara/releases)

## Usage

```cmd
//windows
VoiSonaTalkLab.exe -t path\to\yourawesomeproject.tstprj -d pato\to\exportlabfiles\
//mac, linux
VoiSonaTalkLab -t path/to/yourawesomeproject.tstprj -d pato/to/exportlabfiles/
```

Please check `--help` command.

0 comments on commit 9e89e27

Please sign in to comment.