Milk-V Duo S - How to use audio?

Hi. I am interested in purchasing the Duo S, for use with my speakers. However, I am not too clear on how the audio works.

The website mentions “Audio via GPIO” - but what does this mean? Do I need to rely on some kinda I2S audio - and hence need to use a DAC on top?

The pinout seems to imply that there are 4 pins of R/L audio on pin 51/49/47/45

can I just, as an example, cut of an earphone and hook it up to audio out and in? Sorry if this is a very stupid question, I’m just not too familiar with low-level audio.

Thanks

1 Like

The SG2000 SoC used in the Duo S does indeed have a built in audio codec and the audio drivers are not hard to enable - it does require fiddling with the kernel configuration and adding ALSA tools to the buildroot configuration however, so it’s not something that works “out of the box”. Additionally, the signal levels on the GPIO pins are going to be raw line-level with a DC offset, so you’ll need some external passive circuitry to interface with standard audio devices. If you want to drive speakers you’ll need an amp too. [NOTE - I don’t have a Duo S yet but I have been successful at getting the internal codec working on the smaller 64MB Duo]

2 Likes

Thanks for the reply. Can you comment a bit on this - what are some terms I should google for to figure out more about this thing and how to implement it? (and/or if there are premade boards that do this sort of thing).

I’ve a MAX 98357 lying around, but I think that is not relevant if the signal is already analog.

The audio output on my Duo 64 has about 1V DC offset with a full-scale amplitude of about 2Vpp. To connect this to an external line input of an amplifier you’ll want to put in a series DC blocking capacitor - a suggested circuit from another codec is attached here:

You’re correct that the MAX98357 is not an appropriate part for this application - it takes a digital I2S input, not the analog levels provided by the Duo S.

1 Like

Thanks a lot for the detailed response. If I end up trying this out I’ll post my results here.

2 Likes

Cool. I’ve got a Duo S coming and will be trying some things out for myself. Will report back here…

1 Like

Hey, i have the DuoS and installed LMS server 9.0 [LMS 9.0](Getting Started with LMS - Lyrion Music Server) on it. The DuoS now serves my music collection to my RPI3 running Squeezelite connected to my audio. Next step would be to install Squeezelite on the DuoS itself and set the output to the USB port. The USB port , i attach a USB DAC dongle to connect to my audio. I hav troubles activating the USB port and setting the output of Squeezelite to the USB. I can start Squeezelite, but i cant set the output to USB:: . Ideas ?

1 Like

You may need to reconfigure buildroot to include ALSA userland utilities and libraries. Without those I’d guess that Squeezelite won’t be able to talk to the USB Audio device even if it’s present.

1 Like

Using the latest image from the Debian Thread in this forum ,
i managed to install on the DuoS

  1. Logitech Media Server to connect to my NAS and access my music (nfs).
  2. Squeezeplayer to play the music (apt install squeezelite)
  3. Install bluez-alsa to connect my duoS BT to my BT headphone.
  4. Set the output device to bluealsa. : $ squeezelite -o bluealsa

Ace in the hole! Interface working snappy, no lagging, music sounds good.
My battery pack can play 20 hours and more. Nice.
This is a work in progress. What i like to do further is
a. add LDAC en Aptx to the BT codec.
b. make startup scripts to start LMS server and SQplayer on boot.
c. Move squeezelite to the RTOS core.
d. use an USB DAC dongle on USB-A port instead of the BT.
(e. use I2s to connect a HAT to the duoS)

A variant could be to install only spotify-connect and set the output to bluealsa.

(If somebody is interested, i could use some help in testing, automating and documenting this. I’m new to this, so i installed to much packages … )

Got a Duo S today. Installed the Duo S SD V1.1.0 image from the github site and booted it up. The on-chip codec drivers are already in the kernel but ALSA utils & libs are not included in the buildroot configuration. I copied the utils, libs and shared data over from another system I built earlier and it all worked fine from the dedicated audio I/O pins on the J4 header.

2 Likes

Cool, so you basically ended up doing what you mentioned in the first reply?

1 Like

Actually, in the first reply I overestimated the effort required - I didn’t have to rebuild the kernel to enable the audio drivers - the audio ADC and DAC were already in the kernel and merely needed the proper ALSA userspace utilities to feed them. I grabbed some existing alsa stuff (cmd line progs, libs & shared data) from a buildroot I’d done earlier, copied them into the right places in the SD card filesystem and things “just worked”. If we had a nice package system that would have been super easy to bring up but as it stood I just unzipped some files into the proper directories.

2 Likes

Has anyone looked into doing audio from the RTOS core?

1 Like