Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
実践 Realtime API 〜入力として音声データを扱う〜
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
RioFujimon
November 13, 2024
Programming
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
実践 Realtime API 〜入力として音声データを扱う〜
Sansan × YUMEMI iOS ランチタイム LT での発表資料
RioFujimon
November 13, 2024
More Decks by RioFujimon
See All by RioFujimon
iOSDC2026登壇資料.pdf
riofujimon
0
170
Foundation Models を 活用するための Tips
riofujimon
1
420
2025.01.17_Sansan × DMM.swift
riofujimon
4
1.1k
Realtime API 入門
riofujimon
0
390
Let's learn code review
riofujimon
3
1.4k
Other Decks in Programming
See All in Programming
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
200
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
420
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
350
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
300
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
180
アクセシビリティから考える情報設計
high_g_engineer
0
380
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
260
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.3k
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
5
3.5k
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Paper Plane
katiecoart
PRO
4
53k
Abbi's Birthday
coloredviolet
4
10k
Being A Developer After 40
akosma
91
590k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
420
Done Done
chrislema
186
16k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
First, design no harm
axbom
PRO
2
1.3k
Transcript
実践 Realtime API 〜入力として音声データを扱う〜 技術本部 Eight Engineering Unit 藤門 莉生
自己紹介 藤門 莉生(Rio Fujimon) - Sansan株式会社 - 23卒(新卒2年目) - Eight
の iOSアプリを開発 - X(旧 Twitter):@RioFujimon - iOS開発で主に興味がある領域 - UIKit, SwiftUI - Bluetooth, NFC, Audio, etc
Realtime API https://openai.com/index/introducing-the-realtime-api/
Realtime API 紹介 開発者はアプリケーションに 高速な音声合成体験 を組み込めるようになった
Realtime API を利用するメリット Whisper 音声を テキストに 書き起こす テキスト 解析モデル 目的の
応答を生成 Realtime API
Kanagawa.swift で話した内容 目的の 応答を生成 Realtime API https://speakerdeck.com/riofujimon/realtime-api-ru-men 👇以下でスライドを公開中 👇 Swift
で Realtime API を扱う基本を中心に話した
本日話す内容 目的の 応答を生成 Realtime API 音声データを Realtime API への入力として扱う方法を話す
Realtime API Sample App
実装を見ていく
https://platform.openai.com/docs/guides/realtime#audio-formats
💡 要点 - 24kHz, PCM16 の 形式に変換処理を 実施して出力する
💡 要点 - AVAudioSession を 設定し、有効化する
👀 AVAudioPCMBuffer のプロパティを表示してみる
💡 要点 - デフォルトでは、 48kHz, 32 bit の形式 - Int16
の値は、nil
💡 要点(⭐⭐⭐) 1. AVAudioFormat で24kHz, 16 bit の形式を 作成する 2.
指定の形式に変換するための Converter を 作成する 3. 形式変換後の AVAudioPCMBuffer を 準備する 4. Converter で 変換して AVAudioPCMBuffer に格納する 5. 16bit の値を取得する
👀 変換後のAVAudioPCMBuffer のプロパティを表示してみる
目的の形式( 16bit PCM Audio, 24kHz, 1channel)に変換完了 🎉
💡 要点 - AVAudioEngine を起動する - AVAudioEngine, Stream を停止する
💡 要点 - 外部への公開メソッドは 2つのみ - startStreaming() -> AsyncStream<Data> -
Data 型に変換した PCM16 形式の 音声データを流す - stopStreaming()
💡 要点 - startStreaming() -> AsyncStream<Data> を呼び出してストリーミングを開始する - Data 型に変換した
PCM16 形式の 音声データを取得する - APIClient の sendAudioBuffer(_: Data) で Realtime API に音声データを送信 - stopStreaming() でストリーミングを 停止する
💡 要点 - Client Event を作成 - 音声データを送信時は、以下 2つを 指定する
- type: input_audio_buffer.append - audio: 24kHz, PCM16, base64エン コードされた音声データの文字列 - WebSocket を利用して Client Event を 送信する ※ 補足 ( https://platform.openai.com/docs/guides/realtime#server-vad-mode ) - Realtime API では、VAD(Voice Activity Detection) がデフォルトで有効
今後お話する内容 目的の 応答を生成 Realtime API Realtime API からのレスポンスをを音声としてリアルタイム再生する
Thank You For Listening