Compositional Technology

Download Report

Transcript Compositional Technology

COMPOSITIONAL
TECHNOLOGY
WEEK 5
NETWORKS AND ALGORITHMS
NETWORK CONTROL VIA OSC
Open Sound Control (OSC) is a protocol for communication among computers, sound synthesizers, and other
multimedia devices that is optimized for modern networking technology. Bringing the benefits of modern
networking technology to the world of electronic musical instruments, OSC's advantages include interoperability,
accuracy, flexibility, and enhanced organization and documentation.
This simple yet powerful protocol provides everything needed for real-time control of sound and other media
processing while remaining flexible and easy to implement. Features include:
• Open-ended, dynamic, URL-style symbolic naming scheme
• Symbolic and high-resolution numeric argument data
• Pattern matching language to specify multiple recipients of a single message
• High resolution time tags
• "Bundles" of messages whose effects must occur simultaneously
• Query system to dynamically find out the capabilities of an OSC server and get documentation
There are dozens of implementations of OSC, including real-time sound and media processing
environments, web interactivity tools, software synthesizers, a large variety programming languages, and
hardware devices for sensor measurement. OSC has achieved wide use in fields including computer-based
new interfaces for musical expression, wide-area and local-area networked distributed music systems,
inter-process communication, and even within a single application. Uses include:
• Sensor/Gesture-Based Electronic Musical Instruments
• Mapping non-musical data to sound
• Multiple-User Shared Musical Control
• Web interfaces
• Networked LAN Musical Performance
• WAN performance and Telepresence
• Virtual Reality
An example of ‘raw’ OSC code
This example opens a connection, which listens for messages on port 7770, Sent from port 7779. Then
use midi to play middle C at mezzo forte.
send ("osc:open", 7779, 7770)
send( "osc:message", :m, {128 60 127 64})
Practical uses with Max/MSP/Jitter
OSC can be used to transmit information to and from Max in a variety of ways. As shown by the list of
applications above the possible uses are almost endless, however on a practical level OSC can be
thought of in a manner similar to a massively improved MIDI protocol facilitating communication
between vast numbers of digital devices. So… use your imagination!
A PRACTICAL DEMONSTRATION
In the following example an iPhone is used to control the inputs to max. This is purely because it was the
technology available (i.e. the phone which I happen to own), many other interfaces are available ranging
from wii controllers to weather stations.
• Interfacing
• There are many ways to link between iOS and Max. Some of the easiest solutions are simple ‘client –
server’ programs which deal with most of the under the bonnet issues for you such as TouchOSC, MRMR
or Cycling 74’s own interface c74. The majority of these systems rely upon a wifi link and dynamic I/P
address, which in many cases is the most complex part of the user end of the system!
• The example below was implemented via TouchOSC
• Firstly upload the app to the phone. This is available for iOS and Android at
http://hexler.net/software/touchosc Then make the links between Mac and phone.
• Turn on wifi and select "create network" name it something recognisable e.g. "ed" go to advanced and
note the IP in Network Preferences.
• On the iPhone go to wifi Settings and join that network. Go to settings in TouchOSC and manually type
in the IP e.g. 169.xxx.x.x
• From this point the iPhone should send OSC data to MAX via wifi. Now we need to set it up in Max...
• This is the ‘basic’ max patch built for TouchOSC it uses udprecieve and udpsend combined with
arguments based on the port and (wifi assigned) I/P address of the phone to send and receive data.
There are a number of preset interfaces as well as an editor for the purposes of this lecture I have used
one of the most simple and made a copy of it in max. Below is a screen shot of the on screen mac user
interface showing a real-time visualisation of the phone state.
Max patch in presentation mode
ALGORITHMIC COMPOSITION
• Algorithms (or, at the very least, formal sets of rules) have been used to compose music for centuries;
the procedures used to plot voice-leading in Western counterpoint, for example, can often be reduced
to algorithmic determinacy. The term is usually reserved, however, for the use of formal procedures to
make music without human intervention, either through the introduction of chance procedures or the
use of computers.
• Many algorithms that have no immediate musical relevance are used by composers as creative
inspiration for their music. Algorithms such as fractals, L-systems, statistical models, and even arbitrary
data (e.g. census figures, GIS coordinates, or magnetic field measurements) are fair game for musical
interpretation especially in the field of sonification. The success or failure of these procedures as
sources of "good" music largely depends on the mapping system employed by the composer to
translate the non-musical information into a musical data stream.
• There is no universal method to sort different compositional algorithms into categories. One way to do
this is to look at the way an algorithm takes part in the compositional process. The results of the process
can then be divided into 1) music composed by computer and 2) music composed with the aid of
computer. Music may be considered composed by computer when the algorithm is able to make
choices of its own during the creation process.
• Another way to sort compositional algorithms is to examine the results of their compositional
processes. Algorithms can either 1) provide notational information (sheet music) for other instruments
or 2) provide an independent way of sound synthesis (playing the composition by itself). There are also
algorithms creating both notational data and sound synthesis.
• However, one of the most common way to categorise compositional algorithms is by their structure and
the way of processing musical data. One of the most detailed divisions consists of six partly overlapping
models:
MATHEMATICAL MODELS
• Mathematical models are based on mathematical equations and random events. The most common way to
create compositions through mathematics is stochastic processes. In stochastic models a piece of music is
composed as a result of non-deterministic methods. The compositional process is only partially controlled by
the composer by weighting the possibilities of random events. Prominent examples of stochastic algorithms
are Markov chains and various uses of Gaussian distributions. Stochastic algorithms are often used together
with other algorithms in various decision-making processes.
• Music has also been composed through natural phenomena. These chaotic models create compositions from
the harmonic and in-harmonic phenomena of nature. For example, since the 1970s fractals have been studied
also as models for algorithmic composition.
• As an example of deterministic compositions through mathematical models, the On-Line Encyclopaedia of
Integer Sequences provides an option to play an integer sequence as music. (It is initially set to convert each
integer to a note on an 88-key musical keyboard by computing the integer modulo 88, at a steady rhythm.
Thus A000027, the natural numbers, equals a chromatic scale.)
KNOWLEDGE-BASED SYSTEMS
• One way to create compositions is to isolate the aesthetic code of a certain musical genre and use this
code to create new similar compositions. Knowledge-based systems are based on a pre-made set of
arguments that can be used to compose new works of the same style or genre. Usually this is
accomplished by a set of tests or rules requiring fulfilment for the composition to be complete.
GRAMMARS
• Music can also be examined as a language with a distinctive grammar set. Compositions are created by
first constructing a musical grammar, which is then used to create comprehensible musical pieces.
Grammars often include rules for macro-level composing, for instance harmonies and rhythm, rather
than single notes.
EVOLUTIONARY METHODS
• Evolutionary methods of composing music are based on genetic algorithms. The composition is being
built by the means of evolutionary process. Through mutation and natural selection, different solutions
evolve towards a suitable musical piece. Iterative action of the algorithm cuts out bad solutions and
creates new ones from those surviving the process. The results of the process are supervised by the
critic, a vital part of the algorithm controlling the quality of created compositions.
SYSTEMS WHICH LEARN
• Learning systems are programs that have no given knowledge of the genre of music they are working
with. Instead, they collect the learning material by themselves from the example material supplied by
the user or programmer. The material is then processed into a piece of music similar to the example
material. This method of algorithmic composition is strongly linked to algorithmic modelling of style,
machine improvisation, and such studies as cognitive science and the study of neural networks.
HYBRID SYSTEMS
• Programs based on a single algorithmic model rarely succeed in creating aesthetically satisfying results.
For that reason algorithms of different type are often used together to combine the strengths and
diminish the weaknesses of these algorithms. Creating hybrid systems for music composition has
opened up the field of algorithmic composition and created also many brand new ways to construct
compositions algorithmically. The only major problem with hybrid systems is their growing complexity
and the need of resources to combine and test these algorithms.
AN EXAMPLE USING A FIRST ORDER MARKOV CHAIN
•
For simplicity the notes of ‘Happy Birthday’ as a musical example:
C4 C4 D4 C4 F4 E4
C4 C4 D4 C4 G4 F4
C4 C4 C5 A4 F4 E4 D4
Bb4 Bb4 A4 F4 G4 F4
•
A zero order Markov Chain considers only the probability of each note occurring. If we
were to use Happy Birthday as source material for our algorithmic composition we
can see that the notes occur with the following distributions:
C4 8 times – 32%
D4 3 times – 12%
E4 2 times – 8%
F4 5 times – 20%
G4 2 times – 8%
A4 2 times – 8%
Bb4 2 times – 8%
C5 1 time – 4%
• A first order Markov Chain analysis and generation patch. Here the next note is based on the current
note and a list of probabilities for following notes. This is stored in a State Transition Matrix (STM),
here’s an STM that lists the notes in our Happy Birthday example and the probabilities of subsequent
notes:
C4
D4
C4
0.375
0.25
D4
0.66
E4
0.5
F4
0.25
E4
F4
G4
0.125
0.125
A4
Bb4
C5
0.125
0.33
0.5
0.5
0.25
G4
1
A4
1
Bb4
0.5
C5
1.0
0.5
The patch is implemented over. At present it is only operating in the pitch domain, although other
parameters such as duration and velocity could of course be stored and used.
• The following patch reads through a midi file and then creates a ‘new’ melody based on the probabilities of
the proceeding pitches.
• Have a go at building the algorithmic patch (you’ll need the happy birthday midi file)
• Get experimenting, try loading a different midi file or considering a way to make note duration register,
just generally have fun and explore some possibilities.
• Get on with your main assignment
• THANKS FOR LISTENING