Skip to content

Commit

Permalink
Merge pull request #34 from ayutaz/develop
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
ayutaz authored Apr 2, 2023
2 parents e77a60f + c176b1b commit 678c25f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
5 changes: 3 additions & 2 deletions Assets/KoeiromapUnity/Sample/Sample.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.IO;
using System.Threading;
using Cysharp.Threading.Tasks;
using KoeiromapUnity.Core;
using KoeiromapUnity.Util;
using TMPro;
Expand Down Expand Up @@ -68,11 +69,11 @@ private void Start()
});

#if UNITY_STANDALONE
var folderPath = Path.Combine(Application.persistentDataPath, "yousan", "koeiromap-unity");
var filePath = Path.Combine(Application.persistentDataPath, "test.wav");
var token = _cancellationTokenSource.Token;
saveVoiceButton.onClick.AddListener(() =>
{
AudioFile.Save(_audioStringData, folderPath, "test.wav", token);
AudioFileUtility.Save(_audioStringData, filePath, token).Forget();
});
#elif UNITY_WEBGL
saveVoiceButton.gameObject.SetActive(false);
Expand Down
5 changes: 5 additions & 0 deletions Assets/KoeiromapUnity/Scripts/Core/AudioConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ private static MemoryStream ConvertByteArrayToMemoryStream(byte[] wavData)
return memoryStream;
}

/// <summary>
/// Converts a byte array representing audio data into an AudioClip.
/// </summary>
/// <param name="bytes"></param>
/// <returns></returns>
public static AudioClip GetAudio(byte[] bytes)
{
var headerStream = ConvertByteArrayToMemoryStream(bytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace KoeiromapUnity.Util
{
public static class AudioFile
public static class AudioFileUtility
{
/// <summary>
/// Specify the folder name and phial name (including extension) to save the audio file.
Expand Down
Binary file modified Docs/demo_en.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/demo_jp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ You can change the parameters and play any voice on the following screen from th
- [requirements](#requirements)
- [how to use](#how-to-use)
- [Sample Code](#sample-code)
- [Build for Windows](#build-for-windows)
- [3rd Party Notices](#3rd-party-notices)
- [License](#license)

Expand All @@ -40,7 +39,6 @@ You can change the parameters and play any voice on the following screen from th

# requirements
* Unity 2021.3.x or later
* IL2CPP(Windows)
* [UniTask](https://github.com/Cysharp/UniTask)

# how to use
Expand All @@ -51,22 +49,19 @@ You can change the parameters and play any voice on the following screen from th

var voiceParam = new VoiceParam
{
text = "こんにちは",
speaker_x = 3f,
speaker_y = 3f,
text = "Hello",
speaker_x = 2.0f,
speaker_y = 2.0f,
style = "talk",
seed = "12345"
seed = "1234567890",
};
var option = new Option($"{Application.dataPath}/voice");
var voice = await KoeiromapExtensions.GetVoice(voiceParam, _token, option);
var voice = await Koeiromap.GetVoice(voiceParam, _cancellationTokenSource.Token);
_audioSource.clip = voice.audioClip;
_audioStringData = voice.audioBase64;
_audioSource.Play();

```

## Build for Windows
* Switch to Windows platform and IL2CPP

# 3rd Party Notices

See [NOTICE](NOTICE.md).
Expand Down
14 changes: 5 additions & 9 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Koeiromapを利用するためのUnity用ライブラリ
- [要件](#%E8%A6%81%E4%BB%B6)
- [使い方](#%E4%BD%BF%E3%81%84%E6%96%B9)
- [サンプルコード](#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89)
- [Windows 用のビルド](#windows-%E7%94%A8%E3%81%AE%E3%83%93%E3%83%AB%E3%83%89)
- [サードパーティーのお知らせ](#%E3%82%B5%E3%83%BC%E3%83%89%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%83%BC%E3%81%AE%E3%81%8A%E7%9F%A5%E3%82%89%E3%81%9B)
- [ライセンス](#%E3%83%A9%E3%82%A4%E3%82%BB%E3%83%B3%E3%82%B9)

Expand Down Expand Up @@ -52,21 +51,18 @@ Koeiromapを利用するためのUnity用ライブラリ
var voiceParam = new VoiceParam
{
text = "こんにちは",
speaker_x = 3f,
speaker_y = 3f,
speaker_x = 2.0f,
speaker_y = 2.0f,
style = "talk",
seed = "12345"
seed = "1234567890",
};
var option = new Option($"{Application.dataPath}/voice");
var voice = await KoeiromapExtensions.GetVoice(voiceParam, _token, option);
var voice = await Koeiromap.GetVoice(voiceParam, _cancellationTokenSource.Token);
_audioSource.clip = voice.audioClip;
_audioStringData = voice.audioBase64;
_audioSource.Play();

```

## Windows 用のビルド
* WindowsプラットフォームとIL2CPPに切り替える

# サードパーティーのお知らせ

[NOTICE](https://github.com/ayutaz/koeiromap-unity/NOTICE.md)をご参照ください。
Expand Down

0 comments on commit 678c25f

Please sign in to comment.