confusion in which stream to call for RP2040 #20
Replies: 9 comments 2 replies
-
I attempted to use similar code but with this gave me errors and did not work |
Beta Was this translation helpful? Give feedback.
-
i think part of my confusion comes because there are examples in the audio tools and in the audio drivers folder. I am not sure WHICH one has been redacted etc. there are different examples on the wiki page for each one and they explain different ways to call the I2s driver. so the more I read the documents the more I am confused about which is the proper way for the RP2040 to call the driver I have added #define RP2040_HOWER to my code as well |
Beta Was this translation helpful? Give feedback.
-
thanks for any clarification on how to call the I2s driver from the pico (using the pinout for the pcm5102 which you specified on your page) |
Beta Was this translation helpful? Give feedback.
-
; PlatformIO Project Configuration File [env:pico] |
Beta Was this translation helpful? Give feedback.
-
https://github.com/pschatzmann/arduino-audio-tools/wiki/Supported-Architectures The RP2040 has no DAC, so you need to use an external DAC via I2S or use PWM. I also recommend to work with Earl Phil Howers Arduino Core. In Arduino this should just work. I never tried this for the RP2040 on PlatformIO, so you are on your own... |
Beta Was this translation helpful? Give feedback.
-
yes sorry i thought. mentionedi hooked up the dac you recommmended the pcm5102 |
Beta Was this translation helpful? Give feedback.
-
https://github.com/pschatzmann/arduino-audio-tools/wiki/Working-with-PlatformIO |
Beta Was this translation helpful? Give feedback.
-
I am having no issue getting other pico code to work in platform Io and I was also using platform IO for the ESP32 code I was using yesterday. The code is loading fine etc. which is what makes me wonder if my code itself is suspect is this the correct way (if i have the Dac connected) to call the i2s Dac ? typedef int16_t sound_t; // sound will be represented as int16_t (with 2 bytes) |
Beta Was this translation helpful? Give feedback.
-
I will try the code in arduino as well but just wanted to make sure I was not defining the i2s stream incorrectly for pico |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
yesterday I got sound working without issue (and no compilation issues either )using an esp32. however I also want to use the audio tools library with the rp2040 but I must admit I am confused as there are various documents (some older some newer) which seem to recommend different ways of calling the driver.
I want to use the pcm5102 with the rp2040.
the code I got to work on the esp32 was this`/**
**/
#include <Arduino.h>
#include "WiFi.h"
#include "AudioTools.h"
#include "AudioLibs/AudioSTK.h"
#include "AudioLibs/AudioBoardStream.h"
typedef int16_t sound_t; // sound will be represented as int16_t (with 2 bytes)
AudioInfo info(44100,1, 16);
Sitar instrument(10);
STKStream in(instrument);
AnalogAudioStream out;
StreamCopy copier(out, in); // copies sound into i2s
// Arduino Setup
void setup(void) {
// Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
// Serial.println("starting STK...");
auto cfgSTK = in.defaultConfig();
cfgSTK.channels = 1;
in.addNotifyAudioChange(out);
in.begin(cfgSTK);
// instrument.noteOn(440, 0.5);
}
// Arduino loop - copy sound to out
void loop() {
instrument.pluck(1.0 );
instrument.noteOn(190, 0.9);
instrument.noteOn(3490, 0.7);
delay(100);
copier.copy();
instrument.pluck(0.1);
instrument.noteOn(1200, 0.9);
instrument.noteOn(890, 0.7);
copier.copy();
}`
Beta Was this translation helpful? Give feedback.
All reactions