GithubHelp home page GithubHelp logo

5l1v3r1 / audiogrep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antiboredom/audiogrep

0.0 1.0 0.0 37 KB

Creates audio supercuts.

Home Page: http://antiboredom.github.io/audiogrep

License: MIT License

Python 100.00%

audiogrep's Introduction

Audiogrep

Audiogrep transcribes audio files and then creates "audio supercuts" based on search phrases. It uses CMU Pocketsphinx for speech-to-text and pydub to stitch things together.

Here's some sample output.

Requirements

Install using pip

pip install audiogrep

Install ffmpeg with Ogg/Vorbis support. If you're on a mac with homebrew you can install ffmpeg with:

brew install ffmpeg --with-libvpx --with-libvorbis

Finally, install CMU Pocketsphinx. For mac users I followed these instructions to get it working:

brew tap watsonbox/cmu-sphinx
brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxbase
brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxtrain # optional
brew install --HEAD watsonbox/cmu-sphinx/cmu-pocketsphinx

How to use it

First, transcribe the audio (you'll only need to do this once per audio track, but it can take some time)

# transcribes all mp3s in the selected folder
audiogrep --input path/to/*.mp3 --transcribe

Then, basic use:

# returns all phrases with the word 'word' in them
audiogrep --input path/to/*.mp3 --search 'word'

The previous example will extract phrase chunks containing the search term, but you can also just get individual words:

audiogrep --input path/to/*.mp3 --search 'word' --output-mode word

If you add the '--regex' flag you can use regular expressions. For example:

# creates a supercut of every instance of the words "spectre", "haunting" and "europe"
audiogrep --input path/to/*.mp3 --search 'spectre|haunting|europe' --output-mode word --regex

You can also construct 'frankenstein' sentences (mileage may vary):

# stupid joke
audiogrep --input path/to/*.mp3 --search 'my voice is my passport' --output-mode franken

Or you can just extract individual words into files.

# extracts each individual word into its own file in a directory called 'extracted_words'
audiogrep --input path/to/*.mp3 --extract

Exporting to: extracted_words/i.mp3
Exporting to: extracted_words/am.mp3
Exporting to: extracted_words/the.mp3
Exporting to: extracted_words/key.mp3
Exporting to: extracted_words/master.mp3

Options

audiogrep can take a number of options:

--input / -i

mp3 file or pattern for input

--output / -o

Name of the file to generate. By default this is "supercut.mp3"

--search / -s

Search term

--output-mode / -m

Splice together phrases, single words, fragments with wildcards, or "frankenstein" sentences. Options are:

  • sentence: (this is the default)
  • word
  • fragment
  • franken

--padding / -p

Time in milliseconds to add between audio segments. Default is 0.

--crossfade / -c

Time in milliseconds to crossfade audio segments. Default is 0.

--extract / -x

--demo / -d

Show the results of the search without outputing a file

Troubleshooting

If you receive the error "ERROR: "cmd_ln.c", line 942: Unknown argument: -alignctl", uninstalling and reinstalling cmu-sphinxbase and cmu-pocketsphinx may solve the issue.

audiogrep's People

Contributors

antiboredom avatar ben174 avatar bryant1410 avatar korymath avatar learning-more avatar souramoo avatar

Watchers

 avatar

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.