Streaming Bluetooth audio to internal DAC and external I2S DAC at the same time #318
-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
I am not sure what you mean with lights ? I don't think that this is an issue but rather a discussion, so I convert it... |
Beta Was this translation helpful? Give feedback.
-
Yes that's exactly what I want to do! |
Beta Was this translation helpful? Give feedback.
-
You would use the callback described in 'Accessing the Sink Data Stream with Callbacks'. From that you would analyse the data by calculating a max value (or avg) over a range to use as volume. Then you would translate the volume into into a range between 0 and 254 and use an analogWrite() to output to the LED. If you want to minimize the lines of code you can also use the AudioTools library and just write to the VolumePrint audio sink and get the volume from there... I suggest that you have a look at the following examples to get you started: |
Beta Was this translation helpful? Give feedback.
-
But to be clear, it's not possible to output to the internal DAC and an external DAC (or, an external one over i2s), because i2s requires the internal DAC pins as part of its protocol... right? |
Beta Was this translation helpful? Give feedback.
-
If you mean the Analog Output via I2S, sure you can: the only restriction is that the internal dac pins are fixed and must use port 0 for it. But I would not use the audio output, but just some regular analogWrite() for this purpose. |
Beta Was this translation helpful? Give feedback.
You would use the callback described in 'Accessing the Sink Data Stream with Callbacks'. From that you would analyse the data by calculating a max value (or avg) over a range to use as volume. Then you would translate the volume into into a range between 0 and 254 and use an analogWrite() to output to the LED.
If you want to minimize the lines of code you can also use the AudioTools library and just write to the VolumePrint audio sink and get the volume from there...
I suggest that you have a look at the following examples to get you started: