Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 6 min read How-to mediumAdept

AI Speech Recognition in Unity

Speech recognition can be added to a Unity game with the Hugging Face Unity API by recording microphone input, encoding it as WAV and sending it for transcription. The C# walkthrough builds start/stop buttons and records up to 10 seconds at 44.1 kHz with Microphone.Start. It truncates the clip at the stop position and hand-writes a 16-bit PCM WAV header before calling HuggingFaceAPI.AutomaticSpeechRecognition with success and error callbacks. Button interactability and status messages are added for UX. Reader comments note that the hosted inference endpoint now returns 403 or timeout errors.

Assumes: Unity basicsC# scripting

Related posts

  • How to Install and Use the Hugging Face Unity API

    Hugging Face mediumAdept

    The Hugging Face Unity API wraps the Hugging Face Inference API so Unity projects can call hosted models. You install it via Package Manager from a git URL, then use the API Wizard to set an API key and model endpoints. A C# example shows an asynchronous sentence-similarity call with success and error callbacks. Other supported tasks include conversation, text generation, text-to-image, classification, QA, translation, summarization and speech recognition, and custom models work by swapping the endpoint URL. Slow responses can be addressed by switching to lower-resource models.

  • Build a Speech-to-Text App with AssemblyAI on Replit

    Replit mediumAdept

    A Next.js app on Replit transcribes uploaded audio files with AssemblyAI's speech-to-text API. It uses three API routes: one that parses multipart uploads with multiparty and forwards the file to AssemblyAI's /upload endpoint, one that submits the returned private URL to /transcript, and one that fetches results by ID. A React frontend polls the result route once per second until the status is "completed" or "error". Setup covers Tailwind, Axios, keeping the API key in Replit Secrets, and disabling Next.js's bodyParser so multiparty can parse uploads.

  • Speech Synthesis, Recognition, and More With SpeechT5

    Hugging Face mediumAdept

    SpeechT5, Microsoft Research Asia's unified speech model, is now in 🤗 Transformers. It uses one shared Transformer encoder-decoder with task-specific pre-nets and post-nets to handle text-to-speech, speech-to-text and speech-to-speech. The model is pre-trained jointly on text and speech so both share one hidden representation space, then fine-tuned per task. Code walkthroughs cover TTS with x-vector speaker embeddings and a HiFi-GAN vocoder, voice conversion, and character-level ASR without punctuation, and they flag limits such as voice conversion sometimes cutting off early at pauses.

  • Fine-Tune Wav2Vec2 for English ASR in Hugging Face with 🤗 Transformers

    Hugging Face mediumAdept

    Wav2Vec2, pretrained with a contrastive masked objective on 50k+ hours of unlabeled speech, can be fine-tuned with CTC on small labeled datasets for end-to-end English ASR without a language model. The walkthrough fine-tunes the base checkpoint on the 5-hour Timit corpus using 🤗 Transformers and Datasets. It covers building a character-level CTC vocabulary (lowercasing, stripping punctuation, keeping apostrophes, mapping space to a word delimiter, and adding UNK and PAD/blank tokens), and configuring the feature extractor with a matching 16kHz sampling rate and normalization. It also explains why the base checkpoint works better without an attention mask, and evaluates with WER via jiwer while pushing checkpoints to the Hub.

  • Blazingly fast whisper transcriptions with Inference Endpoints

    Hugging Face easyNovice

    Hugging Face Inference Endpoints now offers a Whisper deployment built on vLLM that delivers up to roughly 8x higher real-time factor (RTFx) than the Transformers implementation, with comparable word error rate. It targets NVIDIA Ada Lovelace GPUs (L4, L40s) and gets its speedup from torch.compile JIT kernels, CUDA graphs that batch GPU kernel launches, and a float8 KV cache that halves cache memory versus bfloat16. Whisper Large V3, V3-Turbo and Distil-Whisper V3.5 were benchmarked for WER on 8 Open ASR Leaderboard datasets and for RTFx on 45+ minute rev16 audio using a single L4. Deployment is one click, and the endpoint is called through an OpenAI-style /audio/transcriptions HTTP API; a FastRTC demo shows real-time transcription.

The quest for software engineering knowledge.

Look:
Layout: