r2r sink #1675
-
is there any any examples on how to use audiotools with a crude 8bit r2r dac on a arduino on a stm32? |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 2 replies
-
No, I think the quality would be too bad. What Micocontroller do you plan to use? |
Beta Was this translation helpful? Give feedback.
-
stm32 blackpill F4 variant, i got your snapclient working on it with ethernet, |
Beta Was this translation helpful? Give feedback.
-
As far as I know, the blackpill does not have any DAC, but you can still use PWM which should give a better audio quality then your 8 step r2r. ps. I2S should work as well... |
Beta Was this translation helpful? Give feedback.
-
sadly the above code as is throws this error. /tmp/.arduinoIDE-unsaved2024723-28154-1voj54y.090d/sketch_aug23f/sketch_aug23f.ino:7:1: error: 'PWMAudioStream' does not name a type exit status 1 Compilation error: 'PWMAudioStream' does not name a type |
Beta Was this translation helpful? Give feedback.
-
any chance of any pointers to do this r2r dac thing even though its a bad idea, i spent a day populating a vero board with resistors with my daughter and just want to show it off doing something useful, :) |
Beta Was this translation helpful? Give feedback.
-
This should be quite easy to implement: Define your own output class or use a CallbackStream and define the write callback. Write the data into a buffer and output the data with an AudioTimer: There you just map the input values to your pins. If your input provides stereo data you need to convert it to mono first or you need to use a second ladder. I can't reproduce your issue with the PWMAudioStream: what Board Part Number did you select ? I tried with Blackpill401CC, Blackpill401CE and Blackpill411CE. For some I needed to uncomment the USE_I2S in AudioConfig.h |
Beta Was this translation helpful? Give feedback.
-
I have added a DRAFT implementation: I let you test and debug it... |
Beta Was this translation helpful? Give feedback.
-
i seem to be hitting this error /home/gatekeeper/Arduino/libraries/stm32-i2s/src/stm32-i2s.h:131:20: error: 'STM_I2S_PINS' was not declared in this scope |
Beta Was this translation helpful? Give feedback.
-
its building fine if i disable i2s following the discussion we had pschatzmann/arduino-snapclient#34 |
Beta Was this translation helpful? Give feedback.
-
an example of how you would do r2r in a sketch would be fantastic |
Beta Was this translation helpful? Give feedback.
-
It's basically like any other output class: The only special thing you need to do is to define the channel1_pins in the configuration for mono or channel1_pins and channel2_pins for stereo. It's up to you how many pins you want to use... // start
auto config = out.defaultConfig();
config.copyFrom(info);
config.channel1_pins = {10,11,12,13,14,15,16,17};
if (!out.begin(config)){
Serial.println("error");
while(true);
}
I am not sure about the max sample rate that will work since this is limited by the speed of digitalWrite() |
Beta Was this translation helpful? Give feedback.
-
i cant seem to get sound output from the snapclient into this new lovely lib you written, ? |
Beta Was this translation helpful? Give feedback.
-
You need to do some proper testing with some simple test sketches first:
After you confirmed that the voltages are right you can start with a sine test case and a min sample rate of 8000 and increase the sample rate to determine the max supported rate |
Beta Was this translation helpful? Give feedback.
-
iv just crudely measured with my multimeter. and all seems well, from what i can hear and measure crudely with my multimeter this is producing tones and working fine with the various tests you suggested. |
Beta Was this translation helpful? Give feedback.
-
So, if you connect the DAC to some earphones and use the sine test output sketch; |
Beta Was this translation helpful? Give feedback.
-
on my particular blackpill board its maxing out at 10000 unless i am
mistaken
…On Wed, Aug 28, 2024 at 3:27 AM Phil Schatzmann ***@***.***> wrote:
So, if you connect the DAC to some earphones and use the sine test output
sketch;
What is the max sample rate that still works ?
—
Reply to this email directly, view it on GitHub
<#1675 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACDX5W63DXN3SRB52J7MEX3ZTUYR3AVCNFSM6AAAAABNAG5IHGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBWHE2DCNQ>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/1675/comments/10469416@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
audio-tools now has a r2r driver! thanks! |
Beta Was this translation helpful? Give feedback.
No, I think the quality would be too bad.
You can try to use the internal Dac or Pwm instead.
What Micocontroller do you plan to use?