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
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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.2k
アウトプットの始め方/start output 20230121
ariaki
0
370
web-secure-phpcon2020
ariaki
3
3.7k
オブジェクトライフサイクルとメモリ管理を学ぼう / OOC 2020
ariaki
8
4.2k
エンジニアはアウトプットによって成長できるのか? / Grow with your output
ariaki
24
6.8k
アウトプットを始めよう / How to begin output jawsug-bgnr
ariaki
2
4.1k
参加者の安全を守れていますか? / Protecting community safety
ariaki
1
7.7k
タピオカに学ぶ二段階認証 / tapioca-mfa
ariaki
5
1.4k
古に学ぶ個人開発のススメ / My recommendation of personal development
ariaki
1
1.6k
Other Decks in Technology
See All in Technology
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
5
910
35分でわかるEffective Platform Engineering
nwiizo
5
630
AI-DLC実践録_フルサイクル開発への挑戦
miyuc
0
420
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9.4k
Kiro WebとCloud Sessions
nagisa53
2
190
AI for Science時代を切り開く、政府の次世代HPC戦略の展望
gpuunite_official
0
240
わたしが知り合いゼロの勉強会に 行けるようになるまで
r5ni4
2
530
Head First モブプログラミング / Head First Mobprogramming
takaking22
10
12k
1.5時間を無駄にして学んだwsl2におけるaptとsnapの選択と仕組み
yosaka0123
0
420
AI開発に用いられるHPC技術について
gpuunite_official
0
270
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
250
Data Hubグループ 紹介資料
sansan33
PRO
0
3.2k
Featured
See All Featured
Between Models and Reality
mayunak
4
400
Scaling GitHub
holman
464
140k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
The Limits of Empathy - UXLibs8
cassininazir
1
610
[SF Ruby Conf 2025] Rails X
palkan
2
1.3k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
800
Optimising Largest Contentful Paint
csswizardry
37
3.9k
BBQ
matthewcrist
89
10k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
420
Writing Fast Ruby
sferik
630
63k
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 !