esp32 pt8211 mozzi 2

57 views
Skip to first unread message

Daniel Llermaly

unread,
Nov 16, 2024, 10:40:04 PM11/16/24
to Mozzi-users
Hi friends, I was trying to use the esp32 with the pt8211 dac with mozzi 2. Checking the documentation I found 2 sites with different information.

https://sensorium.github.io/Mozzi/doc/html/hardware_esp32.html
https://sensorium.github.io/Mozzi/doc/html/hardware_esp8266.html

Anyway I tried both alternatives and I couldn't get the pt8211 16 bit stereo example to sound in either of the 2 configurations.
What are the pins to use for clk and din?
Should I make any other changes to the code?

greetings and thank you very much
(now copying the link I realized that one is for the 8266, the site doesn't say that. Anyway I tried the esp32 configuration and I couldn't get sounds)

tomco...@live.fr

unread,
Nov 21, 2024, 7:49:44 AM11/21/24
to Mozzi-users
Hi,

The pins for the I2S protocol are configurable and the default pins are in the page you linked ;) :

#define MOZZI_I2S_PIN_BCK ... // (default: 26)
#define MOZZI_I2S_PIN_WS ... // (default: 15)
#define MOZZI_I2S_PIN_DATA ... // (default: 33)
#define MOZZI_I2S_PORT ... // (default: I2S_NUM_0)

If you have a scope, you can check that some signals are actually outputted on these pins (WS is the easier to look at).
There is indeed a typo on the ESP8266 page, will be fixed soon!

Daniel Llermaly

unread,
Nov 22, 2024, 3:27:55 PM11/22/24
to Mozzi-users
Thank you very much for the answer!
I was able to get the esp32 working with pt8211 by changing
#define MOZZI_AUDIO_MODE MOZZI_OUTPUT_EXTERNAL_TIMED
#define MOZZI_AUDIO_CHANNELS MOZZI_STEREO
which appears in the example
by

#define MOZZI_AUDIO_MODE MOZZI_OUTPUT_I2S_DAC

guided by campidelli's project
and I managed to get the sinewave and the project I'm working on to sound!
The problem I have now is that it sounds extremely low.
The audio output I have is
return MonoOutput::fromAlmostNBit(14, (rf.next((volch*asigch*3)+(asigarp*(volarp)))));

I tried changing it to from16Bit and the volume is even lower
What am I doing wrong? Any suggestions would be greatly appreciated
regards

Daniel Llermaly

unread,
Nov 22, 2024, 3:29:07 PM11/22/24
to Mozzi-users
I forgot to say that in
fromAlmostNBit(14, (rf.next((volch*asigch*3)+(asigarp*(volarp)))));
if I put a number greater than 14 the glitch starts

the same project using the esp32 dac sounds much louder, without saturation

tomco...@live.fr

unread,
Nov 26, 2024, 3:27:49 AM11/26/24
to Mozzi-users
Hi,
What is the exact range of (rf.next((volch*asigch*3)+(asigarp*(volarp))))? Is it 14bits or less?

Also, the PT8211 does not output a lot (1.3V from memory, which is roughtly line level), so it really depends what you are doing with that signal (headphones? amp? loudspeakers?)

Best,
Reply all
Reply to author
Forward
0 new messages