code: def getTone(signalNeeded):
      # Generate an ascending sequence of pitches
      # Note scales
      N_offset0 = note_scales[signalNeeded][0]
      N_offset1 = note_scales[signalNeeded][1]
      nnotes = N_offset1 - N_offset0 + 1
  
      samples_per_note = np.rint((float(N) / float(nnotes)) / 2.0)
      # Divide in half because we are adding up silences between notes
  
      scale_midi = np.arange(N_offset0, N_offset1 + 1)
      scale_frequencies = 440.0 * np.power(semitone, scale_midi)
  
      number_of_samples_for_period = np.rint(fs / scale_frequencies)
      number_of_samples_for_note = (
          np.rint(samples_per_note / number_of_samples_for_period) + 1
      ) * number_of_samples_for_period - 1
      number_of_samples_of_silence = (
          2 * samples_per_note - number_of_samples_for_note
      )
  
      # Build the tones and the silences
      # First in signal we distribute the phases of the different tones
      signal = []
      for i in xrange(len(scale_frequencies)):
          y = np.repeat(
              scale_frequencies[i], number_of_samples_for_note[i]
          )
          signal = np.insert(signal, len(signal), y, axis=0)
          y = np.repeat(0.0, number_of_samples_of_silence[i])
          signal = np.insert(signal, len(signal), y, axis=0)
  
      # Now we calculate the sine of the phases
      signal = np.sin(2 * np.pi * np.arange(len(signal)) / fs * signal)
      # Normalization
      signal = signal / max(signal)
  
      return signal
  
file_path: essentia/test/src/qa/hpcp/test_hpcp_generatesignals.py
imports: import random
  import numpy
  from scipy.signal import spectrogram
  import essentia
  from essentia.standard import *
  from test_hpcp_parameters import *
label_desc: Use image node_id 3 for calling a global function with example usage: getTone(signalNeeded) and returns: signal