30k Audio Diary Entries: Getting Organized
Why write a diary when you may dictate it? It looks as if a smart thought — till you surprise, how do you truly work with it later? And is it even price it on this format? Nowadays, numerous apps can immediately convert speech to textual content, making this course of hassle-free. But what if this concept had popped into your head years in the past, again within the early days when cell telephones first launched the “voice recorder” characteristic?
Over the years, our house audio library has grown to incorporate over 30,000 such recordings. Now it’s time to carry some order to the chaos, “with blackjack and hookers” of course.

A couple of years in the past, I began organizing all my audio recordings into “Year/Month” folders, very similar to I had completed with images. However, whereas my picture library boasted options like face recognition and album previews, the audio recordings remained a chaotic mess. Sure, including the recording date to file names improved visibility and construction, but it surely nonetheless wasn’t sufficient — I needed extra.
I started by exploring current options available on the market. Unfortunately, most of them assumed that recordings can be created inside their platforms or required handbook entry for every file. With 30,000 information to handle, it was clear this method was something however sensible.
I made a decision to create my very own software, particularly since I’d had success doing one thing related with images. The final aim included options like speaker recognition, textual content transcription, and producing titles or summaries for every recording. Naturally, this meant leveraging neural networks — as a result of what mission doesn’t contain them these days?
Cloud-based options, whereas efficient, have been dominated out because of their excessive prices. Plus, my house server is provided with a CUDA-supported GPU, making an area implementation each possible and extra interesting.
The unique excellent situation regarded like this:

However, it turned out that issues weren’t so simple. While there are wonderful algorithms for speaker diarization (reminiscent of this one and that one), they typically carry out properly solely when the variety of audio system is thought upfront. In my case, this wasn’t relevant.
Preliminary evaluation revealed that in 95% of the recordings, there was just one speaker — and it was nearly at all times my spouse. Given this, I made a decision to desert speaker identification solely.
Text recognition is a extra frequent process, with loads of ready-made libraries obtainable. I selected to go along with Whisper — it’s simple to make use of, helps CUDA acceleration, and delivers moderately good outcomes. Or at the least, that’s the way it appeared at first.
On clear recordings, the popularity was nearly good. Whisper not solely transcribes but in addition punctuates, which was spectacular. However, issues arose after I encountered recordings with out voices — reminiscent of music, birdsong, or different sounds. In these circumstances, the AI refused to surrender and started “hallucinating,” inventing phrases that weren’t there and presenting them as actual.
I found this unsettling impact after processing a number of thousand recordings. To my shock, I discovered phrases like “like, remark, and subscribe” in some transcriptions. At first, I suspected these may need been captured inadvertently, as my daughter sometimes makes YouTube movies. However, a deeper search revealed dozens of such circumstances, all from silent information.
Further evaluation steered that Whisper may need been skilled on YouTube subtitles. Silent information typically contained phrases sometimes spoken by video bloggers on the finish of their movies — particularly the ultimate subtitle left on display after the content material ends.
To deal with this, I compiled a set of normal expressions to filter out these “hallucinatory” phrases. After testing and reviewing a few hundred recordings, I discovered nothing else uncommon, so the problem appears resolved for now.
The subsequent stage was to generate headlines, however this too turned out to be a failure. A dozen neural networks I examined produced nothing however nonsense. Many gave the impression to be skilled on information datasets, because the generated headlines typically seemed like tabloid headlines — and a few even referenced heads of state in response to utterly empty texts!
For a second, I thought-about utilizing the almighty ChatGPT. Although it wasn’t an area resolution, I made a decision to present it a attempt. It labored properly, however a lot of the headlines it generated have been generic phrases like “Family Conversation.” While correct, such titles didn’t serve the first function of rapidly figuring out recordings.
Surprisingly, the answer was less complicated than anticipated. The first sentence of the transcription typically contained, if not the precise topic, then at the least a transparent trace in regards to the content material of the recording. So I made a decision to make use of the primary sentence because the title — and, because it seems, it’s fairly informative.
Once the recordings have been transcribed, the subsequent problem was determining the best way to work with all this information. Managing 30,000 plain-text information clearly wasn’t an possibility within the twenty first century.
My preliminary thought was to throw the whole lot right into a database and construct a easy frontend. However, since “frontend” improvement isn’t my sturdy swimsuit — and I additionally needed to retailer the information exterior my servers for replication — I started exploring alternate options.
The first possibility was Google Docs, but it surely rapidly proved impractical. Embedding audio hyperlinks required irritating workarounds, and neither a single doc for all of the records nor 30,000 particular person paperwork appeared like a handy resolution.
Then I turned my consideration to Notion. It supplied a handy API, the flexibility to construction paperwork, embed audio information, and, most significantly, built-in search performance. I rapidly put collectively a prototype web page and gave it a attempt — and to my shock, it turned out to be extremely handy.

