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
Sine Wave By Ruby
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
5hun
June 07, 2026
55
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Sine Wave By Ruby
Omotesando.rb #122
5hun
June 07, 2026
More Decks by 5hun
See All by 5hun
Rubyと演奏したい〜その第一歩〜.pdf
5hun
1
55
Array#forty_two
5hun
0
71
与信管理を形にする: Ruby の柔軟性が支える高速データ収集・自動化基盤
5hun
1
320
ぼっちが秘める可能性〜孤高のRubyistが語る交流会サバイバル術〜
5hun
1
46
君もRailsもアップグレード!
5hun
1
22
完璧主義にこだわり続けるとシステム開発は不幸になると思った
5hun
0
48
OSSコントリビュート初体験:Rubocopのバグを修正した話
5hun
0
53
地道なリファクタを続けてRspec高速化した話
5hun
0
76
“技術カンファレンスで何か変わる?” ──RubyKaigi後の自分とチームを振り返る
5hun
0
260
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
350
Statistics for Hackers
jakevdp
799
230k
A Tale of Four Properties
chriscoyier
163
24k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
Unsuck your backbone
ammeep
672
58k
Designing for humans not robots
tammielis
254
26k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Designing for Performance
lara
611
70k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
410
Transcript
Sine Wave By Ruby Omotesando.rb #122
流行りに乗ってみた • Rubyで音を出したり、光らせたりが流 行っている感じがするので流行りに乗っ てみました。 • 初心者なので今日は、サイン波をならし てみたいと思います。
サイン波とは • サイン波は、一つの周波数成分しか含ま ない音のこと – 純音とも呼ぶ(←専門用語) • 音の中で最も単純でシンプルな波形
サイン波とは その2 • a : 振幅 • f : 周波数[Hz]
• t : 時刻 [s] • θ : 初期位相 [rad] • y(t) = a × sin(2π × f × t + θ)
サンプルコード
サンプルコード
何が出力されているのか • 1から-1の間の数字の配列 • 時間における縦軸(y軸)の位置を表して いる
Math.#sin • Rubyの組み込みライブラリ • sineの計算してくれる https://docs.ruby- lang.org/ja/latest/method/Math/m/sin.ht ml
倍音を重ねる
倍音を遅延して重ねる
これがいわゆる情操教育!? • Rubyの組み込みライブラリを使って簡単 音出し! – 時間の指定 – 周波数の指定 – 音を重ねる
自己紹介 • 5hun • @5hun_s • Rubyエンジニア • 楽器が好き