Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Playing with WebAudio
Search
Akira Morikawa
April 23, 2018
Technology
89
0
Share
Playing with WebAudio
ブラウザJavascriptを使って簡単な作曲環境を作りました
Akira Morikawa
April 23, 2018
More Decks by Akira Morikawa
See All by Akira Morikawa
コロナ禍だからこそ考えるオフラインコミュニティの意義 / significance of community
ariaki
0
2.1k
アウトプットの始め方/start output 20230121
ariaki
0
350
web-secure-phpcon2020
ariaki
3
3.7k
オブジェクトライフサイクルとメモリ管理を学ぼう / OOC 2020
ariaki
8
4k
エンジニアはアウトプットによって成長できるのか? / Grow with your output
ariaki
24
6.7k
アウトプットを始めよう / How to begin output jawsug-bgnr
ariaki
2
4k
参加者の安全を守れていますか? / Protecting community safety
ariaki
1
7.6k
タピオカに学ぶ二段階認証 / tapioca-mfa
ariaki
5
1.4k
古に学ぶ個人開発のススメ / My recommendation of personal development
ariaki
1
1.6k
Other Decks in Technology
See All in Technology
オライリーイベント登壇資料「鉄リサイクル・産廃業界におけるAI技術実応用のカタチ」
takarasawa_
0
410
おいらのAWSアップデートの追い方〜Slack×AgentCore〜
yakumo
1
110
React Compiler導入から21ヶ月、いま始めるならこうやる
astatsuya
2
250
The Bag-of-Documents Model for Query Understanding and Retrieval
dtunkelang
0
150
「強制アップデート」か「チームの自律」か?エンタープライズが辿り着いたプラットフォームのハイブリッド運用/cloudnative-kaigi-hybrid-platform-operations
mhrtech
0
210
freeeで運用しているAIQAについて
qatonchan
1
640
2026-05-14 要件定義からソース管理まで!IBM Bob基礎ハンズオン
yutanonaka
0
160
20260515 ログイン機能だけではないアカウント管理を全体で考える~サービス設計者向け~
oidfj
1
750
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.7k
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.4k
Swift Sequence の便利 API 再発見
treastrain
1
290
AI時代に、 データアナリストがデータエンジニアに異動して
jackojacko_
0
1k
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
The Language of Interfaces
destraynor
162
26k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
300
Code Reviewing Like a Champion
maltzj
528
40k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
Skip the Path - Find Your Career Trail
mkilby
1
120
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
200
Fireside Chat
paigeccino
42
3.9k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Claude Code のすすめ
schroneko
67
220k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
GitHub's CSS Performance
jonrohan
1033
470k
Transcript
WebAudioで遊んでみた 2018. 04. 27 ariaki // ブラウザ Javascript が面白い件
WebAudio 知ってる人いる?
What’s WebAudio HTML5 Multimedia Audio Video
AudioContext AudioContext MediaElement MediaStream Source Destination Oscillator
Oscillator を使って 遊んでみよう
Purpose 着メロ的なやつを鳴らしてみよう ① とりあえず音を出す ② 音階を変える ③ 音の長さや速度を変える ④ メロディを作れる
⑤ 時間の都合上、単音でやる ⑥ なんか面白い感じにする
Playing with OscillatorNode var audioContext = new AudioContext(); var masterGain
= audioContext.createGain(); //Gain: 音量 var oscillator = audioContext.createOscillator(); //Oscillator: 波形生成 oscillator.connect(masterGain); masterGain.connect(audioContext.destination); oscillator.start(audioContext.currentTime); #1 初期化する
Playing with OscillatorNode AudioContext Oscillator Gain (connect) (connect) Destination (create)
Playing with OscillatorNode masterGain.gain.value = 1.0; //ボリューム: 0.0~1.0 oscillator.frequency.value =
440; //音階(Hz): 0~1000 oscillator.type = ‘sawtooth’; //波形種類: sine | square | sawtooth | triangle | custom oscillator.start(); #2 音を出してみる frequency=440 → A音:音階を変えるには? 440 * Math.pow(2, n/12);
Playing with OscillatorNode #3 曲を作って再生してみた - 音階を設定して音を鳴らす - setTimeout()で指定時間待ってから次の音出す -
音を止める時はgain=0にすればいいよね - 鳴らす音のリストは配列作ってループさせよう
Playing with OscillatorNode var scores = [{note:60, size:1}, {note:62, size:1},
...]; var sound = scores.shift(); scores.length > 0 play( sound ); Fin
https://ariaki.info/webaudio Demonstration
WebAudio 他にもいろんな機能があるよ
Other Nodes Node Description BiquadFilter バンドパス / バンドシェル ... (Equalizer,
Phaser, Wah, ...) ChannelSplitter / ChannelMerge チャンネルを分割・結合する Compressor 音量をそろえる Convolver 空間反響させる(Reverb) Delay 音を遅延させる(Chorus, Flanger, ...) Gain 音量を変化させる(Tremolo) Panner 音の位置を変える WaveShaper 音を歪ませる(Distortion, Overdrive, Fuzz, ...)
Other Nodes Node Description Analyzer 信号のスペクトラム情報を取得する ScriptProcessor 生の音声バッファ(バイナリ)を取得する
Other Nodes まとめ - 音源はたくさん(マイク・ファイル・オシレータから生成) - 多彩なエフェクタを使って加工できる - アナライザを使ってスペクトル可視化できる -
編集結果を出力/保存できる
これからは JS で作曲する時代 # 昔CALで書いてた人
Thank You For Your Attention !