Projet du cours Geste et AI

02/16/2018

Introduction au projet 項目介紹

Air-Synth

Créez des mappings geste-son basés sur les gestes et mouvements des mains à laide de la caméra stéréoscopiques IR Leap Motion. Le capteur fournit les coordonnées des phalanges, de la paume et des poignets avec une grande précision et présente une latence acceptable pour linteraction musicale. Il existe différentes stratégies de mappings, certaines "directes" avec seuillage des coordonnées spéciales et/ou de leurs dérivées, dautres "indirecte" avec des algorithmes de classification et/ou régression. Le but de lexercice étant de faire de la musique, le coeur de létape de mapping consiste à controller des sons et des effets de manière intuitive, naturelle, musicale. Pour cela, nous encoderons les descripteurs gestuels sous forme de flux midi qui serviront à contr?ler les synthétiseurs et séquenceurs du logiciel Ableton Live.

Dans un second temps, nous nous intéressons à la représentation graphique des trajectoires générées afin de fournir un retour visuel continu à l』utilisateur, mais aussi à l』audience. Cette représentation visuelle servirait à aiguiller les actions de utilisateur, tout en augmentant la représentation scénique. En laissant une marque visuelle des mappings, nous pouvons comprendre et évaluer la qualité du système.

關鍵詞:

seuillage : 閾值

dérivée :

midi : MIDI 格式

marque/retour visuelle

motion , vitesse, intensité de son

準備工作:軟體安裝與背景知識

Leap Motion SDK : introduction

Midi

Ableton LiveAbleton Live - WikipediaAbleton Live

安裝版本:

Ableton Live Trial

Leap Motion : V2

A Hello World Sample :

import os, sys, inspect, thread, timesrc_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))arch_dir = ../libsys.path.insert(0, os.path.abspath(os.path.join(src_dir, arch_dir)))import Leapclass SampleListener(Leap.Listener): def on_connect(self, controller): print "Connected" def on_frame(self, controller): frame = controller.frame() print "Frame id: %d, timestamp: %d, hands: %d, fingers: %d" % ( frame.id, frame.timestamp, len(frame.hands), len(frame.fingers)) def main(): listener = SampleListener() controller = Leap.Controller() # Have the sample listener receive events from the controller controller.add_listener(listener) # Keep this process running until Enter is pressed print "Press Enter to quit..." try: sys.stdin.readline() except KeyboardInterrupt: pass finally: # Remove the sample listener when done controller.remove_listener(listener)if __name__ == "__main__": main()

02/23/2018

Use SDK of the Leap Motion

閱讀:

[1] Getting Started with the Leap Motion SDK

Getting Started with the Leap Motion SDKblog.leapmotion.com圖標

[2] Project Model Design Example : Creating a Hand-Controlled Orchestra with GecoMIDI

[3] How to use Frame, especially, we can get the previous frame by using frame(1).

[4] Use Frame.hands.rightmost to get a hand Object.

The following is an example of on_frame() function of class SampleListener. It catches the direction vector of the index finger and if the rotating degree is larger than pi / 9 within 10 frameId (1 frameid is about 0.05 s), we identified it as a gesture (to be defined).

If the gesture is observed, we use controller.remove_listener to remove the Listener attached to the Controller . This will stop our algorithm.

import numpy frame = controller.frame()last_frame = controller.frame(10)direction_1 = frame.hands.rightmost.fingers[1].bone(2).directiondirection_2 = last_frame.hands.rightmost.fingers[1].bone(2).directionif (direction_1).angle_to(direction_2)>numpy.pi/9: print("stop") print(direction_1,direction_2) controller.remove_listener(self) # self is SampleListener

Further development will concentrate on the definition of Gestures, as well as how to map those gestures to MIDI.

關於MIDI

MIDI called Musical Instrument Digital Interface.

We are going to create a MIDI file using the library python-midi.

如何使用 python-midi

import midipattern = midi.Pattern()track = midi.Track()track.append(midi.NoteOnEvent(tick=100, velocity=50, pitch=midi.F_1))track.append(midi.NoteOffEvent(tick=200, velocity=50, pitch=midi.F_1))track.append(midi.NoteOnEvent(tick=100, velocity=50, pitch=midi.F_1))track.append(midi.NoteOffEvent(tick=200, velocity=50, pitch=midi.F_1))track.append(midi.EndOfTrackEvent(tick=1))pattern.append(track)midi.write_midifile("my_example2.mid", pattern)

關於不同的MIDI庫的比較,參考

【Python圖像特徵的音樂序列生成】使用Python生成簡單的MIDI文件 - 姜子瑜 - 博客園

關鍵詞:

MIDI : zh.wikipedia.org/wiki/M

為樂器等演奏裝置定義音符和演奏碼,允許不同的媒體控制裝置相互通訊。

...

幾乎所有的錄音工程都將MIDI作為一項關鍵開放技術來紀錄音樂

...

MIDI標準是在1981年由工程師戴夫·史密斯向音訊工程協會提出的的一篇論文,MIDI 1.0於1983年8月發布。

MIDI使得電腦、合成器、音效卡以及電子樂器(電子鼓、電子琴等)能互相控制、交換訊息。現在電腦的音效卡都是與MIDI相容的,並能逼真地模擬樂器的聲音。

許多音樂的檔案格式,都建構於MIDI檔之上。這些格式可說就是電子樂器在看的電子樂譜,所以通常一個檔案只需幾十KB,就能夠讓電子樂器演奏出一首很完整的音樂

SMF:Standard MIDI File 標準的MIDI檔案

Python-midi : An open-source GitHub library for creating MIDI file in Python. vishnubob/python-midi

Import MIDI to Ableton

This can be found on the website of Ableton : Working with MIDI files

This is easy if MIDI is already generated and stored in the local :

  • drop the file to the one of columns in the board of Ableton Live.
  • choose one of the instrument and click start button.

The MIDI graph can be seen as below.


推薦閱讀:

2017年你錯過了哪些AI圈大事?最全盤點,值得收藏!
獨家對話CMU德撲AI賭神團隊:解密1+2技術架構,不攻反而不敗
觀點 | 微軟全球執行副總裁沈向洋:致AI時代的我們 —— 請不要忽視寫作的魅力
「一點點」和「喜茶」的這些套路你應該知道
人工智慧對未來的預測越來越准了

TAG:人工智慧 | 機器學習 |