Skip to content

Commit

Permalink
Add AudioMetaData.__str__ override (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
majabojarska committed Mar 2, 2021
1 parent 2209da2 commit 98d0d59
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions torchaudio/backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ def __init__(
self.num_channels = num_channels
self.bits_per_sample = bits_per_sample
self.encoding = encoding

def __str__(self):
return (
f"AudioMetaData("
f"sample_rate={self.sample_rate}, "
f"num_frames={self.num_frames}, "
f"num_channels={self.num_channels}, "
f"bits_per_sample={self.bits_per_sample}, "
f"encoding={self.encoding}"
f")"
)

0 comments on commit 98d0d59

Please sign in to comment.