# Technical, Musical, and Legal Aspects of an AI-Aided Algorithmic Music Production System
## 2 Materials and Methods
### The Critic  
One of the stages of algorithmic music production is the presence of the classification process. Popular classification methods are neural networks. In the proposed system, the multilayer feedforward neural network is used as a classifier. Between neurons in adjacent layers there are connections with associated weights that are adjusted during the neural network training procedure. In [40], an extensive survey on neural networks is presented. Building a good method for classifying music with neural networks is not trivial. A good model should be able to distinguish different labels of generated recordings. Training and testing of the neural network are the main steps in the classification process. This process requires a data set that should be of sufficient size to guarantee proper learning. It becomes more difficult as the dimensions of the feature space increase. Therefore, a correct set of features is necessary for classification because good features separate classes and allow proper grouping. Of course, many features can be brought out, e.g., spectral, temporal, based on pitch, etc. Notably, the expert assessment of generated recordings should be taken into account. Therefore, among the main stages of the classification process, one can find as follows:  
* creating, training, and testing sets,
* building, compiling, and training the neural network,
* evaluating the neural network on the test set. At the beginning, we need to prepare a set of recordings from which the appropriate features will be extracted. Moreover, the expert assessment of the generated recordings is known. As it is known, music items can be represented with contextual information derived from available metadata (not encoded in the audio signal) or with an information extracted from audio content itself [41; 42]. Therefore, in many studies, the procedure of music record classification involves the use of audio data-based musical content, symbolic data-based musical content, or hybrid information. Choosing the correct representation of the data is a key issue in the classification problem. Classical approaches (for example SVM, k-NN) use audio features such as mel-frequency cepstral coefficients (MFCCs) as input to a classifier. In turn, some deep learning methods (e.g., convolutional neural networks) use visual representations of the audio signal in the form of spectrograms. Specifically, the mel spectrogram can be taken as a visual representation of such a signal. Therefore, one can use a set of selected spectral, time-domain, rhythm, and tonal descriptors. The following features to be extracted from the generated music and used in the classification process have been determined:  
* low level descriptors, e.g. :
* 13 first mel-frequency cepstral coefficients (MFCCs),
* dynamic complexity,
* pitch salience,
* spectral complexity (Shannon entropy of a spectrum),
* spectral energy band (high, low),
* rhythm descriptors, e.g. :
* beat count (number of detected beats),
* beat loudness (spectral energy computed on beat segments),
* BPM value,
* onset rate (number of detected onsets per second),
* tonal descriptors, e.g. :
* chord change rate,
* key strength using diatonic profile. Moreover, statistical descriptors can be used such as the mean, median, and standard deviation (stdev). In our case, the descriptor extractor was based on the Essentia library. All descriptors listed above were used. For some descriptors, we used statistical data. Therefore, we had the following: mean values for 13 first MFCCs, more statistical values (such as the maximum, minimum, mean, median, stdev, and variance) for dynamic complexity, pitch salience, spectral complexity, spectral energy band (high and low), and beat loudness. In the case of dissonance, we used only the maximum, minimum, and stdev. We used a total of 54 parameters. After selecting the appropriate model of the neural network, the process of evaluating the new generated recordings follows.