# 用AI玩編曲 --- ## 我誰! * 107級數位音樂社教學 * 107級運輸與物流管理學系 * 本業:軟體工程師(文件自動化相關) * 副業:金融分析(自動交易、推播、爬蟲、回測) * 樂器:鍵盤類 * 工作站:FL Studio * 曲風:各式各樣 * 小作品:[網頁MIDI編輯器](https://chuboy.dev/midi/) --- ## 議程 ### 音樂要素 * 節奏-鼓組對應 * 旋律-演奏方式 * 和弦-五度圈與曲風 * 音源-取樣機與合成器 ---- ### 安裝python程式 * MacOS系統套件管理 * [Homebrew](https://brew.sh/) * `brew install miniforge` * Windows系統套件管理 * [Chocolately](https://chocolatey.org/) * `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))` * `choco install miniconda3` * 啟用python虛擬環境 * `conda activate base` ---- ### 取得音檔 * 下載音樂 [pytube](https://pypi.org/project/pytube/) * `pip install pytube` * `python -m pip install git+https://github.com/nficano/pytube` * `pytube https://www.youtube.com/watch?v=M6gcoDN9jBc` * ```mv `ls | grep Aimer` Aimer.mp4``` * 音訊轉檔 [ffmpeg](https://ffmpeg.org/) * `ffmpeg -i Aimer.mp4 Aimer.mp3` ---- ### 音軌切割 * [Deezer Spleeter](https://github.com/deezer/spleeter) * `pip install spleeter` * `spleeter separate -p spleeter:5stems -o Aimer Aimer.mp3` ---- ### 音訊處理 * [Audacity](https://www.audacityteam.org/) * [librosa](https://librosa.org/) ---- ### 音高偵測 Pitch Detection * [Scipy](https://stackoverflow.com/questions/32595404/pitch-detection-in-python) * [CREPE](https://github.com/marl/crepe) ---- ### 我試過的數位音樂工作站 * [Reason](https://www.reasonstudios.com/en/reason) * [RL Studio](https://www.image-line.com/) * [Ableton](https://www.ableton.com/) * 搭配玩具更好玩:[Launchpad](https://novationmusic.com/en/launch) * [Sonar](https://www.musictech.net/tag/cakewalk/) * [Logic Pro](https://www.apple.com/tw/logic-pro/) * [Studio One](https://www.presonus.com/products/studio-one/) * [Soundation](https://soundation.com/) ---- ### 音樂研究主題 [DL4M](https://github.com/ybayle/awesome-deep-learning-music) * 中研院 * [musegan](https://salu133445.github.io/musegan/) * [pypianoroll](https://github.com/salu133445/pypianoroll) * Facebook * [Sound Collection](https://business.facebook.com/creatorstudio/fm_sound_collection?reference=redirect_from_sound_collection) 免費聲音素材 * Google * [magenta](https://magenta.tensorflow.org/demos) * Openai * [Musenet](https://openai.com/blog/musenet/) * [Jukebox](https://jukebox.openai.com/) --- ## 節奏 Beat ---- ### 節拍速度 * Largo 40 * Adagio 66 * Andante 76 * Moderato 108 * Allegro 120 * Presto 168 * Prestissimo 200 ---- ### 鼓的元素 ![](https://i.ytimg.com/vi/O-B1YSZ_GQ8/maxresdefault.jpg) ---- ### 鼓的MIDI位置 ![](https://d29rinwu2hi5i3.cloudfront.net/article_media/d494a425-3e9d-4d04-8d75-3e25a6e1a188/01_fig_1_drum_maps.jpg) --- ## 旋律 Melody ---- ### MIDI資源下載 * https://www.cprato.com/ * https://musescore.com/ ---- ### 演奏方式 * 滑音(glide/portamento/glissando) * 顫音(trill/trillo) * 上漣音 (upper mordent/inverted mordent/pralltriller) * 下漣音(lower mordent/mordent) * 倚音 * 短倚音 ---- * 圓滑線Slur * 連結線Tie * 加強音Marcato * 斷奏Staccato * 大斷奏Staccatissimo * 保持音Tenuto * 延音Fermata ---- ### 強弱表達 * 強弱音義大利文符號 ppp|pp|p|mp -|-|-|- pianississimo|pianissimo|piano|mezzo-piano 極弱|非常弱|弱|中弱 mf|f|ff|fff -|-|-|- mezzo-forte|forte|fortissimo|fortississimo 中強|強|非常強|極強 ---- * 強弱漸變 * crescendo(簡作 cresc.)漸強 * decrescendo(簡作 decresc.)漸弱 * diminuendo(簡作 dim.)漸弱 --- ## 和弦 Chord ---- [一部影片之內,真的完全搞懂「五度圈」!(Circle of fifth)](https://www.youtube.com/watch?v=EyF7EBnmdEs) ![](https://pic2.zhimg.com/v2-78a9f692cacf2ea63dffac19ccd24feb_1440w.jpg?source=172ae18b) ---- ### 曲風 Genre 流行 | KPOP, JPOP, CPOP, Cantopop -|- 藍調 | R&B, 爵士 嘻哈 | Hihop 搖滾 | Rock 金屬 | Metal 電子 | EDM, Drum&Bass, Trance, Dubstep 環境 | Epic --- ## 取樣原理 ---- ### 取樣音源 sampler * [鋼琴](https://github.com/tambien/Piano) * [808鼓組](https://soundpacks.com/free-sound-packs/roland-mc-505-808-kit/) * [原聲(acoustic)鼓組](https://github.com/gregharvey/drum-samples) ---- ### 音高 pitch $$ p=69+12*log_2(\frac{f}{440}) $$ ---- ### 頻率 frequency $$ f=440*2^{\frac{(p-69)}{12}} $$ ---- ### 鋼琴取樣機 音名|頻率|音階|八度 -|-|-|- A4 | 440.00 | (10/12) | 0~7 C5 | 523.25 | (1/12) | 1~8 Ds5 | 622.25 | (4/12) | 1~7 Fs5 | 739.99 | (7/12) | 1~7 --- ## 音訊處理 DSP ---- ### 快速傅立葉轉換 FFT * DFT 離散傅立葉轉換 $$ X_k=\sum^{N-1}_{n=0}x_n e^{-i2\pi k\frac{n}{N}} $$ ---- ### 倒頻譜轉換 Mel * Mel Scale $$ m=2595*log_{10}(1+\frac{f}{700}) $$ ---- ### 視覺化 Visualize > waveform 波形圖 ![](https://tse1.mm.bing.net/th?id=OIP.0sKuBqh7E6KNKU6X0zAvzwHaEK&pid=Api&P=0) ---- > spectrum 頻譜圖 ![](https://i.ibb.co/dkNLhxD/track1.jpg) ---- > spectrogram 時頻圖 ![](https://www.projectrhea.org/rhea/images/c/c5/Spectrogram-19thC.png) --- Sine|Triangle|Square|Pulse|Saw|Random -|-|-|-|-|- 正弦波|三角波|方波|脈衝波|鋸齒波|隨機波(雜訊) ![](https://www.image-line.com/support/FLHelp/html/img_plug/3xOsc.png) ---- ### 波封 ADSR [3XOSC](https://codepen.io/HandsomeChuBoy/pen/LKpJEw) ![](https://i.ytimg.com/vi/Y91AnXwbwkU/maxresdefault.jpg) ---- ### 等化器 Equalizer ![](http://i0.wp.com/diymusic.co.uk/wp-content/uploads/2015/04/Fruity-Parametric-EQ-Hi-pass.png?resize=620%2C352) ---- ## 雙聲道 Panner ![](https://images.squarespace-cdn.com/content/v1/54ef9609e4b057c8e72c6455/1588671675252-WSS1XYIGF7LL3NMOYLBS/ke17ZwdGBToddI8pDm48kO0bs4dgy6qGfrN9sVmIzkp7gQa3H78H3Y0txjaiv_0fDoOvxcdMmMKkDsyUqMSsMWxHk725yiiHCCLfrh8O1z4YTzHvnKhyp6Da-NYroOW3ZGjoBKy3azqku80C789l0uXhCC-2_EJ8PkVQLXEKgO_oDkQIcbfghyKJlxlINVRswe8B5vmcHEJaWVE8mOU1pg/Surround+Panner+vs+Balancer.png) ---- ## 壓縮器 Compressor ![](https://www.image-line.com/fl-studio-learning/fl-studio-online-manual-zh/html//img_plug/Maximus.png) ---- ## 回(殘)響 Reverb Convolver (convolution reverb) ![](https://reverb-res.cloudinary.com/image/upload/v1516991408/Logic-Pro-X_pct2jy.jpg) ---- ## 延遲效果 Delay ![](https://help.apple.com/assets/5EFDEEB1680CE2A512819D40/5EFDEECB680CE2A512819DAE/en_US/091dca1e783934de1783fcf50d7c91a1.png) ---- ## 相位 Phaser ![](https://help.apple.com/assets/600B21079024353789008B13/600B210D9024353789008B39/en_US/bf58350daebcbcddfdf674a96a093781.png) ---- ## 失真 Distortion(Waveshaper) ![](http://i.imgur.com/mBJEiaM.png) --- ## 合成器 ---- ![Logic Pro ES2](https://help.apple.com/assets/600B21079024353789008B13/600B210D9024353789008B39/en_US/1974f5c26405130a4950c2b1e1b3d986.png) ---- ![Xfer SERUM](http://cdn.shopify.com/s/files/1/0129/7698/0032/articles/serum_arp__1_1200x1200.jpg?v=1552402494) --- ## 音樂研究主題 ---- ![](https://github.com/ybayle/awesome-deep-learning-music/raw/master/fig/pie_chart_task.png) ---- ### 捲積運算(特徵提取) ![](https://discuss.pytorch.org/uploads/default/original/3X/5/c/5c2ea7830a36d833509108549750dbe237c03020.jpeg) ---- ### UNET網路架構(音軌切割) ![](https://raw.githubusercontent.com/shreyaspadhy/UNet-Zoo/master/unet.png) ---- ### AutoEncoder(自編碼器) ![](https://cdn-images-1.medium.com/max/1574/1*44eDEuZBEsmG_TCAKRI3Kw@2x.png) ---- ### GAN(音訊生成) ![](https://tse1.mm.bing.net/th?id=OIP.PYL2gmQmSkiTYRzYUsCw6AHaDv&pid=Api&P=0&w=363&h=183)
{"metaMigratedAt":"2023-06-16T00:39:36.243Z","metaMigratedFrom":"YAML","title":"用AI玩編曲","breaks":true,"slideOptions":"{\"theme\":\"night\",\"transition\":\"slide\",\"spotlight\":{\"enabled\":true}}","contributors":"[{\"id\":\"794553c4-57e8-424f-b9da-1f0d40a61e1b\",\"add\":34028,\"del\":26920}]"}
    655 views