code: def mix_in_audio_sample(
      track_data,
      track_offset,
      sample_data,
      sample_offset,
      clip_duration,
      sample_volume,
      ramp_in,
      ramp_out,
  ):
      """Mixes the sample data into the main track at the specified offset.
  
      Args:
        track_data: Numpy array holding main audio data. Modified in-place.
        track_offset: Where to mix the sample into the main track.
        sample_data: Numpy array of audio data to mix into the main track.
        sample_offset: Where to start in the audio sample.
        clip_duration: How long the sample segment is.
        sample_volume: Loudness to mix the sample in at.
        ramp_in: Length in samples of volume increase stage.
        ramp_out: Length in samples of volume decrease stage.
      """
      ramp_out_index = clip_duration - ramp_out
      track_end = min(track_offset + clip_duration, track_data.shape[0])
      track_end = min(
          track_end,
          track_offset + (sample_data.shape[0] - sample_offset),
      )
      sample_range = track_end - track_offset
      for i in range(sample_range):
          if i < ramp_in:
              envelope_scale = i / ramp_in
          elif i > ramp_out_index:
              envelope_scale = (clip_duration - i) / ramp_out
          else:
              envelope_scale = 1
          sample_input = sample_data[sample_offset + i]
          track_data[track_offset + i] += (
              sample_input * envelope_scale * sample_volume
          )
  
file_path: tensorflow/tensorflow/examples/speech_commands/generate_streaming_test_wav.py
imports: import argparse
  import math
  import sys
  import numpy
  import tensorflow
  import input_data
  import models
label_desc: Use image node_id 1 for calling a global function with example usage: mix_in_audio_sample(track_data, track_offset, sample_data, sample_offset, clip_duration, sample_volume, ramp_in, ramp_out) without return types