Giter Site home page Giter Site logo

audioslicer's Introduction

AudioSlicer

A simple Audio Slicer in Python that can split .wav audio files into multiple .wav samples, based on silence detection. Also, it dumps a .json file that contains the periods of time in which the slice occours, in the following format:

{
    "0": ["0:0:0", "0:0:3"],
    "1": ["0:0:3", "0:0:10"],
    "2": ["0:10:0", "0:0:22"],
    "3": ["0:0:22", "0:0:32"]
}

The file names will also contains the parts when the video were sliced, ex.: sample01_0349_0401.wav

Attribution

I gratefully acknowledge the original code's contribution from /andrewphillipdoss

AI Adaptation

This project will turn into a neural network which can detect audio silence and split the files. It will also needs to learn to detect 'breathing noises' from the dictator and remove from it.

Requirements:

  • Python 3.11.0
  • numpy - 1.24.1
  • scypi - 1.10.0
  • tqdm - 4.64.1

Usage

  1. Edit AudioSeg.py and change the input_file (full path to your original .wav file) and output_dir (folder path to the destination of the audio splits).
  2. Run python -m AudioSeg.py

Note

Please note that in order for your audio file to be cut into samples, it should contain periods of "silence". If you are trying to extract voice samples from a song, for example, it may not work as expected.

Depending on the level of noise in your audio, the algorithm may skip the silence windows, resulting in missed cuts. Ensure that your audio is free from unwanted noise and that the silences are clearly defined. You can adjust the parameters of >> min_silence_length, silence_threshold, and step_duration to modify the length, amplitude, and duration of the silence window in order to better match your audio

audioslicer's People

Contributors

henrymaas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

audioslicer's Issues

How to set the Silence_Threshold ?

Could someone explain how to set the right threshold for the silence?

It says "silence_threshold = 1e-4" in the script but i have no clue what that stands for?

Some sort of guide would be really helpful, for example:

1e-4 = -10db
1e-3 = -20db
1e-2 = -30db

etc.
Thanks!

Error

Splitting C:\Users\Slim\Desktop\vocals\blabla.wav where energy is below 0.01% for longer than 0.6s.
Traceback (most recent call last):
File "C:\Users\Slim\AudioSlicer\AudioSeg.py", line 93, in
max_amplitude = np.iinfo(samples.dtype).max
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Slim\anaconda3\envs\audioslicer\Lib\site-packages\numpy\core\getlimits.py", line 677, in init
raise ValueError("Invalid integer data type %r." % (self.kind,))
ValueError: Invalid integer data type 'f'.

Unable to specify split length

Hi,

I'm trying to specify the length of time each segment should be but for some reason the audio is only being split into 3 second segments.

help

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Backslashes Cause Syntax Error

In the input and output directories in the py file, there are backslashes which cause a syntax error. I fixed this by changing them to forward slashes. Making it raw didn't work for some reason.

Some Mistakes in Source code

Hi, I'm working with audio slicing recently. I always tried to use amplitude to slice the audio. Your idea is wonderful that energy is be used to slice audio. However, there are some mistakes made me a little confused.
There is a function naming GetTime() but not defined and a variable cut_samples be used before definition.
It is very kind of you to check it again, and it would help me a lot. Thank you!

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.