L ESZCZY SKI W Z ABIEROWSKI A N APIERALSKI ECHNICAL NIVERSITY OF ODZ POLAND KEYWORDS Music Passages C Builder Components BSTRACT Music is an art however computers base on exact s ciences But they have a lot in common by now Musicians have been in ID: 30472 Download Pdf

104K - views


L ESZCZY SKI W Z ABIEROWSKI A N APIERALSKI ECHNICAL NIVERSITY OF ODZ POLAND KEYWORDS Music Passages C Builder Components BSTRACT Music is an art however computers base on exact s ciences But they have a lot in common by now Musicians have been in

Similar presentations

Download Pdf


Download Pdf - The PPT/PDF document "GENERATING MUSIC PASSAGES C BUILDER COMP..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentation on theme: "GENERATING MUSIC PASSAGES C BUILDER COMPONENT M"— Presentation transcript:

Page 1
GENERATING MUSIC PASSAGES C++ BUILDER COMPONENT M. L ESZCZY SKI W. Z ABIEROWSKI A. N APIERALSKI ECHNICAL NIVERSITY OF ODZ , POLAND KEYWORDS: Music Passages, C++ Builder Components BSTRACT : Music is an art – however computers base on exact s ciences. But they have a lot in common by now. Musicians have been interested of making use o f computers posibilities since it has appeared on t he market. The beginning was difficult. Then machines had much less computational power and amount of memmory tha now. Sounds emited by computers didn’t marvel becau se the soundcards quality was

poor. However, fast improvement of science and engineering, has changed this situation for the better. Today, a personal c omputer may serve among other things as a multimedia center , with a very wide range of possibilities for as we ll as proffesional adaptations and unproffesional. Many c omputer’s programs has written, to allow musicians to compose musical production. There are also these, w hich take us fast to the musical effects without kn owledge about music theory. At the Technical University of Lodz, Poland, component for Borland C++ Builder environment, that generates music

passages, has bee n developed. It generates sounds with the aid of MI DI system and allows to save it into MIDI files. What is a music passage, C++ Builder component and MIDI system? This issues will be describe below. MUSIC PASSAGES Music passage is a practice, that is perform by music school students. It can help to become familiar with instrument and to form player’s hearing. If we perform a music passage, it means that we can play on instrument certain sequence of sounds one by one. Pitches of this sounds are determined and depend on many things. The distance in semitones between two notes

is called music interval. Intervals are basics of passages an they are one of most important things in music theory. It has their own names, which correspond to the amount of semitones. Detailed description of intervals within one octave presents table 1. Table 1. Intervals names and values Name Value Name Value perfect unison 0 diminished fifth 6 minor second 1 perfect fifth 7 major second 2 minor sixth 8 minor third 3 major sixth 9 major third 4 minor seventh 10 perfect fourth 5 major seventh 11 perfect octave 12 So we have twelve intervals, which correspond to twelve notes located within

one octave. If we hear two different sounds, we can define relation between them, this is interval. There are six types of passages, which are different in intervals. It i possible to play every one of them in many ways. We can choose the beggining note, witch from we start to play, the amount of octaves, which through passage will be played, speed and the articulation of sounds. However, most important thing is to keep certain distance between them. Table 2 presents names of passages and intervals between separate notes. Table 2. Musical passages types Name Intervals between notes major

passage n1 – major third – n2 – minor third – n3 - perfect fourth – n4 minor passage n1 – minor third – n2 – major third – n3 perfect fourth – n4 first inversion n1 – minor third - n2 – perfect fourth – 3n – major third - n4 second inversion n1 – perfect fourth – n2 – major third – n3 – minor third – n4 diminished passage n1 – minor third – n2 – minor third – n3 diminished fifth – n4 seventh dominant n1 – major third – n2 – minor third – n3 minor third – n4 – major second – n5 In the table above, the pitches of notes where marked as n1, n2, etc. Note n1 is the first sound o passage. The next

sound pitch is distant from the previous one by definite interval. Fig. 1. Major passage for C4 note, two octaves
Page 2
The example of major passage in music for note C4 running through two octaves is presented on Figure 1. In this way, we can construct passages for all notes, running across any amount of octaves, what is limited only by certain instrument scale. Music passages evolves musicians skills, but they are unwillingly practice by students. Some parts o problems can be solved by generating passages component. Its main task is presentation the sound of passage and

familiarization with it. Additional component called Interwal allows to practise hearing for recognize the music intervals. Another adaptation of above-mentioned components can be an application, that gives some possibilities for automatic generation of music. C++ BUILDER COMPONENTS The Borland C++ Builder development environment is a many-sided system, that allows to build many types of applications for Windows system family. It is counts among the RAD types of environments (Rapid Applications Development). Thanks to this, the applications are developing faster and cheaper. Using VCL library

(Visual Component Library) ensure time and money savings. It is a collection of objects (components) designed for developing Windows system applications. Its take over the tasks connected wit h: drawing windows and other standard graphics elements, integration with a operating system. In short, the designer, using this library, can focus his attention on the essence of problem. He does not need to worry about technical details of separate graphic elements of program. PROPERTIES, METHODS & EVENTS VCL component is a common C++ language class, which contains special mechanism responsible for

integration with IDE (Integrated Development Environment). VCL library objects are controlled by properties, methods and events. Properties mechanism is enhanced way to use private field of class. Using of them is similiary as using common variables, but before save or read execution, it is possible to execute some methods. These methods can do various activities, for example they can verify the correctness of ascribed variables. Properties can be published and non- published. We have acces to theese first with the aid of Object Inspector, available in C++ Builder environment (Figure 2). Using

of Object Inspector is the fastest way to edit published component’s properties. Of course an acces to them is also possible from source code level. Component methods. They are common C++ Fig. 2. Object Inspector language methods and do definite activities. However, when we are designing components, we have to remember about few rules. The way a component works must not depends on execution of some method, or on execution of some methods in right order. The method should also check the component state and depend its activity from that state. Events. Events are the third component’s element. An

event is called some piece of code (method) in reply to system event that has appeared. For example mouse click is an event, cursor move, pressing the button and many others. The events and methods of a certain component, ascriptitious to this events, are accessible from Object Inspector’s level. (Figure 2). CUSTOM COMPONENTS The power of the VCL library consists on possibilities of its extension. Existing components can be enriched with new proprieties, adapting them to our project’s needs. Let us consider the following example. We project the series of average complicated applications, in

which every text label (component TLabel) has to be characterized with the Verdana font with the blue color and twelve point size. At the conventional approach, we would have to change default values of the component every time, when we put it on the form. The ideal solution that appears here, is the possibility of extending of the component TLabel and create its own version. A component like this, we place on the component palette in the C++ Builder environment, and we use it in the same way as from other objects. If we need the component realizing non-standard acts, then we must create the

component „from the zero”. The component that generate music passages is an element just like thi s.
Page 3
The GenPasazy component contains the set of the properties and methods necessary to generate sounds in the definite arrangement . These properties are: Dzwiek (Note) – keeps the pitch of the first sound of the passage, Artykulacja (Articulation) – it qualifies the manner of extract ing of sounds (legato, the staccato etc.), IloscOktaw (Number of octaves), Instrument (Instrument) – the instrument playing the passage, Tempo (Tempo) the tempo of the passage, Rodzaj (Type) – the

kind of the passage (major, minor etc.), Nuta (Note) the length of single note (quarter note, eight note etc.). These proprieties are published, so the acce ss to them assures the Object Inspector. The most important methods accessible for the user of the component are: ustawMidi() (Set Midi) – accepting as the argument the handle to the MIDI device, graj_pasaz() (Play passage)– the method playing the passage on the ground properties set earlier, zapiszDoPliku() (Save to file) and wczytajZPliku() (Read from file) – methods writing/reading generated passage to/from the file with the own format,

zapiszDoMidi() (save to Midi file) and WczytajZMidi() (read from Midi file) – methods writing/reading generated passage to/from the standard MIDI file. The MIDI system will be described in the further part of the article. Algorithm. The component generating the chosen passage, must know all sounds pitches containing in the suitable passage. In the memory of the component, there are defined all earlier described intervals. After the qualification of the kind of t he passage and quantities of octaves, the component by the internal method, fills the vector with suita ble intervals in the form of

numbers (quantities of hal f- tones). Then the method graj_pasaz() takes advantage of this vector, and set up the pitches of following sounds in the passage. From the same function profits the method, that saves the passage to MIDI files. MIDI SYSTEM The component, which is here under discussion in this article, is an object exacting of the sound system, that allows to generate sounds with the definite height. Such a system is MIDI (Musical Instrument Digital Interface). It’s rudiments reach the year 1982, and in the year 1991, thanks to the Roland company, came into being the General MIDI

standard. It's main use is the possibility of the joining of the greater amount of instruments into one system, and steering it by one device. The connection between music instrument and the computer, where the suitable software is installed, offers to us the greatest possibilities. Then, we h ave to disposition a wide range of sounds and channels, which we can use in the creation of our piece of music. The General MIDI standard offers 128 sounds numbered from 0 to 127 and partite to 16 thematic groups, 24-vocal polyphony and at least 47 percussive sounds. The joining of MIDI devices.

Instruments and devices compatible with MIDI standard, are join by at least two nests: MIDI IN and MIDI OUT. MIDI THRU is an optional nest. We use to this five vein cables finished with DIN-5 connectors. The most simple connection is the connection of nests MIDI IN and MIDI OUT of two instruments. The instrument, where the signal comes in, reacts to the pressing of every key on the instrument, where the signal comes out. If we want to connect the instrument with the computer, we must use the MIDI interface. Formerly, there was used and popular an interface, that was connected to the joystick

nest of the computer soundcard. Nowadays, the USB interface is used accordingly. MIDI messages. The MIDI system is not an audio system! Devices compatible with it, do not send an analogous signals between themselves, like for example a situation where the guitar is connected with the amplifier. The information are sent as the digital form messages. The same messages are saved in MIDI files during archiving. There exists several kinds of messages liable for a different operations. These messages are split to the canal messages and system messages. Canal messages relates to MIDI channels, there

is sixteen of it. W can place a different part of the instrument on eve ry channel, only ten'th channel is reserved for percussive sounds. The most often used group are vocal messages, responsible among other things for sound of notes, the suppression of them, change the sound of the instrument etc. MIDI sequencers. These are computer programs co-operative with music instruments compatible with the MIDI standard. These programs allow to intercepting, the edition and the recording the dat sent by the instrument. The work with such a program can look as follows. On the music instrument connected

to the computer, we play a tune, that is sent to the computer and intercepting by the sequencer program. Then we edit it on a monitor’s screen, and record. Such operations we can repeat several times, recording following paths of the composition. The finished composition we can reproduce on the MIDI instrument. To record it into the computer's permanent memmory, we use the writing to the MIDI file. MIDI file otherwise SMF (Standard MIDI File) is a disc file of unific format, that keeps earlier mentioned MIDI messages. Such a file we can reproduce on every device compatible with the standard.

Hovewer, we ought to make allowance for this, that peaceable with MIDI instruments
Page 4
being descended from different producers have a set of sounds, which are little different from each other. Because of this, the same tune, can sound different on two other devices. The MIDI file (*.mid extension), similarly as files of other standards, contains some division to the headings - in where are contracted informations of data that occurre further - and sections of data containing MIDI messages. At the beginning of the file we find the file header about the 14B size and after i appear

MIDI messages divided to paths. These are two main blocks: Header Chunk and Track Chunk. EXEMPLARY APPLICATION To the purpose of demonstrating working of the component, there has been made the sample application. It looks like on the Figure 3. Fig. 3 Exemplary application It makes possible the arrangement of all proprietie of the component described earlier. It makes it by the combo boxes and edition fields - standard elements of the Windows operating system. The Play button generates programmed passage. The menu is also accessible, whereby we can write/read our sequence of sounds to/from the

file of the own component format as well as the MIDI file. The program - for the purpose of reproducings of sounds - demands only presences in the system one MIDI device at least. If such a device will not be found, the application during an actuation, will inform us about it by showing the suitable announcement. The program will start without the possibility of reproducing of passages. However, the possibilities to writing and the reading from files will be accessible. SUMMARY The described component can serve as the element to the build of music applications nascent in the Borland C++

Builder environment. These applications can have the educational character or be the substitute of the system that automatically generates the music on the ground suitable settings The examplary application can apply to the help for music school's students, perfecting their skills of the playing on the music instrument, and the additional component Interwaly can help with the exercise of the hearing. THE AUTHORS Marcin Leszczy ski, Msc. Wojciech Zabierowski Prof. Andrzej Napieralski Department of Microelectronics and Computer Science Technical Univeristy of Lodz Al. Politechniki 11 90-924

Łd e-mail: REFERENCES [1] Jarrod Hollingworth, Bob Swart, Mark Cashman, Paul Gustavson „Borland C++ Builder 6 Developers Guide”, [2] MIDI Manufacturers Association – MIDI 1.0 Specification, SMF (Standard MIDI File) specification, [3] Franciszek Wesołowski „Zasady muzyki (Principles of Music) PWM 2004