最佳化演算法於自動作曲之應用
摘要
本論文主要設計一個基於最佳化演算法的自動作曲系統,此系統可讓使用者藉由彈奏單音樂曲的方式產生音樂範本材料,系統便會透過最佳化演算法自動產生曲風相近之樂曲以供使用者參考。此系統主要由MIDI轉錄以及樂曲產生兩個模組所構成。在MIDI轉錄模組中,使用者可將樂曲用彈奏的方式輸入至電腦,透過訊號前處理以及音高偵測演算法,系統可將PCM編碼的音樂檔案轉錄成MIDI格式的檔案,作為之後樂曲產生模組的輸入材料。在樂曲產生模組中,使用者將音樂範本材料輸入模組後,會對該樂曲材料進行特徵擷取以及樂理分析,再根據使用者所選定的調性以及演奏速度,利用基因演算法或粒子群聚演算法的特性,在有限的規則下產生出富有變化的音樂片段,並且期望這些音樂片段可供作曲者或音樂玩家作為激發他們的創作靈感或可直接使用在他們的作品中。 本論文分別針對此兩個模組設計了實驗,以驗證所提系統之效能。在MIDI轉錄模組的成效驗證之實驗中,對於電吉他以及電子琴的音高辨識率各為100%以及89%,樂曲轉錄的結果則約有84%的正確率。至於樂曲產生模組的評估則採用問卷的方式進行評估,因為樂曲的曲風和悅耳程度目前尚未有公正客觀的評估系數加以量測。本論文收集到14份問卷,在滿分5分的評分中,本利用基因演算法以及粒子群聚演算法所得到的分數分別為2.37分以及2.69分,雖未有高分評價,但皆高於隨機產生的1.6分。

關鍵字:電腦作曲、粒子群聚演算法、基因演算法、最佳化演算法、音高偵測

 

 

The Application of Optimization Algorithms in the Construction of an Automatic Music Composing System
Abstract
This thesis presents an optimization-algorithm-based automatic music composing system. The system allows users to generate reference source materials by playing monophonic music pieces. Then the system will adopt an optimization algorithm to automatically compose some music pieces which are similar to the provided music materials from the viewpoints of the characteristics of the tonality. The proposed system is consisted of two main modules; 1) the MIDI music transformation module and 2) the automatic music composing module. In the MIDI music transformation module, users could input their source materials to the system by playing a monophonic music via a microphone. After some signal preprocessing procedures and a pitch detection algorithm, the MIDI transformation module could convert a PCM encoded audio file into a MIDI format file. The transformed result could then be used as the source materials which are regarded as inputs to the automatic music composing module. After the source materials have been provided to the automatic music composing module, it starts to analyze the music materials and extract some informative features from the materials. Then an optimization algorithm such as the genetic algorithm (GA) and the particle swarm optimization (PSO) is adopted to evolve some music pieces which are similar to provided materials from the viewpoints of the characteristics of the tonality and the tempo selected by the users. We hope that the music pieces composed by the system could be used by composers or music players either as creative inspiration for their music or directly as music pieces in their music. The performance of the proposed system was verified by the experiments. In the experiment of pitch detection, the correct detection rates for the music pieces played by an electric guitar and a keyboard were 100% and 89%, respectively. As for the evaluation of the music composing module, we adopt the questionnaires way. A total of 14 subjects were invited to evaluate the music pieces composed by the GA, PSO, and the random scheme. The questionnaire adopted the 5-scale score. The average score for the music pieces composed by GA and PSO was 2.38 and 2.69, respectively. As for the random scheme, it only got the score of 1.6.

Keyword: Computer Music, Particle Swarm Optimization, Genetic Algorithm, Optimization Algorithm, Pitch Detection.