code: def extract_window(
      window, wave, f, frame_length, frame_shift, snip_edges
  ):
      # just a copy of ExtractWindow from feature-window.cc in python
      def first_sample_of_frame(
          frame, window_size, window_shift, snip_edges
      ):
          if snip_edges:
              return frame * window_shift
          else:
              midpoint_of_frame = (
                  frame * window_shift + window_shift // 2
              )
              beginning_of_frame = midpoint_of_frame - window_size // 2
              return beginning_of_frame
  
      sample_offset = 0
      num_samples = sample_offset + wave.size(0)
      start_sample = first_sample_of_frame(
          f, frame_length, frame_shift, snip_edges
      )
      end_sample = start_sample + frame_length
  
      if snip_edges:
          assert (
              start_sample >= sample_offset
              and end_sample <= num_samples
          )
      else:
          assert sample_offset == 0 or start_sample >= sample_offset
  
      wave_start = start_sample - sample_offset
      wave_end = wave_start + frame_length
      if wave_start >= 0 and wave_end <= wave.size(0):
          window[f, :] = wave[wave_start : (wave_start + frame_length)]
      else:
          wave_dim = wave.size(0)
          for s in range(frame_length):
              s_in_wave = s + wave_start
              while s_in_wave < 0 or s_in_wave >= wave_dim:
                  if s_in_wave < 0:
                      s_in_wave = -s_in_wave - 1
                  else:
                      s_in_wave = 2 * wave_dim - 1 - s_in_wave
              window[f, s] = wave[s_in_wave]
  
file_path: audio/test/torchaudio_unittest/compliance/kaldi/legacy_test.py
imports: import torch
  import torchaudio.compliance.kaldi
  from torchaudio_unittest import common_utils
label_desc: Use image node_id 1 for calling a global function with example usage: extract_window(window, wave, f, frame_length, frame_shift, snip_edges) and returns: unknown, beginning_of_frame