This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass
What I Built
You're on a forest trail. A bird starts singing, and a few seconds later the moment has passed.
The Forest Symphony lets you keep that moment. You record the bird on your device, and in about ten seconds you get:
- The bird's name, with how sure the app is (for example, American Robin, 79% match)
- A few facts about where it lives and how it sings
- A short melody built from the notes the bird actually sang, which you can play right away
- A Download button that saves the melody as an audio file (WAV)
It works without internet. Everything runs on your own device, so it still works deep in the woods with no signal. Your recordings and where you made them stay on your device.
Who it's for: hikers, birdwatchers, musicians, parents out on a walk with curious kids, and anyone who has stopped to listen to a bird and wished they could take the song home.
How it gets people outside: the app is useless indoors on purpose. The only way to get a new melody is to go outside, find a bird, and listen closely enough to record it. Every melody you collect comes from a real bird you heard on a real day. It works like a sound journal that you build by spending time outdoors.
Demo
https://drive.google.com/file/d/1PUcd4IlFDC5NfZWIdGX1syxjSyWxyfmw/view?usp=sharing
What the demo shows:
- Morning Robin Chirp. A real robin recording becomes "American Robin's Morning Song", which you can play and download.
- Deep Woods Owl. A Tawny Owl is recognised with a 93% match and turned into a slow, low melody.
- Windy Ridge. A recording of plain wind. The app politely replies: "We couldn't hear a bird in this recording. Try again closer to the birdโฆ". It doesn't invent a bird that isn't there.
The app ships with these three recordings built in, so a live demo never depends on a bird turning up.
Code
https://github.com/Gamey001/forest-symphony
To run it yourself:
python3.12 -m venv .venv
.venv/bin/pip install -r requirements-dev.txt
ollama pull llama3.1 # one-time download of the AI composer
ollama serve # in its own terminal
.venv/bin/uvicorn app.main:app --port 8000
Then open http://localhost:8000. The first run downloads the bird-recognition model once; after that, everything works offline.
How I Built It
The app works like a small assembly line. A recording goes in one end and a melody comes out the other. Each station does one job:
๐๏ธ Recording
โ
1. Clean up โ remove wind rumble, background hiss and silent gaps
โ
2. Identify โ BirdNET names the bird (or says "that's not a bird")
โ
3. Listen โ follow the bird's pitch, 100 times per second
โ
4. Draft โ turn the pitch into notes, in a key, at a human tempo
โ
5. Compose โ a local AI (Llama 3.1) arranges the draft and calls a "make the melody" tool
โ
6. Synthesize โ plain maths turns the notes into sound waves โ WAV file
โ
๐ต Result card: bird name, facts, play button, download button
The open-source AI pieces
๐ฆ BirdNET: the bird expert. BirdNET is a free, openly available model from the Cornell Lab of Ornithology and Chemnitz University of Technology. It has been trained to recognise over 6,000 bird species by sound. It runs on my laptop through birdnet, the official Python package. I chose it over a general-purpose AI because it is built for exactly this one job, and it does it well. It also recognises things that aren't birds, such as human voices, engines and wind noise. The app uses that to say "we couldn't hear a bird" instead of guessing.
๐ผ Llama 3.1 (8B) via Ollama: the composer. Llama 3.1 is a language model whose files you can download and run yourself (an "open-weight" model). Ollama is a free tool that runs models like this on your own computer. In this app, the model plays the role of a composer. It receives a short text description of what the bird sang (species, key, draft notes) and responds by calling a tool named generate_melody with its final arrangement.
๐ง Plain Python for everything else: FastAPI for the small web server, NumPy and SciPy for the audio maths, and a plain HTML page for the interface.
Choices that made it work
1. Let each AI do what it is good at.
My first plan had the language model "listen" to the bird. That doesn't work: language models read and write text and cannot hear. If you ask one for the notes in a recording, it will make some up. So the work is split:
- Hearing the bird is done with signal maths: find the loudest frequency in each tiny slice of sound. It gives the same answer every time.
- Naming the bird is done by BirdNET, the specialist.
- Arranging the music is done by the language model, which works with text and makes creative choices.
2. Never trust the AI blindly, and always have a backup.
Every tool call from the AI is checked before anything plays. Are the notes real notes? Is the melody within two octaves? Are the rhythms valid? If the answer is wrong, the AI is told exactly what was wrong and gets one more try. If it still fails, or if the AI isn't running at all, the app uses its own draft melody. You always get a song.
3. Facts come from a fact file, never from the AI.
Language models sometimes state made-up facts with total confidence. That's harmless in a chat, but bad on a card that teaches kids about birds. The species facts come from a small, hand-checked file and are looked up by the name BirdNET gives.
4. Be honest about what the AI did.
In testing, the model would say "I smoothed out the melody" when it hadn't changed a single note. So the app doesn't show what the AI says it did. It compares the melodies before and after and reports what actually changed, for example "The AI composer reshaped 5 of the bird's 24 notes."
Problems I ran into (and what I learned)
- ๐ฆ The owl kept disappearing. The noise cleaner learned what "background noise" sounded like from the whole recording. Owl hoots are long and steady, so the cleaner decided the owl was the background and erased it. The fix was to treat a sound as background only if it's there almost all the time. Hoots come and go, so they now survive.
- ๐ฆ The owl sounded twice as high as it should. Owl calls have overtones (fainter copies of the note at higher pitches) that are louder than the note itself, so the app followed the wrong one. It now checks for a real note underneath the loudest one, and picks that note when it's there.
- ๐๏ธ Browsers were deleting birdsong. Browsers clean up microphone audio for video calls, and that cleanup treats birdsong as noise to remove. The app turns those filters off when it records.
- ๐ฆ Real birds are too high for music. A robin sings at around 2,500 Hz, which is higher than the top of a piano. The app moves the melody down by whole octaves, so it keeps its shape but lands in a range that's pleasant to listen to.
- ๐ป Static was "a woodpecker". Fed pure static, BirdNET reported a woodpecker with 45% confidence. The app now needs at least 50% confidence before it believes something is a bird.
Why Does Open Innovation Matter?
It works where the internet doesn't. The place you hear the best birdsong, deep in the woods, is usually the place with no signal. An app that depends on a paid online AI service stops working at the trailhead. Because BirdNET and Llama 3.1 run on the device itself, the Forest Symphony works on a mountain or in a forest, or anywhere else.
Your walks stay private. Recordings, times and places say a lot about where you go and when. With open models running locally, none of that leaves your device. There's no account to sign up for and nothing to upload.
The best tool for the job was already open. No general-purpose online AI matches BirdNET at recognising birds. It exists because researchers spent years collecting and labelling bird recordings and then shared the result. The demo recordings in this app also come from volunteers who share their recordings on xeno-canto. The whole project is built on things people chose to share.
I could look inside and fix things. When the owl went missing and the AI's descriptions didn't match its output, I could test each piece on its own, see what was going on, and change it. With a closed service, I would only have seen the final wrong answer, with nothing I could inspect.
It costs nothing to use. There are no per-request fees or rate limits, and no API key that can expire before demo day.
Credits
- Bird identification: BirdNET by the Cornell Lab of Ornithology and Chemnitz University of Technology (model licence: CC BY-NC-SA 4.0)
- AI composer: Llama 3.1 by Meta, running on Ollama
- Robin recording: Jonathon Jongsma, xeno-canto XC130246, CC BY-SA 3.0
- Owl recording: Benoรฎt Van Hecke, xeno-canto XC603209, CC BY-SA 4.0
Top comments (0)