AgileAndArt

The Art Improving Agile Software Development

Browsing Posts in Music

This article is originally published in the ACM Digital Library for the ONWARD ’11 Proceedings of the 10th SIGPLAN symposium on New ideas, new paradigms, and reflections on programming and software. I’d like to specially thank the co-author and friend Joe Yoder and Richard P. Gabriel for all patience and good advices with this work.

Nessa vida de programador maluco
Me aparece cada situação
De repente um cliente, uma proposta bruta
Pra pegar de um site informação

Você tá louco, esse tipo de crime eu não faço
Se quiser tenho uns amigos lá do sul
Faz pra mim que eu te pago com essa jóia cool

Te dou um ruby
Pra você roubar
Com o seu robô

Quer fazer robô?
É só usar ruby
É só usar ruby
Pra fazer robô

Jango.com is one of the most incredible on-line radios I know and some time ago I decided to put Daniella Alcarpe songs on this site. Jango has many things that make artists life happier and easier: you pay Jango to play your songs to people who probably will like your song. For example, Daniella sings Brazilian Bossa Music, so in Jango I choosed to play her songs just for people who like this kind of music, people who listen to João Gilberto, Caetano Veloso, Chico Buarque and so on.

After songs starts playing, the artist starts to get fans. And they really come! With just 2 months of Jango, Daniella has almost 400 new fans, from all over the world.

Now comes the coolest part: we can interact with these fans. They can send us messages, comment on our profile, send us feedback and we can send them messages too. This is awesome and very useful for an artist who is becoming her artist life.

Jango website was made in RubyOnRails, so they provide an API for people who wants to use Jango information on their own website. And that’s what I did, in an extremely easy way. I wanted to show in Daniella’s website recent comments from fans on Jango. It took 18 minutes for me to integrate these two websites, using Rails ActiveResource. Here’s what I did:

1 – I’ve created two models (models/user.rb and models/comment.rb) on my project, one to deal with Jango Users and one to deal with Jango Comments:

class User < ActiveResource::Base
   self.site = "http://www.jango.com"
end

class Comment < ActiveResource::Base
  self.site = "http://www.jango.com/artists/48343/"

  def user
     @user ||= User.find(user_id)
  end
end

2 – Then on my SocialController I have this:

class SocialController < ApplicationController
  def index
    @comments = Comment.find(:all)
  end
end

3 – And in my views/social/index.html.erb I have

<% @comments.each do |c| %>
  <%= link_to "#{c.user.first_name} (#{c.user.country})", "http://www.jango.com/users/#{c.user.id}" %>
  <%= c.body %>
<% end %>

And that’s it: 9 model lines of code, 5 controller lines of code and 6 view lines of code. With 18 lines of code, I’ve integrated Daniella Alcarpe website with Jango. This is the power of Rails and RESTful. Now everybody who visits www.cantora.mus.br can see what fans are saying about the singer and her wonderful work. Check for yourself.

PS: of course there are some cache stuff to deal with on this integration, but for now I’m not worried. Premature optimization is the root of all evil (Donald Knuth)

Para quem quiser, seguem os slides da minha palestra no Encontro Ágil 2009:


O Akita nos convidou
Prum evento muito legal
Nóis fumo e foi muito mais que animal
Nóis twitêmo RailsSummit o dia inteiro
Da outra vêis, nóis vai vortá
Nóis não semo tatu

Outro dia encontremo com Akita
Que mostrou pra gente a morena Open Source
Isso não se faz Akita
Nóis sêmo geek
Era só ter ponhado o projeto no git

(música apresentada pela primeira vez na desconferência do Rails Summit 2009)

Sábado eu dei uma palestra de 20 minutos no 4o. Locaweb TechDay. Gostei muito de ter explorado esse tema. Muitas das ideias foram baseadas no livro Pragmatic Thinking And Learning, do Andy Hunt, misturado com minhas experiências pessoais. Confesso que tenho muitas outras coisas a respeito desse mesmo assunto que eu ainda quero falar. Façam seus comentários para me ajudar!

Pensamento e Aprendizado Eficiente – Desvendando o Cérebro Humano from Locaweb on Vimeo.

Last month, at QCON, I was in a great talk about functional programming languages (like Haskell) and their benefits to the Art world. The title of the talk was “How Functional Programmers can
Help, Inspire, or even Be Artists”. First of all I’d like to emphasize that all good programmers are artists, and as Richard Gabriel said 6 years ago, we programmers should be trained like artists. This is the major problem of our Computer Science Courses.

We all know artificial intelligence and computer tools are getting better and better. Right know we can easily produce things like this video:

In his talk, Prof. Paul Hudak also showed the examples of how we can do image animation using functional programming. The project he described was the Functional Reactive Animation (FRAN). All these things are not really new, but now that functional languages are returning to the main stream, those are the things that begin to appear. With tools like FRAN, an animation can be made as easy as this:

 growFlower u = buttonMonitor u `over`           stretch (grow u) flower

