code: def frame_generator(frame_duration_ms, audio, sample_rate):
      
      n = int(sample_rate * (frame_duration_ms / 1000.0) * 2)
      offset = 0
      timestamp = 0.0
      duration = (float(n) / sample_rate) / 2.0
      while offset + n < len(audio):
          yield Frame(audio[offset:offset + n], timestamp, duration)
          timestamp += duration
          offset += n
docs: Generates audio frames from PCM audio data.
  
      Takes the desired frame duration in milliseconds, the PCM data, and
      the sample rate.
  
      Yields Frames of the requested duration.