ai newsFr., 30. Okt.
EilmeldungMotionVFX comes to Final Cut Pro as Apple adds beta AI assistants to Creator Studio

Integrating AI Voice with Notion and Productivity Tools

Why Voice Matters in Modern Productivity We’ve all been bitten by the “I wish I could just talk through my notes” itch. Whether it’s jotting down ideas, updating a project status, or simply listening to a long‑form document while commuting, voice can turn a tedious task into a fluid, hands‑free exp

dev.toFreitag 07:45 · 30.10.5 Min. Lesezeit
Bild: dev.to

We’ve all been bitten by the “I wish I could just talk through my notes” itch. Whether it’s jotting down ideas, updating a project status, or simply listening to a long‑form document while commuting, voice can turn a tedious task into a fluid, hands‑free experience. When you pair a robust text‑to‑speech (TTS) engine with a productivity platform like Notion, you get a powerful synergy that can boost focus, reduce eye strain, and free up your thumbs for other tasks.

Below, we’ll walk through a minimal, end‑to‑end example: reading a Notion page aloud and creating a voice‑cloned summary that you can embed back into Notion.

Notion’s API returns pages as JSON. The easiest way to fetch a page is via curl or a short Python script. Make sure you’ve created an integration token in Notion and shared the page with that integration.

curl -H "Authorization: Bearer $NOTION_TOKEN " \ -H "Notion-Version: 2024-04-15" \ https://api.notion.com/v1/pages/ $PAGE_ID Enter fullscreen mode Exit fullscreen mode import os, requests NOTION_TOKEN = os. getenv ( " NOTION_TOKEN " ) PAGE_ID = os. getenv ( " PAGE_ID " ) headers = { " Authorization ": f " Bearer { NOTION_TOKEN } ", " Notion-Version ": " 2024-04-15 ", " Content-Type ": " application/json ", } resp = requests. get ( f " https://api.notion.com/v1/pages/ { PAGE_ID } ", headers = headers ) page_content = resp. json () print ( page_content [ " properties " ][ " title " ][ " title " ][ 0 ][ " plain_text " ]) Enter fullscreen mode Exit fullscreen mode Extract the main body text (usually under blocks or rich_text ) and feed it into your TTS pipeline.

ElevenLabs offers a high‑quality, developer‑friendly TTS API that supports voice cloning and custom voice models. It’s also one of the most affordable options on the market, making it a perfect fit for hobby projects and early‑stage startups.

import requests, json, os ELEVENLABS_API_KEY = os. getenv ( " ELEVENLABS_API_KEY " ) headers = { " xi-api-key ": ELEVENLABS_API_KEY, " Content-Type ": " application/json ", } # 1️⃣ Choose a voice (the “Rachel” demo voice is great for demos) voice_id = " Rachel " # 2️⃣ Prepare your text text = " Hello, this is a test of the ElevenLabs text‑to‑speech API. " # 3️⃣ Call the synthesis endpoint payload = { " text ": text, " voice_settings ": { " stability ": 0.75, " similarity_boost ": 0.8 } } resp = requests. post ( f " https://api.elevenlabs.io/v1/text-to-speech/ { voice_id } ", headers = headers, data = json. dumps ( payload )) # 4️⃣ Save the resulting MP3 with open ( " output.mp3 ", " wb " ) as f: f. write ( resp. content ) Enter fullscreen mode Exit fullscreen mode Tip: If you want to clone your own voice, ElevenLabs provides a simple web UI where you can record a short sample (≈ 30 seconds). The platform will generate a custom model that you can use by swapping voice_id for the model’s ID.

curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/Rachel" \ -H "xi-api-key: $ELEVENLABS_API_KEY " \ -H "Content-Type: application/json" \ -d '{"text":"Hello from ElevenLabs!","voice_settings":{"stability":0.75,"similarity_boost":0.8}}' \ --output output.mp3 Enter fullscreen mode Exit fullscreen mode The resulting output.mp3 can be streamed directly in the browser, or you can upload it back to Notion as an audio file attachment.

Notion’s API also supports uploading files. After generating the MP3, you can host it on a static server or use a service like AWS S3, then attach the URL to the page.

# Assuming you have uploaded output.mp3 to a public URL audio_url = " https://mycdn.com/audio/output.mp3 " # Create a file block in Notion payload = { " parent ": { " page_id ": PAGE_ID }, " properties ": {}, " children ": [ { " object ": " block ", " type ": " file ", " file ": { " type ": " external ", " external ": { " url ": audio_url } } } ] } resp = requests. post ( " https://api.notion.com/v1/blocks ", headers = headers, data = json. dumps ( payload )) print ( resp. json ()) Enter fullscreen mode Exit fullscreen mode Now anyone opening the page can click the audio block and listen to the TTS output right in Notion.

One of the most exciting use cases for voice cloning is creating a personal audio summary of a meeting or research article. Here’s a quick outline:

# Step 3: Summarize (pseudo‑code) summary = summarize_text ( page_text ) # Replace with your favorite summarizer # Step 4: Synthesize with cloned voice payload = { " text ": summary, " voice_settings ": { " stability ": 0.75 }} resp = requests. post ( f " https://api.elevenlabs.io/v1/text-to-speech/ { custom_voice_id } ", headers = headers, data = json. dumps ( payload )) with open ( " summary.mp3 ", " wb " ) as f: f. write ( resp. content ) Enter fullscreen mode Exit fullscreen mode This workflow turns a dense 10‑page research note into a 2‑minute audio briefing that you can replay on a walk, while driving, or during a quick break.

If you’re building a real‑time voice assistant, consider the following:

The same pattern applies to tools like Todoist, Slack, or Google Docs:

Because the ElevenLabs API is agnostic to the source of the text, you can build a single microservice that powers multiple integrations.

Ready to bring your notes to life? Click the link below, sign up, and start generating natural‑sounding audio for Notion and beyond. Don’t forget to explore the voice‑cloning feature – it’s a game‑changer for personalized productivity.

Happy coding, and may your voice never be silenced again!

Quelle: dev.to (dev.to). Original öffnen