Matlab Assignment Help

The solution depicted is an interesting application of machine learning algorithms in music genre detection and classification. Spectrogram was used as a main tool for this purpose. Principles of MATLAB image processing and statistical analysis like SVD – single value decomposition, linear discriminant analysis, Markov Models, MATLAB function spectrogram, Eigen vectors, PCA – principal component analysisetc were used to do the analysis. The code and the report for MATLAB assignment help incorporates 3 tests that were conducted viz: band classification, genre classification and classification within the same genre. 5 second music clips from different bands/genres were used as ‘training data’.

Music recognition with SVD

Music classification is a problem that can be approached in many ways, mainly from the many possible options for feature extraction. In this project we attempt to use spectrogram as the main tool for music classification, and we use the knowledge provided during the coursework for image Matlab assignment help processing using singular value decomposition (SVD). We investigate different results based on the target data sets from different genres and different number of significant components included. In each case, a classificator using linear discriminant analysis (LDA) is successfully found and implemented, and the result tested with different data to provide moderate to good results in each case.

Introduction and Overview

Music classification and recognition is a problem that can be processed in the domain of sound processing using hidden Markov models and other signal-specific techniques, but it can also be processed using the spectrogram. Music as we perceive it is a time-varying group of frequencies, so at some level spectrogram should reflect what the human ear and auditory cortex do to break down and process the music we hear. As always, we do not have a good insight into the workings of our brain and senses, but we can still attempt to merge our knowledge from image processing, principal component analysis and machine learning and try to create a relatively successful classifier for different types of data.

We used the internet to find the instructed music data sets – music of classical authors (Beethoven, Mozart, Strauss and Vivaldi), Michael Jackson greatest hits, 90s grunge bands (Alice in Chains, Pearl Jam and Soundgarden) as representatives of rock music, and a database of Matlab homework help  techno samples that were long enough to get a 5 second sample to compare to the others. All the music was sampled at 44100Hz (classic WAV format), and to fully automate the process (and perhaps avoid copyright issues) we chose the same interval without listening to the actual songs – 5 seconds interval between 20th and 25th second (with the exception of techno samples which were taken from the start). The idea was to choose an interval where the Matlab project assignment help characteristic sounds are likely to appear and avoid silent intros and other segments.

The first test was used to assess different bands, each from different genres, so music of Beethoven, Soungarden and Michael Jackson was used to Matlab assignment help project three classifiers between groups. The second stage involved a more difficult task of attempting to differentiate between members of the same genre (three representatives of grunge rock), and the last part of the project creates classifiers to separate different genres, each of them containing a multitude of bands.

After extracting the music samples and placing them in convenient .mat archives for further processing, the spectrogram was performed and the data formatted in vectors for SVD. After that, linear discriminant analysis was performed to form a Matlab project homework help  pairwise classifier for each of the three pairs in groups of three compared at a time. Although we test them in pairs and only with appropriate classificators (we do not classify sample from group 1 with a classificator between groups 2 and 3), it should be noted that in a fully functional classifier that separates into multiple classes each test sample would be classified with each of the classifiers, and mode value would be the final class result.

Theoretical background

PCA was discovered at the beginning of 20th century, and although it was used on one-dimensional signals for quite a while, it wasn’t obvious we can do the exact same process on the image as a signal as long as we use pixels as components. So what is so unusual about this Matlab project online homework help process that initially no one realized it could be applied to image processing? The problem and specifics will be explained on the eigenvalue method, even though we have used SVD as that code was provided in the coursework, and the essential ratio is the same.

Usually, we have more observations than components, which makes sense statistically, and since the covariance matrix has dimension equal to the number of components, it is usually relatively small. For image processing, the number of components is equal to the number of pixels in one image, so it means  that the covariance matrix has way to many elements to process significantly – 1000×1000 pixels image would generate a covariance matrix with 1e12 elements! All the calculations for finding the eigenvalues will ultimately give many zero values, and the process is very inefficient. An interesting trick was proposed to invert the matrix and skip unnecessary calculation.

Matlab assignment help

This procedure changes eigenvectors completely in values and dimensions. Why is this ok? The numerical derivative Matlab components we ultimately need are images by nature, and we want to find principal images so that all the observed images are a linear combination of the principal ones (with a certain error, naturally). If we initially had C components and N observations, instead of O eigenvectors and eigenvalues from an OxO covariance matrix we get Matlab assignment help only N eigenvalues and eigenvectors from an NxN matrix. How do we get the rest? We don’t. It makes no sense to try to efficiently compose 30 images from million components, because we can already perfectly efficiently represent 30 images with 30 images. The other ones won’t be used, and the math will reflect that by returning most eigenvalues to be zero. So, not only is N components enough, but we are doing this in order to reduce that number to much less than N.

This translates to our SVD problem in the same way – in the code we use only a limited number of principal components, and that number should be smaller than the number of images in the dataset. These principal components are extracted standard deviation in Matlab from the spectrogram as images, and they have reduced dimensionality that should be Simulink Matlab help effectively projected on a single line. The next step called principal analysis finds the optimal orientation of the line and the optimal limit value that will separate the datasets with as much accuracy.

Matlab homework help

For this to work, all the previous steps must be efficient – the data set must be represented with sufficient energy in the principal components (represented by the magnitude of chosen principal values), and the datasets must be linearly separable, which means that their means must be sufficiently separated with a reasonable data set variance. One linear Simulink assignment help  classifier is implemented for each pair of classes available for classification, although there are methods that offer implementation of multiple boundaries on a single line.

Algorithm implementation and development

All the codes are implemented in MATLAB and they rely , Matlab project online assignment help heavily on the example codes provided in the coursework notes for the classification of images of cats and dogs. It should be noted that spectrograms were treated as images and were directly used without the wavelet decomposition, as they are already very sparse in nature and do not need further pre-processing.

MATLAB function spectrogram was used with default parameters with the exception of using the window of 4000Hz. This sets the frequency range to 2 KHz, which is quite enough for most sounds and voices.

An additional original code was added for Matlab coder creating data sets from mp3 files available on the internet. All the sound files were deleted after use to avoid potential infringement problems and the spectrograms were used for further processing.

Computational results

The first stage of the project is an attempt to classify three Matlab homework help distinct music authors from three different genres using only 5 principal components:

Matlab assignment solution

Matlab project help

Since the results for the separation of Soundgarden and Michael Jackson were very bad (less than 0.7 for both classes), and the data sets Matlab Support  were sufficiently large (more than 40 samples each), we increased the number of principal components to twenty:

Matlab project homework help In order to investigate the dependence of accuracy of these data sets on the number of principal components, a series of tests was run and the results plotted:

Matlab support Matlab assignment help Regardless of the number of samples set aside for testing, the separation of classes is very easily achieved and all the classifiers on both  do my Matlab homework sides produce errors that are less than 0.15. The testing of all the created classifiers make my Matlab assignment  with 10 samples gives 100% accuracy for the Soundgarden and Michael Jackson, but very bad results for the Beethoven data set – the values are below 0.5. This is because only ten samples were used for training, which is unacceptable. The testing part cannot be efficiently done with a data set of 20 samples.

k=0; %skip indicator
if length(temp)>5*fs(1)

For the second stage we compared the effectiveness of pay for Matlab homework automatic classification on three bands belonging to the same genre – 90’s grunge bands. The problem arose when only 10 songs were available for testing of the band Alice in Chains, while the two other bands (Soundgarden and Pearl Jam) had much larger data sets. Both classifiers that were derived for the separation of this group from the other two bands give very bad results even with such a small number of samples. Even so, this reflects the help with Matlab assignment fact that the Alice in Chains music is difficult to separate from the other two bands. All of the figures are produced with 5 principal components (as limited by the smallest data set):

Matlab homework help online Matlab tutor The results are good but misleading, and in both cases they are help with Matlab homework asymmetrical and moved towards the smaller Alice in Chains data set – the Pearl Jam accuracy was 0.8743, and Soundgarden was 100% accurate. On the other hand, comparing the two Matlab assignments solution larger data sets gave accuracies 0.7250 for Soundgarden and 0.78 for Pearl Jam:

experts in Matlab Since the data sets for genre comparison in phase three are larger than , Matlab problems with answers the ones previously used (they have a minimum of 40 samples each), we can now investigate the effect of choosing a larger number of principal components. The magnitudes of singular values are shown below:

Matlab programming assignment help We can see that there is a clear dominance of just a few principal values, but we can also say that the magnitude of the first 20 components  is somewhat relevant. So, we can choose 20 principal components for the genre comparison. We save 10 values for testing and perform the training:

Matlab programming homework help Matlab assignment solution Matlab project online assignment help Techno and grunge are very well separated with 0.8889 online Matlab tutor and 0.8556 respective accuracies. The other two classifiers are not as symmetrical – between classic and grunge classification, the boundary is set towards classical, so the respective accuracies are 0.6774 and 0.8889. A similar problem arises when trying to separate experts in Matlab  classical music from techno – 0.6129 accuracy for classical music versus 0.8974 for techno music.

if ~exist('spect_data1','var')
if ~exist('spect_data2','var')

The classification problems Matlab homework for money  in this stage are all linked to the classical music data set, as it is very frequently misclassified (random inclusion yields 0.5, so values close to that are considered bad). The testing part of the other two groups yields very good results between 0.8 and 1.



DC Motor Control                 Principal Component Analysis                 Harmonic Fourier Series                 Optical Switching Simulation

Summary and Conclusions

All the results shown here are obtained without, Matlab programming assignment help much experimentation. The data sets are relatively small, chosen without validation at random moments. Spectrogram was done with only one Matlab programming homework help set of default parameters (except the window change to 4000 samples), and that is most likely not optimal for such a detection. All of these parameters and much more could be changed, and the Matlab project help results could be improved with sufficient experimentation. This is beyond the scope of this project.

All the results obtained are Matlab homework help moderate to good. Computation time is quite acceptable, so this sort of offline processing could perhaps be used for real-time applications, provided the training data bases are already acquired, seeing as that part takes up the most time. With development of custom classificators for pairs of music genres and bands, this processing would be very quickly performed.

Classical music data set seems very heterogeneous in Matlab assignment help each classification and is often misclassified. Since these are only pairwise classificators, it is logical to assume that the classification rates would be very low if more than two genres were included. Since Beethoven-only music provided good classification results, it could be Matlab homework help explained by the inclusion of different authors under a classical music label – these authors could be more different than they appear to be.

The number of principal components used has a Matlab assignment help variable effect on the results. When the classes are sufficiently separable, the accuracy is very similar to the original data even with just a few principal components. When the classification is problematic, the accuracy quickly rises with an increase in the number of components.