Getting started with generated audio

scotthauck
Posts: 20
Joined: Fri Jul 26, 2019 5:50 pm

Getting started with generated audio

Postby scotthauck » Mon Sep 21, 2020 8:20 pm

I've been using the ESP32 via the Arduino software for a while (ported an existing codebase from another Arduino board), and have some questions on how to start doing some audio generation within my overall design. These are "ADF newbie" questions.

I'm using the Adafruit Feather Huzzah32, and ideally would stay with that platform, since I've got a bunch, and understand it pretty well. I'd like to do mostly generative audio instead of playback of recorded sounds, but may move to some playback as needed - short samples. I'm basically adding motor sounds and the like to simple toys, so I could imagine having a quick canned sample for the motor start-up, then do the engine idle, rev., etc. via generative. These should be battery powered, and small.

My questions:
(1) I'm assuming the best approach is a i2s card and hook it to the feather. Then hook that to a small speaker. Issues? The Adafruit stereo board (UDA1334A) seems reasonable for this, or their mono (MAX98357A) which is sold out...
(2) I'll mostly do mono, but could imagine going to 2, or at most 4, speakers. If I am doing 4 speakers, is that 2 i2s connections, or does each i2s support only one speaker?
(3) For this type of application, should I be using ADF, or is generated audio not really the right fit for this? And will ADF force me to move to the IDF instead of the Arduino flow?
(4) If generative audio works within ADF, is there a good example to start from?

Thanks!

ESP_Sprite
Posts: 9761
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting started with generated audio

Postby ESP_Sprite » Tue Sep 22, 2020 9:04 am

For high-quality audio, you'd indeed want to use an I2S board. If 8-bit sound is enough for you, the ESP32 does have 2 internal DACs that can be used as I2S 'outputs' but obviously audio quality is limited.
It kind-of depends on your preference if you want to use ADF or have your own framework on IDF... if you already have a good mixer pipeline and your samples are small enough that you don't need a MP3 decoder, foregoing ADF may be the better way. If you're planning on diving into the ADF ecosystem anyway, you can use this as a trial project as well, however.
I2S is stereo, so each I2S peripheral can drive 2 speakers at max. As you have 2 I2S peripherals, you can drive 4 speakers in total (without hacks).

scotthauck
Posts: 20
Joined: Fri Jul 26, 2019 5:50 pm

Re: Getting started with generated audio

Postby scotthauck » Tue Sep 22, 2020 8:18 pm

Thanks for the response. I don't have anything I'd call a pipeline yet - I've got DAC to a piezoelectric buzzer that is good enough, but too quiet, for my first application.

I don't think I'll go that deeply into any of the sound side, but if I can do generative sound in ADF that may be where I'll look.

Any good pointers to examples of ADF-based generative audio, or any good newbie tutorials for ADF?

ESP_Sprite
Posts: 9761
Joined: Thu Nov 26, 2015 4:08 am

Re: Getting started with generated audio

Postby ESP_Sprite » Wed Sep 23, 2020 10:00 am

Not sure - I'm personally not that familiar with ADF and my existing knowledge is pretty old by now - but I imagine you can create a source (same idea as a microphone) that can generate it's own audio instead.

rglissmann
Posts: 10
Joined: Wed Feb 19, 2020 1:08 am

Re: Getting started with generated audio

Postby rglissmann » Wed Sep 23, 2020 5:57 pm

The MP3 examples of the flash and SD card storage in the player directory work well. If your sounds are less than 3MB, the flash implementation will be less hardware. I use the MAX98357 and it sounds great. It is available on Amazon and ebay. ADF is powerful but Espressif should provide more documentation to shorten the learning curve.

Who is online

Users browsing this forum: No registered users and 10 guests