🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsWindows Authentication SMS not received or working(12.09.2026 um 11:54 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsWindows Authentication SMS not received or working(12.09.2026 um 11:54 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🕵️ SicherheitslückenDefender 0-Day ShieldBreak (CVE-2026-69414) nicht sauber gepatcht - BornCity(11.09.2026 um 12:52 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 9 Min Lesezeit
0

Generate audio clips with Gemini 2.0 Flash

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




TL;DR:



Happy holidays! Google






Introduction



Welcome to the blog focusing on using Google APIs from Python and sometimes Node.js. Today's post focuses on Gemini, but there's plenty of content beyond Gemini:




  • Google Cloud/GCP:

  • Google Workspace/GWS: (also Drive!)


  • Common topics across all APIs like auth & security:



This post takes a break from the flow of the previous posts in this model: text-based audio clip generation.






Prerequisites






New client library improves user experience (UX)



You need a client library to talk to Gemini from code. While several client libraries already exist for Gemini, Google has recently introduced a new one. The new library features an improved UX, so I have to give Google some credit. In the

  • while another is in the for the latest releases. The sample app is only available in Python^, but I'm happy to explore a Golang PR if you get to an equivalent port before I do.



    ^ -- Python 3 only; Python 2 support is not available for the Gemini API






    Installation and setup



    Follow these steps to install the client library and get set up:




    1. Install the new client library: pip install -U google-genai


    2. , , etc., as once your API key leaks, everyone in the world can use it.



      If you're new to Google developer tools, , mostly used by GWS APIs, and service accounts, mostly used by Google Cloud (GCP) APIs. While this post doesn't cover Google Maps, the Maps team put together a great , asyncio is required because the audio files. This is followed by importing Google's new "genAI" client library.



      Like in previous code samples in this series, the API key is saved to settings.py. Alternatively, you can save your API key to the GOOGLE_API_KEY environment variable, or use the python-dotenv package, storing the API key in .env to more closely mirror working in a Node.js environment. There's also the and , allowing it to be used with the with statement. You'll find nearly-identical code in various samples and Notebooks in the , kicking it off by opening the WAV file for write and sending the prompt to the LLM. The rest of it continuously waits for a server response, writing the chunks of audio data received until it's been exhausted, terminating the session.



      This is minimal code required to do the job. In other examples from Google, you'll find reference to server_content, inline_data and writing out parts. Most of this relates to supporting a multi-turn conversation, but for a single request-response "cycle," less code is less confusing.






      Running the script



      Running the script produces an audio file along with the expected output:




      CODE
      $ python3 gem20-audio.py

      ** LLM prompt: "Describe a cat in a few sentences"
      ** Saved audio to "whatacatis.wav"






      Your mileage may vary, but this is the audio track I got from Gemini:










      Summary



      Developers are eager to jump into the world of AI/ML, especially GenAI & LLMs, and accessing Google's Gemini models via API is part of that picture. The previous posts in the series got your foot in the door, and today, we explored a new feature available from Gemini 2.0 Flash. Next, we'll continue the journey from the previous post (link below) and show you how to deploy basic genAI web apps to Google Cloud!



      If you find errors or have suggestions on content you'd like to see in future posts, also leave a comment below, and if your organization needs help integrating Google technologies via its APIs, reach out to me by submitting a request at



      NEXT POST: Part 5: Deploying basic GenAI web apps to Google Cloud (coming soon)






      References



      Below are various links relevant to this post:






      Code samples













      • (PDF)






      Other Gemini API content by the author




      • (GDE) in Google Cloud (GCP) & Google Workspace (GWS), author of Prentice Hall's bestselling , and has written for Linux Journal & CNET. He runs , and Python training & engineering. Wesley was one of the original Yahoo!Mail engineers and spent 13+ years on various Google product teams, speaking on behalf of their APIs, producing sample apps, codelabs, and videos for . He holds degrees in Computer Science, Mathematics, and Music from the University of California, is a Fellow of the Python Software Foundation, and loves to travel to meet developers worldwide at conferences, user group events, and universities. Follow he/him . Find this content useful? !

        Vollständiger Original-Bericht
        Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
        ↗ Original-Artikel auf dev.to lesen
  • Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 0%
    🟡 In Evaluierung 0%
    🟢 Keine Auswirkung 0%
    Spannende Innovation 0%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    1 Quelle
    The Gemini desktop app is now available for Windows
    1 Quelle
    Windows Authentication SMS not received or working
    1 Quelle
    Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
    Ähnliche Beiträge
    🔍 Verwandte News

    Auch interessante Nachrichten Generate audio clips with Gemini 2.0 Flash

    Thematisch verwandte Begriffe: Generate, audio, clips, with · 6 Treffer

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...