Coder Social home page Coder Social logo

itsnotgunnar / speakerdiarization Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 29 KB

Transcription and speaker diarization of youtube videos. This will be merged into a larger repository in an effort to automate the process of creating personalized models for users.

Python 100.00%

speakerdiarization's Introduction

speakerDiarization

This Python script contains a class AudioProcessor which is used for processing audio files.

Dependencies

This repository uses a conda environment - once you have Miniconda or Anaconda installed run the following script, replacing myenv with the name of your environment:

conda env create -f environment.yml
conda activate myenv
source activate myenv

Usage

Here's a simple example to get you started:

python

from AudioProcessor import AudioProcessor

Initialize the processor

processor = AudioProcessor(sounds_id="some_id", file_path="path/to/audio/file")

Run the main loop

processor.mainLoop()

Methods

init(self, sounds_id, file_path)

Initializes the AudioProcessor object. get_video_id(self, video_url)

Extracts the video ID from a given URL. speaker_diarization(self)

Performs speaker diarization on the audio file. millisec(self, timeStr)

Converts a time string to milliseconds. primary_speaker(self)

Identifies the primary speaker in the audio. chunk_primary(self)

Segments the audio based on the primary speaker. transcribe_directory(self)

Transcribes all .wav files in a given directory. audio_to_audioSeg(self, t1, t2)

Extracts an audio segment between t1 and t2. mainLoop(self)

The main function that ties all the methods together.

Environment Variables

The script uses the following environment variables:

  • OPENAI_API_KEY: The API key for OpenAI.
  • HUG_USER1: The API key for Hugging Face.

Make sure to set these environment variables before running the script.

Contributing

Feel free to open issues or PRs if you find any problems or have suggestions for improvements.

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.