Dauer einer WAV-Datei in Python abrufen (minimales Beispiel)
English
Deutsch
Verwenden Sie
get_wav_duration_minimal.py
duration_seconds = mywav.getnframes() / mywav.getframerate()um die Dauer einer WAV-Datei in Sekunden abzurufen.
Vollständiges Beispiel:
get_wav_duration_full.py
import wave
with wave.open("myaudio.wav") as mywav:
duration_seconds = mywav.getnframes() / mywav.getframerate()
print(f"Length of the WAV file: {duration_seconds:.1f} s")If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow