台湾語TTS text to speech AI

アプリがアプリブで紹介されました!

ついに台湾語AI音声読み上げアプリ「台語TTS」が、アプリブで紹介されました!

アプリブ様 掲載ページはこちら

台湾語の発音を助けるアプリとして、より多くの人に知ってもらえるきっかけになりそうです。

アプリブ編集部のレビュー

台湾語はわかるけど発音はちょっと……そんなあなたを読み上げ音声がお助け 入力された台湾語の文章を、合成音声で読み上げてくれるアプリ。中国語とは異なる台湾語の細かなニュアンスもしっかり表現してくれます。

特に、

  • 10種類の音声(男声・女声)
  • 履歴保存機能
  • 自分の声を元にした音声生成

が評価して頂きました!

「台語TTS」ってどんなアプリ?

台湾語の文章を入力すると、その場でAIが音声を生成し、ネイティブのような発音で読み上げてくれるアプリです。

例えば、「你好」(lí-hó)は台湾語で「li2 ho2」と発音され、中国語の「nǐ hǎo」とはまったく異なる響きです。

このアプリでは、漢字を入力すると台湾語の正しい発音や声調に基づいてAIが音声を読み上げてくれます。

主な機能

  • 入力した台湾語の音声を即座に生成・再生
  • 男声・女声など、複数の音声を選択可能
  • 自分の声をもとにしたカスタム音声を作成
  • 履歴保存機能で、以前の音声をすぐに再生

アプリをダウンロード!

📱 App Storeでダウンロード

📱 Google Playでダウンロード

📱 Webアプリはこちら

 

この機会にぜひ、ご利用ください!

 

swiftでopenAIを直接利用する方法

pod 'Alamofire'
import Alamofire
//OpenAI
struct OpenAIConfiguration {
    let apiKey: String
}
let configuration = OpenAIConfiguration(apiKey: "hage")


func generateTranslationPrompt(inputText: String) -> String {
    let promptTemplate = "xxxxxしろや。:  \(inputText)"
    return promptTemplate
}

func callText(model: String,inputText: String, completion: @escaping (String?, Error?) -> Void) {
    let prompt = generateTranslationPrompt(inputText: inputText)
    
    let messages: [[String: Any]] = [
            ["role": "system", "content": "あなたはxxxxxです。"],
            ["role": "user", "content": prompt]
        ]
        
        let parameters: [String: Any] = [
            "model": model,
            "messages": messages,
            "temperature": 0.3,
            "top_p": 1.0,
            "frequency_penalty": 0.0,
            "presence_penalty": 0.0
        ]
        
        let headers: HTTPHeaders = [
            "Authorization": "Bearer \(configuration.apiKey)"
        ]
        
    AF.request("https://api.openai.com/v1/chat/completions", method: .post, parameters: parameters, encoding: JSONEncoding.default,
               headers: headers).responseJSON { response in
            switch response.result {
            case .success(let value):
                if let jsonResponse = value as? [String: Any],
                   let choices = jsonResponse["choices"] as? [[String: Any]],
                   let firstChoice = choices.first,
                   let message = firstChoice["message"] as? [String: Any],
                   let text = message["content"] as? String {
                    completion(text, nil)
                } else {
                    completion(nil, NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "Failed to parse response"]))
                }
            case .failure(let error):
                completion(nil, error)
            }
        }
    
}

そんで呼びたいところで使う

let orgString = "おはよう"
        callText(model: "gpt-3.5-turbo",inputText: "\(orgString)") { (convertText, error) in
            if let error = error {
                print("Error1: \(error)")
            } else if let convertText = convertText {
                print("Translated text: \(convertText)")
            }
        }

You don’t have write permissions for the /usr/bin directory.

iOSを1年ぶりに触ったら下記の通りエラー

pod update
[!] `GoogleAppMeasurement` requires CocoaPods version `>= 1.10.2`, which is not satisfied by your current version, `1.10.1`.

cocoapodsのバージョンをあげる
sudo gem install cocoapods

ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /usr/bin directory.

一応成功
sudo gem install cocoapods -n /usr/local/bin

Objective-Cからswiftを呼ぶ[Objective-c,Swift]

久しぶりに毒林檎を弄ったので備忘録として。

 

Objective-c から Swift

 

//Need

//Call From Objective-C To swift

#import "MyApp-Swift.h"

SwiftからObjective-c

import Foundation

//obj-cからアクセスするのに必要
@objcMembers
class SharedInfos: NSObject {
    static let shared: SharedInfos = SharedInfos()
   
    func someFlag() -> Bool {
       
            return true
        }
    
}

presentViewController[swift,Objective-C,ios13]

iOS13から画面遷移をするとポップアップしたようになりスワイプでもviewを消せるようになった。

私のアプリでA→B(問題があるView、スワイプ)→A→B(dissmissボタンを押す)この時に何故か落ちる。

Fatal Exception: NSInternalInconsistencyException Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.

メインスレッドにキューを入れればいいようだが入れても直らなかった。

iosにそんな時間をかけたくなかったのでスワイプをそもそもできなくした。(画面をフルにした。)

Appdelegate.m obj-c

FilterNewShowViewController *shopViewC = [[FilterNewShowViewController alloc] initWithNibName:@"FilterNewShowViewController" bundle:[NSBundle mainBundle]];

>>>>shopViewC.modalPresentationStyle =  UIModalPresentationFullScreen;  

>>>>shopViewC.modalInPopover = YES;  //スワイプで消えなくなる。

self.window.rootViewController = shopViewC;

[self.window makeKeyAndVisible];
Viewcontroller.m obj-c
FilterNewShowViewController *shopViewC = [[FilterNewShowViewController alloc] initWithNibName:@"FilterNewShowViewController" bundle:[NSBundle mainBundle]];
>>>>shopViewC.modalPresentationStyle = UIModalPresentationFullScreen; //表示形式の選択
>>>>shopViewC.modalInPopover = YES; //スワイプで消えなくなる。
[self presentViewController:shopViewC animated:YES completion:nil];
Viewcontroller.swift
let vc = UIViewController()
>>>>vc.modalPresentationStyle = .fullScreen;
>>>>vc.isModalInPresentation = true;
present(vc, animated: false, completion: nil)

NSDateから曜日を取得する[Objective-C,Swift]

Objective-C

NSDate *date = [NSDate date]; 
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSWeekdayCalendarUnit fromDate:date]; 
NSInteger weekday = [components weekday];

Swift

var date = NSDate()
var calender = NSCalendar.currentCalendar()
var components = calender.components(NSCalendarUnit.YearCalendarUnit|NSCalendarUnit.MonthCalendarUnit|NSCalendarUnit.DayCalendarUnit|NSCalendarUnit.WeekdayCalendarUnit, fromDate: date)
var weekday = components.weekday

weekdayは1=日曜日〜7=土曜日です。

日曜日月曜日火曜日水曜日木曜日金曜日土曜日
1234567