code: def test_cq_to_chroma(
      n_octaves, semitones, n_chroma, fmin, base_c, window
  ):
      bins_per_octave = 12 * semitones
      n_bins = n_octaves * bins_per_octave
  
      ctx: ContextManager[Any]
      if np.mod(bins_per_octave, n_chroma) != 0:
          ctx = pytest.raises(librosa.ParameterError)
      else:
          ctx = dnr()
  
      with ctx:
          # Fake up a cqt matrix with the corresponding midi notes
  
          if fmin is None:
              midi_base = 24  # C2
          else:
              midi_base = librosa.hz_to_midi(fmin)
  
          midi_notes = np.linspace(
              midi_base,
              midi_base + n_bins * 12.0 / bins_per_octave,
              endpoint=False,
              num=n_bins,
          )
          #  We don't care past 2 decimals here.
          # the log2 inside hz_to_midi can cause problems though.
          midi_notes = np.around(midi_notes, decimals=2)
          C = np.diag(midi_notes)
  
          cq2chr = librosa.filters.cq_to_chroma(
              n_input=C.shape[0],
              bins_per_octave=bins_per_octave,
              n_chroma=n_chroma,
              fmin=fmin,
              base_c=base_c,
              window=window,
          )
  
          chroma = cq2chr.dot(C)
          for i in range(n_chroma):
              v = chroma[i][chroma[i] != 0]
              v = np.around(v, decimals=2)
  
              if base_c:
                  resid = np.mod(v, 12)
              else:
                  resid = np.mod(v - 9, 12)
  
              resid = np.round(resid * n_chroma / 12.0)
              assert np.allclose(np.mod(i - resid, 12), 0.0), i - resid
  
imports: import os
  from contextlib import nullcontext
  import warnings
  import glob
  import numpy
  import scipy.io
  import scipy.signal
  from typing import Any, ContextManager
  import pytest
  import librosa
label_desc: Use image node_id 26 for calling a global function with example usage: test_cq_to_chroma(n_octaves, semitones, n_chroma, fmin, base_c, window) without return types