Audio Tools- Getting Pico working with an i2s dac using Platform IO #1415
Replies: 6 comments 1 reply
-
and here is the exact board info file i used _ |
Beta Was this translation helpful? Give feedback.
-
this was with the PCM5102 Dac module |
Beta Was this translation helpful? Give feedback.
-
Shouldn't you just better follow the official instructions ? |
Beta Was this translation helpful? Give feedback.
-
I am not going to worry about it. I spent 8 hours trying to get it to work and only found relief once i read that github thread. the good news it now works very well. |
Beta Was this translation helpful? Give feedback.
-
please keep in mind the way they had it in the offical instructions DID NOT WORK for me. it was only once i changed it to the way they had it in the github thread that it worked. however (and i can test this tomorow) IT Could also be because I added the logger line with ERROR instead of warning (which is what the original poster was talking about) sorry by this point I am a bit exhausted |
Beta Was this translation helpful? Give feedback.
-
thanks so much |
Beta Was this translation helpful? Give feedback.
-
I am putting this here for others who want to try using the RP2040 with Platoform IO and Arduino-Audio tools.
i was struggling with getting the Dac to work UNTIL i found this thread
earlephilhower/arduino-pico#1656
after reading through the thread I was able to get sound working here is the working code for a sine generator
`
/**
**/
#include <Arduino.h>
#include <I2S.h>
#include "WiFi.h"
#define LED_PIN 25
#include "AudioTools.h"
#include "AudioLibs/AudioSTK.h"
#include "AudioLibs/AudioBoardStream.h"
AudioInfo info(44100, 1, 16);
int16_t sine_array[] = {0, 4560, 9031, 13327, 17363, 21062, 24350, 27165, 29450, 31163, 32269, 32747, 32587, 31793, 30381, 28377, 25820, 22761, 19259, 15383, 11206, 6812, 2285, -2285, -6812, -11206, -15383, -19259, -22761, -25820, -28377, -30381, -31793, -32587, -32747, -32269, -31163, -29450, -27165, -24350, -21062, -17363, -13327, -9031, -4560 };
GeneratorFromArray<int16_t> sineWave(sine_array,0,false);
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
I2SStream out;
StreamCopy copier(out, sound); // copies sound into i2s
// Arduino Setup
void setup(void) {
// Open Serial
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Error);
// start I2S
I2SConfig i2sconfig = out.defaultConfig(TX_MODE);
i2sconfig.buffer_count = 5;
i2sconfig.buffer_size = 512;
i2sconfig.pin_bck = 27;
i2sconfig.pin_data = 26;
i2sconfig.pin_ws = 28;
out.begin(i2sconfig);
// Setup sine wave
sineWave.begin(info);
Serial.println("started...");
}
// Arduino loop - copy sound to out
void loop() {
copier.copy();
}
`
Beta Was this translation helpful? Give feedback.
All reactions