Dernière activité 1732180526

Darvyn's Avatar xavieryang a révisé ce gist 1732180525. Aller à la révision

1 file changed, 19 insertions

check_wav_format.py(fichier créé)

@@ -0,0 +1,19 @@
1 + import wave
2 + import sys
3 +
4 + # Open the WAV file
5 + file_path = sys.argv[1]
6 + with wave.open(file_path, 'rb') as wav_file:
7 + # Get audio parameters
8 + channels = wav_file.getnchannels() # Number of channels (1=mono, 2=stereo)
9 + sample_width = wav_file.getsampwidth() # Sample width in bytes
10 + frame_rate = wav_file.getframerate() # Sampling frequency (Hz)
11 + num_frames = wav_file.getnframes() # Total number of frames
12 +
13 + # Convert sample width to bits
14 + bit_depth = sample_width * 8
15 +
16 + print(f"Channels: {channels}")
17 + print(f"Sample Rate: {frame_rate} Hz")
18 + print(f"Bit Depth: {bit_depth} bits")
19 + print(f"Number of Frames: {num_frames}")
Plus récent Plus ancien