SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
Web Audio API と
モールス信号
Table of Contents
1. 自己紹介
2. モールス信号の基本
3. JavaScript で モールス信号
4. ひっかかったところ
自己紹介
- まっは (@mach3ss)
- 横浜で活動するフリーランスの Web デザイナー
- 器用貧乏
- HTML/CSS/JavaScript/Less その他いろいろ
- ピアノ弾いたり惰眠を貪るのがすき
モールス信号の基本
モールス信号とは、
2 種類の長さの信号(トン・ツー)を組み合わせて
メッセージのやりとりをする通信法のこと。
モールス信号のきまり モールス信号の基本
- 短点(トン)と長点(ツー)で言葉を表現する
- 短点ひとつ分の長さを最小単位とする
- 長点は3トン分
- 各点の間は1トン分あけること
- 文字の間は3トン分あけること
短点(トン)
A
長点(ツー)
B C
モールス信号で「HTML5」 モールス信号の基本
H T
L 5
M
モールス信号と日本語 モールス信号の基本
- 国際的に使われているのはアルファベットのモールス信号
-「和文モールス」は、アルファベットの符号を「いろは」順に
あてはめたものを基本とする
A
B
C
イ
ロ
ハ
ニ
< 該当なし >
モールス信号で「ごはん」 モールス信号の基本
コ ゛(濁点)
ハ ン
JavaScript で
モールス信号
モールス信号の入出力 JavaScript でモールス信号
JavaScript
手打ち入力
テキスト入力
あ A_
<INPUT> <OUTPUT>
音声で再生
(Web Audio API)
テキスト出力
ボスケテ
データの構成をきめる JavaScript でモールス信号
alpha:1111.3.33.1311.11111
kana:3333.11.3111.13131
- 1 でトン、3 でツーをあらわし、文字をドットで区切る
- alpha(アルファベット)か kana(和文)モードを先頭で指定する
インプット(手打ち入力) JavaScript でモールス信号
1. ひととおり手打ちで打ってもらい、
ON/OFF の時間を記録しておく。
2. 様々な長さの中から「短点だと思しき長さ」を取得し、
それを元に全ての長さをトン・ツーに丸める。
3. データに変換して保存
ON OFF
アウトプット(音声で再生) JavaScript でモールス信号
1. Web Audio API で信号音をループで連続再生する。
2. データの「1313」にあわせたタイミングで
音量を 0 と 1 でトグルしてモールス信号を表現する。
ON ONOFF ONOFF
インプット(テキスト入力) JavaScript でモールス信号
1. テキスト内容を変換テーブルと照合してデータにする。
_人人人人人_
> おわり <
 ̄Y^Y^Y^Y ̄
アウトプット(テキスト出力) JavaScript でモールス信号
1. データを変換テーブルと照合して文章化する。
_人人人人人_
> おわり <
 ̄Y^Y^Y^Y ̄
再掲 : モールス信号の入出力 JavaScript でモールス信号
JavaScript
手打ち入力
テキスト入力
あ A_
<INPUT> <OUTPUT>
音声で再生
(Web Audio API)
テキスト出力
ボスケテ
ひっかかったところ
および課題
開発中の仕様変更 ひっかかったところ
および課題
開発中に、再生開始のメソッドと、音量調節の方法が変わっていた。
< 古い方法 >
`AudioBuffer.gain` と `AudioBuffer.noteOn()` は削除されました。
var ctx = new AudioContext(); // [object AudioContext]
var src = ctx.createBufferSource(); // [object AudioBufferSourceNode]
src.buffer = someBuffer;
src.connect(ctx.destination);
src.gain.value = 0.5;
src.noteOn(0);
開発中の仕様変更 ひっかかったところ
および課題
< 新しいスタンダードな方法 >
新しい API を使うときは最新情報に
きちんとアンテナをはっておく(自戒)
var ctx = new AudioContext(); // [object AudioContext]
var src = ctx.createBufferSource(); // [object AudioBufferSourceNode]
var gain = ctx.createGain(); // [object GainNode]
src.buffer = someBuffer;
src.connect(gain);
gain.connect(ctx.destination);
gain.gain.value = 0.5;
src.start(0);
iOS Safari への対応 ひっかかったところ
および課題
■ .ogg のデコードに失敗する
decodeAudioData メソッドで ogg のデータを読ませると
エラーのコールバックで null が返ってくる。
(MacOS X Safari でも同様)
=> Wav や MP3 は正常なのでそちらを使用する
■ ループ再生で隙間があく
AudioBufferSourceNode でループ再生をすると、
ループ毎に余分な隙間が生まれる。
=> どうしよう。
ご静聴ありがとうございました。

Weitere ähnliche Inhalte

Empfohlen

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Web Audio API とモールス信号