Issue with kit.write() in ESP32 AudioKit Code

66 views
Skip to first unread message

Valdeci Ribeiro

unread,
Dec 16, 2024, 8:07:41 PM12/16/24
to Mozzi-users

Hello everyone,

I am working on the following code example for the ESP32 that demonstrates headphone detection and sine wave generation. The code uses the AudioKitHAL and SineWaveGenerator libraries:

/**
 * @file headphone.ino
 * @author Phil Schatzmann
 * @brief Headphone Detection Demo
 * @date 2021-12-10
 *
 * @copyright Copyright (c) 2021
 *
 */
#include "AudioKitHAL.h"
#include "SineWaveGenerator.h"

AudioKit kit;
SineWaveGenerator wave;
const int BUFFER_SIZE = 1024;
uint8_t buffer[BUFFER_SIZE];

void setup() {
  LOGLEVEL_AUDIOKIT = AudioKitInfo;
  Serial.begin(115200);
  // open in write mode
  auto cfg = kit.defaultConfig(KitOutput);
  kit.begin(cfg);

  // 1000 Hz
  wave.setFrequency(1000);
  wave.setSampleRate(cfg.sampleRate());
}

void loop() {
  size_t l = wave.read(buffer, BUFFER_SIZE);
  kit.write(buffer, l); // Issue occurs here
}

However, I am encountering a compiler error that states:
'class audiokit::AudioKit' has no member named 'write'

I am not sure if this is due to a change in the AudioKitHAL library, a missing dependency, or if the example code itself has become outdated.

  • Does anyone know if the kit.write() function has been deprecated or replaced?
  • Is there an alternative way to send audio data to the output using the current AudioKitHAL version?

Any guidance or suggestions would be greatly appreciated.

Thank you in advance!

tomco...@live.fr

unread,
Dec 22, 2024, 11:59:30 AM12/22/24
to Mozzi-users
Hi,

Sorry, but this does seem to be an error with Mozzi (you are not actually using Mozzi in your sketch), so it might be better to ask directly to the forum/github of AudioKitHal.

Valdeci Ribeiro

unread,
Feb 15, 2025, 6:12:56 PMFeb 15
to Mozzi-users
Thank you very much but I saw that the mozzi library does not work on esp32

tomco...@live.fr

unread,
Feb 16, 2025, 4:27:51 PMFeb 16
to Mozzi-users
Well, Mozzi officially supports esp32, it works with an old version of the esp core but the upgrade to the new one is ongoing (https://github.com/sensorium/Mozzi/pull/301). Very welcome to test the fix of you fancy :)
But the audio code your have here is part of another library:).

Valdeci Ribeiro

unread,
Feb 16, 2025, 4:45:07 PMFeb 16
to Mozzi-users
thank you very much
Reply all
Reply to author
Forward
0 new messages