code: def frame_generator(frame_duration_ms, audio, sample_rate):
      """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.
      """
      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
  
file_path: fairseq/examples/speech_synthesis/preprocessing/vad/__init__.py
imports: import collections
  import contextlib
  import wave
  import argparse
  import os
  import logging
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: frame_generator(frame_duration_ms, audio, sample_rate) without return types