I started writing a program to deal with the format, and essentially the most handy library I discovered was notion-py. Everything was going easily till I uploaded the primary 5,000 records. It turned out that the library’s caching system updates the index with a single request, and sooner or later, it exceeded the utmost information dimension the server may settle for. Additionally, because the variety of records grew, the library began to gradual down.
At first, I attempted to repair the problems within the library myself, but it surely rapidly turned clear that there have been fairly just a few bugs — and the library was basically deserted and now not maintained.
After a few evenings spent digging into legacy code, I made a decision to discover alternate options. Unfortunately, there aren’t many choices — simply the official API. While it’s practical, it’s removed from full. First and foremost, it doesn’t help importing information on to the positioning; it solely permits inserting hyperlinks. Second, it doesn’t allow you to lock a web page, so by default, it stays in edit mode. This is problematic, because it’s my archive, and permitting edits on the positioning is deceptive and never excellent. Additionally, you may’t delete entries by way of the API, which is important when updating pages, for example.
In the top, I had to make use of a hybrid method: the official API handles nearly all of the duties, whereas notion-py takes care of the lacking performance, with one vital bug repair to make it work for my wants.
The result’s a two script system:
- The first script acknowledges the audio and generates a JSON file in the identical folder with the identical identify. This file incorporates the transcribed textual content, description, and different needed attributes. It’s a long-running background process that I’ve been operating in a single day for months at a time.
mmdiary-transcriber-run folder_name
File instance:
{
"caption": "Audio Note Caption 1",
"textual content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit....",
"mannequin": "whisper/medium",
"sort": "audio",
"supply": "2020-02-07_22-11-16.mp3",
"length": 5.3,
"recordtime": "2020-02-07 22:11:16",
"processtime": "2024-03-15 01:35:13"
}
- The second script synchronizes native information with Notion. It’s a comparatively fast operation, and the outcomes could be seen instantly on the web site.
mmdiary-notion-upload folder_name
After debugging (and including video help, however extra on that within the subsequent article), I wrote a single script that performs all of the steps without delay. Additionally, it may be routinely triggered by cron.
mmdiary --audio --notion
Now, similar to with images, it’s so simple as inserting a flash drive (or inserting the information in a particular folder on the server), urgent the import button, and after a short while, all of the records — full with transcripts in a searchable textual content format and the choice to take heed to the audio — will seem in Notion.
In addition to a system for viewing notes, I needed one thing that might periodically remind me of them. I used to be impressed by how Google Photos sends day by day reminiscence notifications. Since our household’s major platform for interplay is Telegram, I made a decision to put in writing a easy bot.
The performance is simple: the bot sends a random audio recording as soon as a day and offers recordings for a selected day upon request. There’s no want to enter element in regards to the course of of making a Telegram bot, because it’s a subject in itself, and there are many articles obtainable. Instead, I’ll simply go away a hyperlink to the bot’s code.
The code for your complete mission can be obtainable.
As at all times, the whole lot is open supply, and I’d be completely happy if my expertise or code could be helpful to somebody else.
30k Audio Diary Entries: Getting Organized was initially printed in Level Up Coding on Medium, the place individuals are persevering with the dialog by highlighting and responding to this story.
HI-FI News
through Level Up Coding – Medium https://ift.tt/uoUhnpZ
December 2, 2024 at 03:01AM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT








