SlideShare a Scribd company logo
こんばんは、だん(@arcsin16)です。
お仕事でHoloLens2触りながら趣味でHoloLens2で遊んだりしてます
だん(@arcsin16) 1
前回「焔の錬⾦術師」をやってみて気づきが⼀つ
だん(@arcsin16) 2
ごっこ遊びとHoloLens2 親和性あるなぁ
ごっこ遊び = 想像と現実の複合
HoloLens2 = 仮想と現実の複合
だん(@arcsin16) 3
ごっこ遊び
ゲームではないので、ルールがなくても楽しめる 作るのが楽
だん(@arcsin16) 4
なんかもう少しごっこ遊び具現化してみたいなぁとい
うことでやってみたのがこちら
だん(@arcsin16) 5
『HoloLens2でエアギターを実際に弾いてみた』
だん(@arcsin16) 6
なに あほなこと やってんですか︖
指(リアル)と弦(仮想)の接触判定
Karplus-Strongアルゴリズムによるギターの波形の動的⽣成
左⼿で弦(フレット)を抑えて⾳の⾼さが変わるように
UnityのOnAudioFilterReadを使って⽣成した波形を出⼒
だん(@arcsin16) 7
ギターの波形の動的⽣成
Karplus-Strongアルゴリズムを使ってギターの波形を動的⽣成する
https://en.wikipedia.org/wiki/Karplus–Strong_string_synthesis
OnAudioFilterRead に動的に⽣成した波形を流して⾳を出⼒
だん(@arcsin16) 8
鳴らす弦とフレットの位置から鳴らす⾳の周波数を計算
float freq = FREQ_A * Mathf.Pow(2, (freqOffset + fret)/12f);
だん(@arcsin16) 9
1周期分のホワイトノイズ⾳を⽣成
for (int i = 0; i < ringBuffer.Length(); i++)
{
ringBuffer[i] = Random.Range(-amplitude, amplitude);
}
だん(@arcsin16) 10
このランダムノイズを繰り返し出⼒すると指定した周波数のホワイトノイズ⾳が
聞こえる
だん(@arcsin16) 11
繰り返すときに、そっくりそのまま同じ波形を出⼒するのではなく
連続する2つの値の平均を次のループの値となるようにすると ギター⾳になる
float first = ringBuffer.Pop();
float second = ringBuffer.Peek();
float newValue = this.decayFactor * (first + second) / 2;
ringBuffer.Push(newValue);
だん(@arcsin16) 12
OnAudioFilterRead に動的に⽣成した波形を流して⾳を出⼒
void OnAudioFilterRead(float[] data, int channels)
{
// OnAudioFilterReadに渡されるdataに波形を出⼒すれば⾳が鳴る
for (int n = 0; n < data.Length / channels; n++)
{
float v = 0;
for (int i = 0; i < strings.Length; i++)
v += strings[i].sample; // 6弦分の波形を合成
for (int c = 0; c < channels; c++)
data[n * channels + c] = v; // 右⽿、左⽿に同じ波形を出⼒
for (int i = 0; i < strings.Length; i++)
strings[i].Tic(); // バッファを進める
}
}
だん(@arcsin16) 13
⾳を鳴らす基幹はできたので後はUI
指(リアル)と弦(仮想)の接触判定、ベクトル演算楽しーなー
右⼿で弦を弾くのはちょっと難しいけどなんとか
左⼿で触感のないフレットを抑えるのは⼈類にはベリーハード
だん(@arcsin16) 14
どうやって⾳階を変えよう
だん(@arcsin16) 15
左⼿も右⼿も使っているのでGazeを使おう
だん(@arcsin16) 16
アコギもいいけど、エレキも弾きたいな
ディストーションエフェクトをかけてエレキギターの⾳⾊
if(Distortion)
v = Mathf.Clamp(v * gain, 0f, 1f) * level;
ついでにトレモロ(ほわほわゎゎ〜ん)
if (Tremoro)
{
_tremoroCount = (_tremoroCount + 1) % fs;
float a = 1.0f + depth * Mathf.Sin(2 * Mathf.PI * rate * _tremoroCount / fs);
v = a * v;
}
参考︓ https://ime.ist.hokudai.ac.jp/~aoki/almost_any_sound.html
だん(@arcsin16) 17
だん(@arcsin16) 18
エアギター完成
だん(@arcsin16) 19
やってみて
だん(@arcsin16) 20
聴覚的なMRの可能性を感じた
ギターを⽬視しなくても、⾳がなるのでギターを弾いている感がする
ギターはないのにギターはある
だん(@arcsin16) 21
エアギターを弾いていることは⼀⽬瞭然
周りの⼈から気持ち悪がられない
⾒てわかるだろう︖エアギターを弾いているのだよ
だん(@arcsin16) 22
HoloLens2さえあれば⼈類はエアギターを弾ける
これは⼩さな⼀歩だが、虚構が虚構ではなくなる⼈類の⼤きな⼀歩である
だん(@arcsin16) 23

More Related Content

Featured

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
Neil 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 2024
Albert 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 Insights
Kurio // 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 2024
Search 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 summary
SpeakerHub
 
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 Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit 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 management
MindGenius
 
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 Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
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
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
 

Featured (20)

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
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

HoloLens2でエアギターを実際に弾いてみた