I gave a fruit fly brain a new job: making music.
I chose a genre, started the program, and waited to hear what it would come up with. There were melodies, bass lines, and drum patterns. Some felt awkward. Others had enough going on that I wanted to listen again. A fruit fly brain was involved in making this. That still feels like a strange sentence to write.
Before you hear what it made, let me show you what I gave it to work with. Then you can decide how much credit you'd give the fly.
A brain, a genre, and a music engine
I call the project FlyWire Composer. The basic idea was to connect a digital reconstruction of fruit fly neural wiring to a music engine. As activity moved through that network, it helped shape the musical ideas the engine explored. I gave it a genre to work toward and let the process run.
The engine made several ideas, scored them, kept the more promising ones, and changed them before trying again. That cycle continued over several generations. A melody could take a different turn, or a drum pattern could change. Gradually, those little revisions became part of a larger composition.
A few good notes aren't a song. I needed phrases that belonged together, a bass line that worked with the drums, and a reason to keep listening after the first loop.
Here are four samples. They don't sound like club-ready tracks, of course. I could use more sophisticated instrument and sound libraries to give them a more polished, professional sound. But that's not what I'm testing here. I want to hear what the composition process comes up with: the melodies, rhythms, and how the parts fit together. Keep that in mind when you press play.
How an idea became a track
With several melodies, chord sequences, bass lines, and drum patterns to choose from, the engine needed a way to decide what to keep. I built a piece of software to score those ideas. I call it the critic.
The name sounds grander than the job. It checks whether notes fit together, whether rhythms and phrases hold up, and whether the result belongs to the requested genre. Each idea gets scores that help decide which versions get another chance. It doesn't listen the way you or I do.
The program then changes the stronger ideas and scores them again. A bass pattern moves, a chord changes, a drum accent appears. This is evolutionary search: keep promising versions, make variations, and see where they lead. The word sounds technical, but the cycle is easy to follow.
The scores only get you so far. Some results were repetitive; others missed the style. You can hear the samples and make up your own mind. That's a more useful test than taking the program's word for it.
Think about repetition. The same phrase can pull you into a groove or make you reach for the stop button. A surprise can be exciting or feel completely out of place. Balancing those things is hard to put into rules. The critic gives the search direction, but it can't promise that you'll love what survives.
Where the brain came from
The brain wiring comes from FlyWire, a project that maps neurons and their connections in a fruit fly brain. That map is called a connectome. I used a smaller network of 8,192 neurons from the FAFB v783 dataset, keeping their mapped connections.
In my program, simulated activity travels through those connections. The patterns it produces feed into choices about tempo, tonal direction, and the musical possibilities the engine tries. This is where the brain's wiring enters the process you heard in the samples.
The connections matter. Where activity can go depends on how the neurons are linked. I brought that particular structure into the music engine, keeping the routes between neurons intact.
What the engine learned from music
The engine also needed musical examples to work from. I used two datasets, each bringing something different:
- MAESTRO v3.0.0: piano performances that provide examples of melody, harmony, and timing.
- Groove MIDI v1.0.0: human drum performances that provide examples of rhythm and expressive timing.
Then I added reference songs in folders for different genres. The program looked at things like rhythm, bass movement, how busy the music was, and how its energy changed. Those measurements gave it a guide to the style I wanted. I wasn't training an audio-generation model on those songs.
House made the problem especially clear. Some earlier results hung together musically but felt more like lounge music than a dance track. A steady kick, repeating phrases, and sections that build and release energy gave the engine something more useful to aim for.
Think of the drums returning after a breakdown. The music has made room for that moment. The references helped the engine account for those changes in energy and density.
Inside the Python build
Behind all this was a fairly unglamorous stretch of programming, testing, and listening.
The project took a full week of development and more than 7,000 lines of Python.
The code connects FlyWire's neural wiring, numerical and scientific processing, musical examples, reference analysis, idea generation, and scoring. It also handles MIDI generation and audio rendering.
Much of the work happens as symbolic music. That means instructions about notes: when they start, how long they last, and how strongly they're played. MIDI can store those instructions. Rendering gives them instrument sounds so we can hear them. Keeping those stages separate let me work on the composition before turning it into audio.
"Artificial music" might make you think of Suno, where you can describe a song and get a finished track. These samples came from the custom system I built, rather than Suno or a similar service. Here, the neural network, musical rules, and repeated revisions help develop the musical events that are then rendered into sound. That process is the experiment.
The composer also saves what it has learned between runs. It can carry that knowledge forward instead of starting from scratch each time.
Hundreds of experimental runs helped me find out what worked and what sounded terrible. There was plenty of the latter.
Getting a program to produce notes is one thing. Getting to the point where you want to let it keep playing takes considerably more patience.
So who actually wrote the music?
The fly's reconstructed neural network has a share in this music. So do the software, the musical examples, and the framework I built to bring them together. The composition came out of that shared process.
The network helped shape which possibilities were explored. Musical examples supplied a vocabulary, references and rules gave direction, and the critic and evolutionary search selected and revised ideas. Each part had a job. Together, they took those choices toward a track.
That's what I mean when I say I gave a fruit fly brain a job making music. Its wiring became a working part of the composer. It contributed to choices that the surrounding system helped turn into melody, rhythm, and structure.
The contribution comes from reconstructed wiring; it doesn't depend on a living fly understanding a chorus. Measuring how much that wiring improved the result would need a controlled comparison. These samples alone can't put a percentage on its share.
Give one of the samples another listen. There is biological neural wiring in the process behind it, alongside musical examples and code. For me, that's enough to want to keep exploring. I'd like to hear where this unlikely little contributor can take the next track.