Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Wednesday, November 24, 2010

Create Your Own Music Using ChordATune

ChordATune is a music making software where users can create their own creative music and mabe use them to create birthday cards, home made videos, play it using your guitar .. and many more. ChordATune also allows you to harmonize a known song and find their accompaniments.
In this section I will give you a step by step guide on how you can create music using ChordATune .

1. Creating a song.

There are several ways to create melodies in ChordATune.
  1. Using an existing midi file (if you have an already exsisting melody and don't know how to get the base chords) ..
  2. Using a manuscript Editor - ChordATune provides a well known tools to create manuscript notations (if you know your music theory)
  3. Using a virtual Piano.
I will explain how you can create your own melodies using the virtual piano provided by ChordATune

In the main frame of ChordATune, under creation mode select piano from the drop down list and click on create a song.

Then you will get a virtual piano as shown below ..


Here you can click on the key board and create your melody once you create the melody you can click on play to listen to your creation. If you don't like the sound of it you can click on edit and delete the unnecessary notes. If you don't like the entire melody you can click on clear and start over. To view your melody in a manuscript notation click on view. Once you are done click on save to save your creation. :)



2. Generating the harmony

Now that you have a melody you need to generate the harmony (base chords) to accompany you melody. In order to harmonize you need to follow the following steps
  1. Select the time signature (in simple terms its the beat of your melody)
  2. Input the midi file (the melody you just created) - you can listen to the melody once u input the melody
  3. Giving the emotional factor (harmony depends on user emotions therefore its important to specify what kind of song you want ie a happy song, sad song ect (if you don't like a particular harmony generated by ChordATune you can always change the emotional factor and get a complete different harmony.
  4. Generate Harmony

3 . Display Harmony

Once you generate the harmony there are several options to display the harmony.

  1. Selecting the genre - You can select the genre(style) of your choice while displaying the harmony. There are several styles allowed in ChordATune. (ie Rhumba, Swing, Disco, Rock, March)
  2. Selecting the drum beat - According to the genre users can select different drum beats)
  3. Changing the tempo - if you want to change your tempo of your song you can change the tempo using this functionality
  4. Display the harmony


Now you know how to create a simple song using ChordATune. It is advice to give different variations and experiment with your creation by choosing different emotional factors/ changing the genre/drum beat and tempo to get the best result of your choice. This way you can add your own creativity to your song.


ChordATune also allows you to generate the guitar tabs (fingering positions of guitar chords) for you melody for the guitar players :) by selecting the display style as guitar.



ChordATune also allows you to print your music as sheet music by clicking display printable version.


Now you can go to your piano/guiatar and play your music !!!

Tuesday, August 3, 2010

How to create a MYSQL data service using WSO2 data services Server

In this post I am going to explain how to create a simple data service to expose data as a service using WSO2 Data service Server..

Before we begin since I am going to create a data service for MYSQL data store you need to install and have mysql server(this can be any database server) .

Lets create a database call MyDSDB and create a table call Person.

Create database MyDSDB;
use MyDSDB;
CREATE TABLE Persons
(
P_Id int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)

show tables;

Now that we created a database and a table lets see how we can create a data service to insert and retrieve data from this table.


If you are using wso2 products for the first time ...
You need to download wso2 dataservices server.
Start up the server -> go to DS_HOME/bin/wso2server.bat | wso2server.sh (DS_HOME is where your set up is located)
Once the server is up and running open a web browser and navigate to https://localhost:9443/carbon.
Login it the server using the default credentials (username=admin, password=admin).

Also note that you need to provide the related jdbc driver for the database and put in repository/component/lib in order for this feature to work.

Step 1- Create a Data source.

Go to left hand side menu and click on Webservice -> Add -> Data Service -> Create and give a suitable service name for your data service.

Data Service Name* - MyFirstDSS



Click on Next to create the Datasource. 
Inorder to create the data service you need to specify your database information. That is done under create Data source. WSO2 data services support many types of data sources such as RDBMS,Excel,CSV,RDF etc. Here we are creating a data service for RDBMS->MYSQL therefore, lets select RDBMS as the Data Source Type and MYSQL as Database Engine.

DataSource Id - MyDS
Data Source Type - RDBMS
Database Engine - MYSQL 
Driver Class - com.mysql.jdbc.Driver
JDBC URL - jdbc:mysql://localhost:3306/MyDSDB
User Name - root
Password - password


Click test connection to test your connection.

Step 2 - Create Query.

