Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 14, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 14, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 14, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 14, 2025

      I test a lot of AI coding tools, and this stunning new OpenAI release just saved me days of work

      May 14, 2025

      How to use your Android phone as a webcam when your laptop’s default won’t cut it

      May 14, 2025

      The 5 most customizable Linux desktop environments – when you want it your way

      May 14, 2025

      Gen AI use at work saps our motivation even as it boosts productivity, new research shows

      May 14, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025
      Recent

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025

      Perficient’s “What If? So What?” Podcast Wins Gold at the 2025 Hermes Creative Awards

      May 14, 2025

      PIM for Azure Resources

      May 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025
      Recent

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025

      You can now share an app/browser window with Copilot Vision to help you with different tasks

      May 14, 2025

      Microsoft will gradually retire SharePoint Alerts over the next two years

      May 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Artificial Intelligence»Transcribe audio with Ruby using Universal-1

    Transcribe audio with Ruby using Universal-1

    April 18, 2024

    We recently announced our latest speech recognition model, Universal-1, which achieves state-of-the-art speech-to-text accuracy. Trained on millions of hours of audio data, Universal-1 demonstrates near-human accuracy, even with accented speech, background noise, and difficult phrases like flight numbers and email addresses.

    Universal-1 is also an order of magnitude faster than our previous model, Conformer-2, and supports English, Spanish, French, and German, with more languages coming shortly.

    Along with Universal-1, we’ve also introduced two new classes of models: Best and Nano. Best lets you take advantage of Universal-1 for applications where accuracy is paramount. Nano is our new cost-effective alternative with support for 99 different languages.

    In this post, you’ll learn how to transcribe an audio file in your Ruby applications using Universal-1 and Nano.

    Set up the AssemblyAI Ruby SDK

    The easiest way to transcribe audio is by using one of our official SDKs.

    To install the AssemblyAI Ruby SDK, add the gem to your bundle and install the bundle:

    bundle add assemblyai
    bundle install

    Create a new file main.rb, and configure a new authenticated SDK client using your AssemblyAI API key from your account dashboard.

    require ‘assemblyai’

    client = AssemblyAI::Client.new(
    api_key: ENV[‘ASSEMBLYAI_API_KEY’]
    )

    You’ll find all the operations you need on the AssemblyAI instance.

    Transcribe an audio file using Universal-1

    All transcriptions use the Best by default, so you’ll always get the highest accuracy without any extra configuration.

    Use the following code to transcribe an audio file from a URL using Best:

    transcript = client.transcripts.transcribe(
    audio_url: “https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3”
    )

    raise transcript.error unless transcript.error.nil?

    puts transcript.text

    If you instead want to transcribe a local file, you can upload the file to AssemblyAI and pass the uploaded file URL to the transcribe method:

    uploaded_file = client.files.upload(file: ‘./audio.mp3’)

    transcript = client.transcripts.transcribe(audio_url: uploaded_file.upload_url)

    raise transcript.error unless transcript.error.nil?

    puts transcript.text

    To run your application, configure your ASSEMBLYAI_API_KEY as an environment variable, and use the following command to execute the code:

    ruby main.rb

    Nano—a cost-effective alternative

    Switching between Best and Nano is only a matter of setting the speech model parameter. To use Nano, set the speech_model to AssemblyAI::Transcripts::SpeechModel::NANO:

    transcript = client.transcripts.transcribe(
    audio_url: “https://storage.googleapis.com/aai-web-samples/5_common_sports_injuries.mp3”,
    speech_model: AssemblyAI::Transcripts::SpeechModel::NANO
    )

    Best, Nano and More with Audio Intelligence

    We just used Universal-1 through both the Best and Nano class of models to transcribe audio.

    Next, there are many further features that AssemblyAI offers beyond transcription to explore, such as:

    Entity detection to automatically identify and categorize key information.
    Content moderation for detecting inappropriate content in audio files to ensure that your content is safe for all audiences.
    PII redaction to minimize sensitive information about individuals by automatically identifying and removing it from your transcript.
    LeMUR for applying Large Language Models (LLMs) to audio data in a single line of code.

    You can also learn more about our approach to creating superhuman Speech AI models on our Research page.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleVisualizing algorithms
    Next Article Generate customized, compliant application IaC scripts for AWS Landing Zone using Amazon Bedrock

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 15, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4695 – PHPGurukul Cyber Cafe Management System SQL Injection

    May 15, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    Microsoft redesigns Windows 11 24H2’s BSOD, drops QR code, frowning face, blue colour

    Operating Systems

    How to Create and Sell Digital Products – A Beginner’s Guide

    Development

    TeleMessage, the Signal clone used by US government officials, suffers hack

    Development

    What Is the Best Alternative for Postman?

    Development
    GetResponse

    Highlights

    How to install MacOS 15 Sequoia developer beta to test the latest Mac features

    June 10, 2024

    If you’d like to test Apple’s new MacOS 15 Sequoia before the public beta in…

    Mastering DevOps: The Best Platforms to Learn the Skills for Advanced Specialists

    March 26, 2024

    Microsoft emails Windows 10 deadline warning, urges Windows 11 upgrade

    March 18, 2025

    Avowed Memory of the Deep guide — Should I give the Meteorite to Josep or the Giftbearer?

    February 13, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.