AI / Google Antigravity Gemini Fundamentals Interview Questions
What is Gemini's native audio understanding capability and how do you use it?
Gemini models can directly process audio files - transcribing speech, answering questions about audio content, identifying speakers, and analysing audio characteristics. This is different from the Live API's real-time audio; it processes pre-recorded audio files.
from google import genai from google.genai import types from pathlib import Path client = genai.Client() # Method 1: Inline audio (small files < 20MB) audio_bytes = Path("interview.mp3").read_bytes() response = client.models.generate_content( model="gemini-3.5-flash", contents=[ types.Part( inline_data=types.Blob( data=audio_bytes, mime_type="audio/mp3" ) ), types.Part(text="Transcribe this interview and summarise the key points.") ] ) print(response.text) # Method 2: Upload via Files API (recommended for files > 20MB) uploaded = client.files.upload( file=Path("podcast.mp3"), config={"display_name": "Tech Podcast Episode 42"} ) # Wait for processing: import time while uploaded.state == "PROCESSING": time.sleep(2) uploaded = client.files.get(name=uploaded.name) # Analyse the audio: response = client.models.generate_content( model="gemini-3.5-flash", contents=[ types.Part(file_data=types.FileData(file_uri=uploaded.uri, mime_type="audio/mp3")), types.Part(text="How many different speakers are in this podcast? Identify each speaker's role.") ] ) print(response.text)
| Property | Detail |
|---|---|
| Supported formats | MP3, WAV, FLAC, AAC, OGG, OPUS, WebM audio |
| Max inline size | ~20MB (use Files API for larger) |
| Max duration (context window) | Approximately 9.5 hours of audio at 1M token context |
| Capabilities | Transcription, speaker diarisation, audio Q&A, summarisation |
More Related questions...