grow u = sizewheresize = 1 + atRate rate urate = bSign u

Of course if you don’t know functional programming this is strange and difficult, but just think about an application which enlarges and shrinks an image when you press right or left mouse button. Think that this application can be written in those 6 code lines above.

Another application for functional programming is music. I recently acquired my MacBook last week I used Garage Band software for the first time. It is amazing what one can do with music software. I’ve already played with Fruit Loops Studio (my favorite), Sony SoundForge (great too) and who don’t remember one of the first DJ software called MixMan.

But the focus of Paul’s presentation wasn’t in using tools, but in how you can build wonderful tools with less lines of code, just because functional programming were made for this kind of application. He showed an example of his Haskore project, a nice way to compose music using the Haskell functional language. You specify the program in terms of WHAT to do, not HOW to do it.

The design goals of the Haskore project are:

  • Simplicity, expressiveness, generality and performance
  • Real-time sound synthesis
  • Transparency
  • Good for signal processing, algorithmic composition and interactive applications

A small example of how you can write a song using Haskore. Here is the language definition for notes:

type Octave = Int
type Dur = Rational
type Pitch = (PitchClass, Octave)
data PitchClass = Cff | Cf | C | Dff | Cs | Df | Css | D | Eff | Ds
data PitchClass = Cff | Cf | C | Dff | Cs | Df | Css | D | Eff | Ds
| Ef | Fff | Dss | E | Es | Ff | F | Gff | Ess | Fs | Gf | Fss | G
| Aff | Gs | Af | Gss | A | Bff | As | Bf | Ass | B | Bs | Bss
data Prim a = Note Dur a | Rest Dur

So, a prim(itive) can be defined as

  • a note with a Picth (class + octave) and a duration (expressed as a real number)
  • or a rest with a duration (silence)

For example:

Note (1/4) (C,4) :: Prim Pitch – it is a Middle C quarter note

The music is defined as a sequence of primitive notes, or notes played in parallel:

data Music a = Primitive (Prim a) –primitive note or rest
| Music a :+: Music a –sequential composition
| Music a :=: Music a –parallel composition
| Modify Control (Music a) –modifier

This is just a little example, the language is much more complete, you can even define performance and interpretation using the language.

Ok, all these geek things are great and we love it. But I still have some doubts about how the most rooted concepts of creativity can be applied to these computational tools. I mean, I love music and I feel it when I listen to it, I feel it when I play the guitar with my band. I really don’t know how this tools can contribute to produce human interaction. Of course one can go home and program a nice music using Haskore, or do a couple of clicks in Garage Band to produce a pre-factoried song. This is wonderful, people can produce things that they could not some time ago. But what about the old fashion music composition? Will people in future have to know something about the pentagram and how to write a sheet?

To fill a song I need to close my eyes. To compose something in my piano I just close my eyes and play what comes, don’t know from where. Is there any computer tool that I can use with closed eyes? Or am I wrong and closing eyes isn’t necessary?

Professor Paul ends his talk telling us about an computacional application for dance. It is like a pentagram like represantation of steps and body movements. All right! Now you can formally define a dance script and send it to a robot and he will do a nice job, dancing.

My final question is: what is the robot feeling while he is in his perfect dance defined by an algorithm?

Foi publicado hoje no site da Agilcoop o podcast sobre Padrões para Introduzir Novas Idéias. Pode ser baixado diretamente na página de podcasts da Agilcoop ou diretamente nesse link. O podcast discute alguns padrões e conta o caso em que eles foram usados para introduzir métodos ágeis dentre de uma organização. No final, o som da cantora Daniella Alcarpe

Certo sábado escrevi no quadro branco da equipe os seguintes dizeres:

JÁ PENSOU EM ARTE HOJE?

– música
– dança
– pintura
– escultura
– poesia
– teatro
– cinema

Usei o padrão “No Seu Espaço” do livro Padrões para Introduzir Novas Idéias. Queria deixar visível uma idéia. A idéia de usar arte dentro do ambiente de desenvolvimento de software. O curioso é que na segunda-feira, os dizeres não estavam mais no quadro. Alguém tinha apagado. Por já conhecer os padrões “A Última Maioria” (último grupo de pessoas a aceitar uma idéia nova) e “Retardatários” (grupo que nunca aceita, ou que aceita forçadamente), não me incomodei em ser impedido de expressar o que queria. Afinal, o padrão “O Suficiente” diz para respeitar o tempo de aceitação das pessoas. Uma informação de cada vez. Quem viu a mensagem viu. Quem não viu, verá numa próxima oportunidade.

Eu continuo convicto, afinal, sou um “Defensor Dedicado” e me apóio em idéias de “Grandes Personalidades”: Richard Gabriel, Paul Graham, Kent Beck, Valdemar Setzer. Tenho o aval do meu orientador Prof. Dr. Fábio Kon.

A questão que fica em aberto é: como ter arte no dia-a-dia de uma empresa de tecnologia? O que eu não estou enxergando?

Switch to our mobile site