[英]How to access the object returned by torchaudio.info(filepath)
Upon implementing torchaudio.info on a filepath, I am getting a different return than specified in the documentation.在文件路径上实现 torchaudio.info 后,我得到的返回值与文档中指定的不同。
The code here returns <torchaudio.backend.common.AudioMetaData object at 0x000001908CFB3B20>
这里的代码返回
<torchaudio.backend.common.AudioMetaData object at 0x000001908CFB3B20>
tempFile = os.path.join(audio_dir,'1','121007.wav')
metadata=torchaudio.info(tempFile)
print(metadata)
while I need a return of the following form as the documentation specifies虽然我需要按照文档指定的方式返回以下表格
AudioMetaData(sample_rate=44100, num_frames=109368, num_channels=2, bits_per_sample=16, encoding=PCM_S)
Probably the version issue.应该是版本问题。 v0.8 did not have
__str__
method. v0.8 没有
__str__
方法。 It was added in v0.9.它是在 v0.9 中添加的。
https://github.com/pytorch/audio/pull/1339 https://github.com/pytorch/audio/pull/1339
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.