In data services creating query doesnt mean just giving the SQL query needed for the data service. It also means defining the input parameters, and response (output parameters) and how we should get the results of our data service.

Lets first create a query to insertPersons.  In insert Person query you only give set of input parameters to input the data into the table.      
Click on Add new Query to create a new Query.

Query ID - InsertPersonQ
Data Source - MyDS
SQL - INSERT INTO Persons (P_Id, LastName, FirstName, Address,City) VALUES(?,?,?,?,?)

Click on Add input mappings to add input parameters to the query. Here we have to map each input parameter to the Mapping name along with their data type as shown below. When you are going to give input parameters you can also validate the input by adding a validator to your input such as (long,double,date and also custom validators). Please refer Adding Custom validators in oder to see how you can add custom validators.


Once you add the input parameters go to main configurations and your query will look like shown below. 

Click on save to save thequery. Now we have written a query to insert data.
Lets see how we can create a query to retrieve data.

 Add new Query -> 
Query ID - SelectPersonsQ
Data Source - MyDS
SQL - Select  P_Id, LastName, FirstName, Address,City From Persons 

Since we are getting a results (Select Query returns set of rows from our table) we need to define the result set in the data service. There are two options to add result set to your Query. You can manually go and click on add New Output Mappings and add the results (before you add you need to give the RowName and Grouped by elements ). Or you can simply create Generate response link data service server will auto generate your response for you.



Once you create the query add save and go to operation section.

Step 3 - Creating Operations

Creation operations is easy, once you create a query you need to create an operation mapping to the Queries you just created.
Click on add new operations, and it will display an operation wizard. Give an operation Name and map that operation to the queries you created.



Operation Name - GetPeople
Query ID - SelectPersonsQ


Operation Name - InsertPerson
Query ID - InsertPersonQ


Once you have added the two queries click on finish to save the data service. It will deploy the created data service as an axis2 service. If you go to Web services list you can see your newly created data service as shown below.


If you click on the data service you can see list of Quality of service operations given for that data service. You can add throttling security and catching for that data service. And also you can view the dbs (XML) of the created service by clicking on Data Service XML Editor.



<data name="MyFirstDSS">


  <config id="MyDS">
     <property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property>
     <property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/MyDSDB</property>
     <property name="org.wso2.ws.dataservice.user">root</property>
     <property name="org.wso2.ws.dataservice.password">root</property>
  </config>
  <query id="InsertPersonQ" useConfig="MyDS">
     <sql>INSERT INTO Persons(P_Id, LastName, FirstName, Address,City) VALUES(?,?,?,?,?)</sql>
     <param name="P_Id" sqlType="STRING" ordinal="1" />
     <param name="LastName" sqlType="STRING" ordinal="2" />
     <param name="FirstName" sqlType="STRING" ordinal="3" />
     <param name="Address" sqlType="STRING" ordinal="4" />
     <param name="City" sqlType="STRING" ordinal="5" />
  </query>
  <query id="SelectPersonsQ" useConfig="MyDS">
     <sql>Select  P_Id, LastName, FirstName, Address,City From Persons</sql>
     <result element="Keys" rowName="Key">
        <element name="P_Id" column="P_Id" />
        <element name="LastName" column="LastName" />
        <element name="FirstName" column="FirstName" />
        <element name="Address" column="Address" />
        <element name="City" column="City" />
     </result>
  </query>
  <operation name="GetPeople">
     <call-query href="SelectPersonsQ" />
  </operation>
  <operation name="InsertPerson">
     <call-query href="InsertPersonQ">
        <with-param name="P_Id" query-param="P_Id" />
        <with-param name="LastName" query-param="LastName" />
        <with-param name="FirstName" query-param="FirstName" />
        <with-param name="Address" query-param="Address" />
        <with-param name="City" query-param="City" />
     </call-query>
  </operation>
</data>


You can invoke your service by the try-it feature by clicking on the try it link in the service dashboard.






Monday, July 26, 2010

Music Technology & ChordATune

The aim of the ChordATune system is to give a clear understanding of harmonization to novice pianists, and to create accompaniments that are musically correct. Since there can be more than one accompaniment for a given melody, ChordATune allows variations of accompaniments according to the emotional factor of the composer and the genre of music.


