···10101111**IMPORTANT: Never run `./debug-macos.sh` or any build commands unless explicitly instructed by the user. The user will handle building and testing.**
12121313+**IMPORTANT:** When given permission to build and test, use **THIS EXACT COMMAND**: ./debug-macos.sh -p -h -s
1414+1515+You will find the build output in `build/bin/tic80`.
1616+1317### macOS
1418```bash
1519# Recommended: Use the debug script
+1-1
src/cqtdata.h
···44#define CQT_BINS 120
55#define CQT_OCTAVES 10
66#define CQT_BINS_PER_OCTAVE 12
77-#define CQT_FFT_SIZE 16384 // 16K FFT - excellent low-frequency resolution with minimal performance impact
77+#define CQT_FFT_SIZE 8192 // 8K FFT - balanced time/frequency resolution, ~5.4 fps update rate
8899// CQT frequency range
1010#define CQT_MIN_FREQ 20.0f // Sub-bass for electronic music
+2-1
src/ext/cqt.c
···218218 }
219219220220 // Copy audio data from the shared buffer
221221- // TEMPORARY: sampleBuf now has FFT_SIZE * 2 = 2048 * 2 = 4096 samples
221221+ // sampleBuf is defined in fft.c as extern
222222+ extern float sampleBuf[];
222223 memcpy(cqtAudioBuffer, sampleBuf, CQT_FFT_SIZE * sizeof(float));
223224224225 // Check if we have any audio data
+11-6
src/ext/fft.c
···1919kiss_fftr_cfg fftcfg;
2020ma_context context;
2121ma_device captureDevice;
2222-float sampleBuf[FFT_SIZE * 2];
2222+// Include CQT header to get CQT_FFT_SIZE
2323+#include "../cqtdata.h"
2424+2525+// Shared audio buffer - must be large enough for both FFT and CQT
2626+// FFT needs FFT_SIZE * 2 (2048) samples, CQT needs CQT_FFT_SIZE samples
2727+#define AUDIO_BUFFER_SIZE (CQT_FFT_SIZE > (FFT_SIZE * 2) ? CQT_FFT_SIZE : (FFT_SIZE * 2))
2828+float sampleBuf[AUDIO_BUFFER_SIZE];
23292430void miniaudioLogCallback(void* userData, ma_uint32 level, const char* message)
2531{
···47534854void OnReceiveFrames(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
4955{
5050- frameCount = frameCount < FFT_SIZE * 2 ? frameCount : FFT_SIZE * 2;
5656+ frameCount = frameCount < AUDIO_BUFFER_SIZE ? frameCount : AUDIO_BUFFER_SIZE;
51575258 // Just rotate the buffer; copy existing, append new
5359 const float* samples = (const float*)pInput;
5460 float* p = sampleBuf;
5555- for (int i = 0; i < FFT_SIZE * 2 - frameCount; i++)
6161+ for (int i = 0; i < AUDIO_BUFFER_SIZE - frameCount; i++)
5662 {
5763 *(p++) = sampleBuf[i + frameCount];
5864 }
···184190 return true;
185191#else
186192187187- memset(sampleBuf, 0, sizeof(float) * FFT_SIZE * 2);
193193+ memset(sampleBuf, 0, sizeof(float) * AUDIO_BUFFER_SIZE);
188194189189- // TEMPORARY: Using 4096-point FFT to support CQT
190190- // TODO: Restore to 2048 and implement separate buffer for CQT
195195+ // FFT uses 2048-point FFT as originally intended
191196 fftcfg = kiss_fftr_alloc(FFT_SIZE * 2, false, NULL, NULL);
192197193198 ma_context_config context_config = ma_context_config_init();
+1-4
src/fftdata.h
···11#pragma once
22#include <stdbool.h>
33-// TEMPORARY: Changed from 1024 to 8192 to support CQT's 16384-point FFT
44-// This breaks FFT bin resolution but enables CQT to work properly
55-// TODO: Restore to 1024 and implement separate buffer for CQT
66-#define FFT_SIZE 8192
33+#define FFT_SIZE 1024
74extern float fPeakMinValue;
85extern float fPeakSmoothing;
96extern float fPeakSmoothValue;