question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Librosa in 128MB memory or less

See original GitHub issue

I want to package librosa onto AWS Lambda (a serverless compute service) to do audio analysis (similar to EchoNest API) cheaply and scalably. To minimize cost and maximize performance, I want to use as little memory as possible. 128MB is ideal. But I also want to support the analysis of DJ mixes that are an hour+ long.

If I partially transcode->STFT->etc n samples at a time, I can still do mostly what I need: HPSS, cqt, transient-segmentation, timbre, pitch, or time stretch.

Let’s say the input is a URL to an audio file (could be MP3, M4A/AAC, WAV, FLAC)

  1. Partially download n bytes
  2. Send input through the transcode->STFT->etc pipeline
  3. del bytes for garage collection when no longer needed
  4. Print output as I go (instead of gathering into a dictionary)
  5. Hop to next bytes

Byte range needs to take into consideration the HPSS values (and segmentation boundaries) at frame f depend on a few frames before and after it.

Aware of anything stubborn/tricky about transcoding partially downloaded files?

Recommendation on how I might best structure/integrate this into librosa? Perhaps something in examples/

Recommendations for memory profilers?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
misrasaurabh1commented, Jul 9, 2018

How did you even make librosa even work on AWS lambda? How did you package the linux libav-tools dependency on Lambda? Also the limit of code one can package is 250MB on AWS lambda. librosa along with all its dependencies take up close to 300MBs in python packages.

1reaction
Jasparr77commented, Apr 4, 2020

@yousefjnm Nothing yet, I’m working through a few issues specific to my use-case. I would recommend trying Zappa out, though - it’s a pretty straightforward solution and the slim_handler feature leverages s3 to “support up to 500M of zipped up Python projects.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial — librosa 0.10.0.dev0 documentation
loads and decodes the audio as a time series y , represented as a one-dimensional NumPy floating point array. The variable sr contains...
Read more >
Why is my memory growing when using Librosa?
For some reason, the memory used by the process is growing over time. Here is a simpler version of the code: import librosa...
Read more >
vid2cleantxt - PyPI
A command-line tool to easily transcribe speech-based video files into clean text. also in Colab.
Read more >
Music Similarity Analysis Using the Big Data Framework Spark
As an example, the librosa toolkit struggles to detect beats in the first 10 seconds of the song ”Behind Space” recorded in 1999....
Read more >
Untitled
Shallow subwoofer uk, Escaner manual para libros, A crush poem, Elektrotehnika sa elektronikom ... Prego heart smart, Smartphones under 5000 with 2gb ram?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found