ChordATune has the functionality of creating new melodies using a manuscript notation or using a virtual piano, and also to browse melodies in MIDI format to be inserted into the system as input. The ability to set the emotional factor to any level of happiness or sadness lets the user generate different types of harmonies to the same melody based on different emotions ranging from happy to sad. Furthermore users can change the harmony by changing the genre, drum beat and its tempo. Once the harmony is generated it can be displayed in different genres and styles according to the manuscript notation. Furthermore, ChordATune possesses the capability to provide guitar chords in fret sheets for a given melody; this helps novice guitarists to learn chords and fingerings for new melodies. Once the accompaniments are generated they can be played as audio files. The generated accompaniments can be saved as MIDI files or manuscript notation.

ChordATune better explained according to Kolb’s (Ref) experiential learning theory model.

ChordATune, An e-learning tool for kids (and their grown-ups) ....

ChordATune is a cool interesting tool introduced to ease the task of harmonization for novice piano players and song writers. However, it further provides functionalities to learn western music theories and concepts and also gives users a chance to experiment music.


Kolb’s (Ref) experiential learning theory model that is based on a four-stage learning cycle as: Concrete Experience (CE), Reflective Observation (RO), Abstract Conceptualization (AC) and Active Experimentation (AE), and the four type definition of learning styles: Diverging (CE/RO), Assimilating (AC/RO), Converging (AC/AE) and Accommodating (CE/AE) have been considered when developing the learning tool ChordATune. Further, cognitive constructivism emphasizes two key principles for teaching and learning: namely that learning is an interactive process, and that learning should be whole, authentic and real was taken into consideration to facilitate the best solution for learners. One of the main aims of this project is to make learning harmonization an interactive process where the learner is presented with the tool to experience varieties of harmonization for the same melody through changing the emotional factor, key and time signature. The direct experience of changing the harmonization and the ability to check out a variety of solutions allows better learning; it is made interactive and entertaining rather than an isolated learning activity.

These theories also assists educators to understand that meaning is constructed as learners interact in meaningful ways with the world around them. In concatenating this factor with the ChordATune proposed solution, the isolated skill and drill process through exercises are converted to a learner interactive process where the learner is engaged in meaningful activities in setting required parameters for the harmonization process. It also allows the learner to be authentic in the activity that makes the process interesting and meaningful, making the end result learner centered and encouraging.


One of the main goals of this research is to involve the user with the emotional factor when creating harmony, thereby letting the user experiment with different styles and varieties of chord progression when displaying the harmonized melody. This helps novice pianists to develop their creativity in song writing and music creation.

Learning FunctionalitiesCEAEACRO
Creating Songs
Virtual Piano XXX
Manuscript Editor XX
Generating Harmony
Major/Minor Clustering
(Effect of emotions)
XX
Effect of genre XX
Effect of tempoXX
Effect of drum beatsXX
Use of manuscript notationXX
Use of guitar tabular formatXX

Another goal of this project is for music learners to understand the notational format of music writing. ChordATune provides a virtual piano enabling the users to create their melodies using a piano, and it provides the manuscript notation for that newly created melody. Furthermore, ChordATune demonstrates how chord progressions are arranged and how it can be displayed in guitar tabular format enabling music learners to concentrate on music theoretically as well as practically.


Saturday, June 12, 2010

Why Harmonization ? - Importance of harmonizing a melody


One of the biggest problem in song writing or piano playing (o creating your own music) is the problem of harmonization. In this blog I discuss why harmonization is crucial (getting the right chords to the right notes) and how we can overcome this problem using and interactive tool called ChordATune.

Power of harmonization
Play Melody
Play Harmonized Melody


Music is made out of melody and harmony. Melody is the basic tune of a song (which we can easily hum o we can just guess the notes using a keyboard). Harmony on the other hand is the accompaniments to a melody (base chords, drumbeats ect) which makes your song complete. Harmonization is a crucial part in song writing o piano playing because only by harmonization you can make your melody rich and power and also add emotions and color to your song. However, many people face the problem of harmonizing because you need extensive knowledge in music, years of training and practice and also some musicality in you to harmonize a song accurately.

This is where the ChordATune comes in handy... ChordATune is a powerful harmonization tool. Not only just harmonization, you can also create your own melodies the way you want (using a virtual piano or manuscript editor) and make it complete by harmonization. ChordATune let user have variety of harmonies according users emotions and styles and also provide drum beats to make your song have a rocking beat!!.ChordATune output the harmonize melody in manuscript and midi formats. ChordATune also provides a feature of guitar players where they can get guitar chords in guitar tabular format for an any given tune.

Now you can create your own music the way you want and also ChordATune provides a mechanism to save your creations in MIDI format so that you can use ur music for many other activities in your digital life.

Thursday, May 20, 2010

ChordATune - A Solution for Song writing and piano music harmonization

