साउंड वेव bytes को integers में बदलना

Python में Spoken Language Processing

Daniel Bourke

Machine Learning Engineer/YouTube Creator

bytes को integers में बदलना

  • bytes {{1}} का सीधे उपयोग नहीं कर सकते
  • bytes को integers में numpy से बदलें
import numpy as np

# soundwave_gm को bytes से integers में बदलें signal_gm = np.frombuffer(soundwave_gm, dtype='int16')
# पहले 10 items दिखाएँ signal_gm[:10]
array([ -3,  -5,  -8,  -8,  -9, -13,  -8, -10,  -9, -11], dtype=int16)
Python में Spoken Language Processing

फ्रेम रेट खोजना

  • Frequency (Hz) = wave object array की length/audio file की duration (seconds)
# फ्रेम रेट लें
framerate_gm = good_morning.getframerate()

# फ्रेम रेट दिखाएँ framerate_gm
48,000
  • Audio file की duration (seconds) = wave object array की length/frequency (Hz)
Python में Spoken Language Processing

साउंड वेव के timestamps खोजना

# start और stop के बीच समान दूरी वाले मान लौटाएँ
np.linspace(start=1, stop=10, num=10)
array([ 1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9., 10.])
# good morning साउंड वेव के timestamps पाएँ
time_gm = np.linspace(start=0, 
                      stop=len(soundwave_gm)/framerate_gm,
                      num=len(soundwave_gm))
Python में Spoken Language Processing

साउंड वेव के timestamps खोजना

# good morning साउंड वेव के पहले 10 timestamps देखें
time_gm[:10]
array([0.00000000e+00, 2.08334167e-05, 4.16668333e-05, 6.25002500e-05,
       8.33336667e-05, 1.04167083e-04, 1.25000500e-04, 1.45833917e-04,
       1.66667333e-04, 1.87500750e-04])
Python में Spoken Language Processing

अभ्यास करते हैं!

Python में Spoken Language Processing

Preparing Video For Download...