Giter Site home page Giter Site logo

Comments (3)

tilmankamp avatar tilmankamp commented on May 16, 2024 1

Now DeepSpeech supports transcribing audio files to .tlog files through its transcribe.py tool. It is implemented in a way that should avoid keeping an audio file completely in memory.

$ python transcribe.py --batch_size 30 --src audio.wav --dst audio.tlog --checkpoint_dir ../checkpoint-0.6.0/

from dsalign.

tensorfoo avatar tensorfoo commented on May 16, 2024

It seems this is an issue with pydub but they seem uninterested in fixing it, so this limitation will remain indefinitely as long as we're using pydub.

from dsalign.

tensorfoo avatar tensorfoo commented on May 16, 2024

So a bit of investigation and i came across the pyav library as an alternative to pydub. It is fairly simply to load the mp3 into RAM using the following code:

import av
c = av.open("largefile.mp3")
cd = c.decode(audio=0)

which yields a generator,
>>> cd <generator object at 0x7fe3e5ac0af8>

which we can use lazily like:
>>> f = next(cd) <av.AudioFrame 0, pts=0, 576 samples at 22050Hz, mono, s16p at 0x7fe3e598c6c8>

>>> R = av.audio.resampler.AudioResampler(rate=16000)
>>> f.pts = 0
>>> R.resample(f)
<av.AudioFrame 3, pts=None, 402 samples at 16000Hz, mono, s16p at 0x7fe3e598c660>

So wavsplit.py would have to be modified to use pyav like this but the benefit would be being able to lazily consume the audio file. It's already been written to use generators (yield etc) so this would be a better fit than pydub.

from dsalign.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.