Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Tutorials
    • All tutorials
      • Building a CI/CD pipeline in GitLab
      • GitLab Runner execution in Serverless Containers
      • Creating a budget trigger that invokes a Cloud Functions function to stop VM instances
      • Automatically copying objects from one Object Storage bucket to another
      • Running computations on a schedule in DataSphere
      • Recognizing audio files from Object Storage on a regular basis
      • Deploying a fault-tolerant architecture with preemptible VMs
      • Creating triggers that invoke Cloud Functions functions to stop a VM and send Telegram notifications
      • Running computations in DataSphere using the API
      • Configuring CI/CD between Cloud Functions and SourceCraft
      • Configuring CI/CD between Cloud Functions and GitHub
      • Setting up CI/CD in SourceCraft to deploy an application in Serverless Containers using GitHub Actions
      • Automatic data upload to Yandex SpeechSense using Yandex Workflows
      • Configuring responses in Cloud Logging and Yandex Cloud Functions
      • Scheduled image and PDF recognition in an Object Storage bucket
      • Setting up Workflows integration with Tracker, YandexGPT, and Yandex Cloud Postbox

In this article:

  • Getting started
  • Create a cloud function
  • Create a trigger
  • Test the function
  1. Serverless technologies
  2. Serverless-based workflows and automation
  3. Recognizing audio files from Object Storage on a regular basis

Recognizing audio files from Yandex Object Storage on a regular basis

Written by
Yandex Cloud
Updated at April 13, 2026
  • Getting started
  • Create a cloud function
  • Create a trigger
  • Test the function

The SpeechKit asynchronous recognition API is integrated with Yandex Object Storage. Therefore, you can set up automatic recognition of audio files of supported formats that are regularly uploaded to an Object Storage bucket. A cloud function in Yandex Cloud Functions regularly checks the bucket for audio files and sends them to the SpeechKit API for recognition. The recognition result and status are saved to the same Object Storage bucket.

To set up automatic recognition of audio files using SpeechKit:

  1. Create a cloud function to read files from your Object Storage bucket, send them to the API, and check the file recognition status.
  2. Create a trigger to regularly invoke your cloud function.
  3. Test the function.

Getting startedGetting started

  1. Create a service account named asr-batch-sa.

  2. Assign the storage.editor, functions.functionInvoker, and ai.speechkit-stt.user roles to the service account for the folder in which it was created.

  3. Create a static access key for the service account.

  4. Create an API key for the service account.

  5. Create an Object Storage bucket named asr-batch-bucket in the service account folder.

  6. Open asr-batch-bucket, click Create folder, and specify input in the Folder name field.

  7. Upload the config.json file with the specified recognition language to the bucket's input folder. The file only contains one setting:

    {
      "lang": "<language_code>"
    }
    

    Note

    If there is no config.json file in the bucket, the recognition language will be Russian.

Create a cloud functionCreate a cloud function

  1. In the management console, go to the folder the service account was created in.

  2. Navigate to the Cloud Functions service.

  3. Click Create function and specify asr-batch-function as the function name.

  4. Click Create.

  5. Under Editor, select the Python 3.8 runtime environment and click Continue.

  6. Download the script file from the Yandex Cloud repository.

  7. Under Function code, clear the contents of the index.py file and paste the downloaded script.

  8. Under Function code, create a file named requirements.txt and add the following code to it:

    boto3
    botocore
    requests
    
  9. Specify the function run settings:

    • Entry point: index.handler
    • Timeout: 60
    • Service account: asr-batch-sa
  10. Add these environment variables:

    • S3_BUCKET: asr-batch-bucket
    • S3_PREFIX: input
    • S3_PREFIX_LOG: log
    • S3_PREFIX_OUT: out
    • S3_KEY: Static access key ID
    • S3_SECRET: Static access key secret
    • API_KEY: API key ID
    • API_SECRET: API key secret
  11. Click Save changes.

Create a triggerCreate a trigger

  1. In the management console, navigate to the folder the function was created in.
  2. Navigate to the Cloud Functions service.
  3. Select Triggers.
  4. Click Create trigger.
  5. Specify the trigger settings:
    • Name: asr-batch-cron.
    • Type: Timer.
    • Launched resource: Function.
    • Cron expression: Every minute.
    • Function: asr-batch-function.
    • Function version tag: $latest.
    • Service account: asr-batch-sa.
  6. Click Create trigger.

The trigger you created will fire once a minute and invoke the cloud function.

Test the functionTest the function

  1. In the management console, navigate to the folder the function was created in.
  2. Navigate to Object Storage and open asr-batch-bucket.
  3. Upload audio files of any supported format to the input folder.
  4. Wait a few minutes and make sure the bucket now contains the log and out folders.
  5. Check the recognition status in the log folder. The status of each audio file sent for recognition is saved to an auxiliary file named <audio_file_name>.json, e.g., audio.mp3.json. The "done": "false" parameter in the file indicates that the recognition process is not completed.
  6. Check the recognition result in the out folder. The result is saved to a JSON file named <audio_file_name>.json, e.g., audio.mp3.json. To learn more about the recognition result format, see Asynchronous recognition API.

Note

You can monitor the progress of the script in the logs of asr-batch-function.

See alsoSee also

  • Asynchronous recognition API v2
  • Asynchronous recognition of LPCM audio files using the API v2
  • Asynchronous recognition of OggOpus audio files using the API v2

Was the article helpful?

Previous
Running computations on a schedule in DataSphere
Next
Deploying a fault-tolerant architecture with preemptible VMs
© 2026 Direct Cursus Technology L.L.C.