Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Start time property #774

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TanvirMobasshir
Copy link

Release Notes - Pydub v0.25.2

New Features

AudioSegment Class

  • Added a new property: start_time
    • Default value: 0
    • The start_time property is now available for the AudioSegment class.
    • Updated automatically when using the split_on_silence() function.
    • During the creation of multiple chunks, start_time reflects the starting time of its parent AudioSegment object.

How to Use

from pydub import AudioSegment

# Create an AudioSegment instance
audio = AudioSegment.from_file("example.mp3")

# Access and modify the start_time property
start_time = audio.start_time  # Get the current start time, default: 0

# Use split_on_silence() to update start_time during chunk creation
chunks = split_on_silence(audio)

for chunk in chunks:
    print(f">> {chunk.start_time}, {chunk.duration_seconds*1000+chunk.start_time}")

Result:

>> 503, 3338.0
>> 3338, 6179.0
>> 6179, 7632.0
>> 7632, 13930.0
>> 13930, 18141.0
>> 18141, 20653.0
... ... ...
... ... ...
... ... ...

Copy link

@Vadi Vadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks great. Really looking forward to have start_time

Copy link

@rajib-raiyat rajib-raiyat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It look good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants