Skip to content

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