I decided to use this blog for technical purposes (not too geeky but interesting work in the computer field) I am starting with my favorite!! one of my own creations "ChordATune"..
ChordATune is an emotion based melody/tune harmonizer focusing on piano music. One of the biggest problem in song writing or piano playing is the problem of harmonization. Most people know how to write beautiful songs o play creative tunes but they find its hard to accompany their tune with the adequate chords. This problem is addressed by ChordATune which gives you the chance to accompany your melody with chords according to your emotions, styles drum beats and tempo.

ChordATune features

  • Create your own melodies using a virtual piano/ a manuscript editor.
  • Generate harmony according to emotions interactively (If you don't like the harmony u can always change the emotional factor o the genre and get a complete different set of chords).
  • Add Drum beats to your melody
  • Arrange harmony according to the genre (user preferred style ie Disco, Rhumba, Swing, March, Rock).
  • Change the tempo.
  • Display guitar tabular format (guitar chords ) for a tune.
  • Generate manuscript notation to your harmony/melody
  • Save MIDI files/Manuscript files in PDF format
  • Play Stop Print functionality
Check out ChordATune in action

http://www.youtube.com/watch?v=I3ZeizWDnOc

In case if you are interested in the technical background ...

ChordATune uses machine learning technology to generate the most suitable chords for a given melody... it can be called as an interactive AI system where the AI properties are created dynamically at run time according to the user input. This uses Hidden Markov Model which is a statistical mathematical model to generate the chord progression. Further, ChordATune is based of Music Technology, MIDI processing, Dynamic Programming, Multi Processing and Automatic Music Composition. Around 300 lead sheets are used to train ChordATune using heuristic and data driven approaches.

Sunday, April 18, 2010

Introduction to Computer Music Harmonization



Automatic harmonization history 

Among musical compositional systems there has been a large number of researchs carried out in the field of automatic harmonization from the early 1950s onwards. When looking at automatic harmonization history the most pioneering work in automatic harmonization is that of Rothgeb who developed a SNOBOL, program to solve the harmonization problem and to identify the voice leadings notes to accompany it. Rothgeb used rule base approach that has a set of ‘if statements’ according ot the musical domain. His main aim was not focusing on automatic harmonzation but to test the computational soundness of two bass harmonization theories from the eighteenth century (Rothgeb, 1969). Afterwards Steals in 1979 proposed a system to use constraints to create passing chords as chords that could be inserted between two given chords. These passing chords must satisfy some musical constraints, such as interval relations between the roots of the first, passing, and last chords. Further, Steals used essentially a frame system, augmented with a bread-first search (Steals, 1979).
The above evidence suggests that the first works for automatic harmonization were carried by using rule base approaches by representing set of musical rules. Furthermore, this indicates that no constraint satisfaction algorithm was used and the main concern was about mastering the combinatorial explosion, by putting more knowledge in the solver.

Automatic Harmonization – AI Techniques

There have been several approaches taken for automatic harmonization in artificial neural networks (ANN). There has been a large number of research carried out in the field of music composition using neural networks available in the literature; Todd (1989, 1991) used a feed-forward ANN with feedback for melody generation, Lewis (1991), Hild et al. (1992) used a neural network to harmonize chorales that divides harmonization in to three parts 1) harmonic skeleton 2) chord skeleton and 3) ornamentation, Mozer (1991, 1994) generated melody using ANN, Stevens and Wiles (1993), Bellgard and Tsang (1994) constructed a Boltzmann machine for harmonization which generates harmonies non-deterministically. Further, Toviainen (1995) trained neural networks for jazz improvisation and later Hörnel and Degenhardt (1997) generated harmonization for four part chorals in baroque style.
The most of the automatic harmonization used neural networks are for four part choral harmonization. Automatic harmonization using neural networks, Schwanauer the developer of MUSE that harmonize chorals, claims that there are five learning techniques learning by rote, learning from failure, learning from examples, learning by analogy and learning from discovery (Schwanauer,1993).
Even though neural network approaches are widely used among musical composition systems Papadopoulos and Wiggins discusses that there are many disadvantages in neural network approach for musical compositions, in his analysis he claims that “The representation of time cannot be dealt efficiently even with ANNs that have feedback” (Papadopoulos & Wiggins, 2007). Further, he states that neural networks cannot reproduce fully trained data set. Even if they are fully trained it is not generalized (Papadopoulos & Wiggins, 2007). Toviainen (1999) claims that neural networks fail to pick up the higher-level features of music such as phrasing or tonal functions. Further, he explains that a neural network often solves toy problems, with many simplifications when compared to knowledge based approaches (Toiviainen, 1999). However, the review reveals that the neural network approaches used for musical compositions suggests that neural networks were used extensively in the past years for musical applications and they have been relatively successful especially in domains such as perception and cognition.

Automatic harmonization – Knowledge Based Systems  

The most pioneer technique used for music composition is using knowledge base concepts. Unlike neural network that learns from examples, knowledge based systems work according to the rules. There can be three types of knowledge based systems 1) rule based expert systems, Constraint logic programming and case based reasoning. There has been several approaches on automatic harmonization using rule based approach. Ebcioglu implemented a choral harmonizing system which is a rule based expert system using Backtracking Specification Language (Ebcioglu, 1988). Tsang and Aitken (1991) and Pachet and Roy (1998) used constraint logic programming (CLP) and constraint satisfaction techniques (CSP) respectively for four part choral harmonization. However, Sabater et al also developed four part automatic harmonization for vocals using rules and cased based reasoning but his approach failed due to constructing the harmonization purely on rules. Reason for his failure was because rules don’t make music but music makes rules. The advantage of using a knowledge based approach is because each newly correctly harmonized piece can be memorized and made available as a new example to harmonize other melodies which are also known as learning by experience process (Mantaras & Arcos, 2002). When analyzing the above existing work the main advantages of rule based systems are, their ability to be stand-alone programs, and their ability to explain their choice of action; furthermore, knowledge based systems can introduce explicit structures or rules. Even though knowledge based systems can be a good candidate for musical composition Papadopoulos and Wiggins claims that following disadvantages can be seen in knowledge based systems. 1) Knowledge elicitation is difficult and time consuming, 2) gaps between expert and programmer because representation is not flexible and also knowledge based systems can be too complicated with more exceptions to the rules.

Automatic harmonization – Mathematical Model
 

Mathematical model also known as Stochastic processes is a machine learning technique which is widely used in many applications and research fields such as; data mining, speech recondition, hand writing recondition and computer vision. One of the most popular mathematical models is Hidden Markov Model; it has been used successfully in genre classification, instrument identification and key estimation in the field of music systems (Levitt, 1993). There are few approaches taken for automatic harmonization using Hidden Markov Model. Allan and William designed a harmonization model for Bach chorales using Hidden Markov Models. In this model, the visible states represent melody notes and the hidden states are chords. This model has to be provided sequences of chords as input, restricting its applicability in more general settings (Allan & Williams, 2005). Hanlon and Ledlie have developed CPU Bach an automatic choral harmonization system which harmonizes melody lines for the style of composer Bach. This system breaks the harmonization process in to two parts 1) generation of a harmonic progression and 2) realization of harmonic progression into four part melody lines. Hanlon and Ledlie use HMM to model the chord progression and derive the realization of vocal lines using constraint satisfaction method. That has been successful for a large number of melodies (Hanlon & Ledlie, 2002). Papadopoulos and Wiggins claims the main draw back of this models are one must needs to find the probablities by analyzing many data therefore, lot of data is needed and also it is difficult to capture higher or more abstract levels of music (Papadopoulos & Wiggins, 2007). However, HMM has been sucessfully used in many applications as disscussed above. Furthermore, HMM is more robust and flexible compared to other models, and also its complexity is low.


Automatic harmonization – Genetic Algorithms

There have been several researches done in automatic composition using Genetic Algorithms (GA). Horner and Ayres have successfully developed a system that generates four-part harmony using genetic algorithms. However, the chords needed to be given and the system produces the four melody lines according to the chords (Horner, 1995). Phon-Amnuaisuk and Wiggins created another harmonizing system using GA in their system, soprano information is input by the users and the GA generates the other three voices with musical domain knowledge encoded in the fitness function. The limitations of using GA are that these systems are subjective and there is no way to simulate human behavior; furthermore, the user must hear all the potential solutions in order to evaluate a population. However, Biles claims that GA has efficient search method which is good for large scale searches and it has the ability to provide multiple solutions. (Bills, 2007).
Musical composition has been the focus of computer science since the 50s, and there exists several ways of representing music using computers. There have been several AI applications for automatic music compositions from early ages. When looking at AI applications, they can be categorized according to their most prominent features; namely, 1) Neural Networks (systems which learn), 2) Knowledge Based systems, 3) Evolutionary methods, and 4) Mathematical Models. Each of these models has their own pros and cons which were discussed in the above sections.