About the length of I2S output of PI3...

Raspberry Pi related support

About the length of I2S output of PI3...

Postby andre_chang » 27 Aug 2018, 04:31

Hi
I found that the 44.1K 48K DATA data length is 16 bits. Can it be restored to the standard 32 bit length (plus 16 empty bits)?

Thank you
Andre
andre_chang
 
Posts: 84
Joined: 01 Feb 2016, 13:27

Re: About the length of I2S output of PI3...

Postby janui » 27 Aug 2018, 17:26

Hi andre_chang,

Yes. But not quite sure what you are trying to do.

Tell us: the type of Pi and image you are using, your DAC/audio card model and what you want to do.

Posting your debug also helps us to answer your questions.

janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: About the length of I2S output of PI3...

Postby hondagx35 » 27 Aug 2018, 21:40

Hi andre_chang,

Can it be restored to the standard 32 bit length

What standard you are talking about?

If your DAC needs a 32bit datastream MPD and ALSA will do bit stuffing (filling with zeros) on the fly for you.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: About the length of I2S output of PI3...

Postby andre_chang » 28 Aug 2018, 10:16

hi janui & frank:

Question 1:
I want to make a Pi2 or PI3 I2S adapter to output SPDIF signals. But...

After installing the rune system on pi2, I found out that when Rune played a 16 bit file, the length of the data frame was only 16 bits, and when it played 24 bits, it was 32 bits.
But on a volumio or moode system, the data length is 32bit...

Because SPDIF synthesis chip (such as WM8805) only supports 32bit data length.

When Rune plays 16bit music, can the length of data BCK data of I2S output 32bit?

How can I set the length of Rune if 32bit can be output?

Question two:
Can the run output SRC lock 44.1 Khz, or can the SPDIF always output 44.1 kHz regardless of the playback rate of 44.1 kHz to 384 khz?
If so, what should I do?

Rune beautiful voice surpasses other systems! I like it!

Andre
Attachments
pi2.jpg
pi2.jpg (112.92 KiB) Viewed 1776 times
24bit.jpg
24bit.jpg (64.09 KiB) Viewed 1776 times
16bit.jpg
16bit.jpg (61.88 KiB) Viewed 1776 times
andre_chang
 
Posts: 84
Joined: 01 Feb 2016, 13:27

Re: About the length of I2S output of PI3...

Postby R101 » 28 Aug 2018, 10:50

andre_chang,

I think the slot length will be decided by the driver. You might find it easier to use a USB to s/pdif interface, or a s/pdif HAT with its own driver.
(Pi 3B, rAudio-1, JLS I2S over USB)
R101
 
Posts: 343
Joined: 29 Apr 2016, 16:16

Re: About the length of I2S output of PI3...

Postby janui » 28 Aug 2018, 12:05

Hi andre_chang,

I think you first need to experiment with a few settings in order to determine how you want to set this up. After deciding on the set-up, we can help you automate setting these values.

    1. 24le (24 bit little endian) is always (at least on the Pi with MPD) encoded as zero filled 32le.
    2. For reference see this document: https://www.musicpd.org/doc/html/user.h ... figuration
    3. To make all output from MPD 32 bit (zero filled if required) you need to modify the relevant audio_output block of /etc/mpd.conf. The audio_output block looks something like this:
    Code: Select all
    audio_output {
        type "alsa"
        name "my ALSA device"
        device "hw:0"
    }
    You need to add a format clause 'format "*:32:*"', this means: "any bitrate : always 32 bit : any number of channels". The modified audio_output block will look something like this:
    Code: Select all
    audio_output {
        type "alsa"
        name "my ALSA device"
        device "hw:0"
        format "*:32:*"
    }

    4. To additionally make all output from MPD 44.1Khz again the fomat clause is used, this time with a value of 'format "44100:32:*"', this means: "always 44100hz : always 32 bit : any number of channels". The modified audio_output block will look something like this:
    Code: Select all
    audio_output {
        type "alsa"
        name "my ALSA device"
        device "hw:0"
        format "44100:32:*"
    }
    If the audio source is not 44.1Khz MPD will automatically carry out resampling, this will always reduce your sound quality. Using SoXr as resampler plugin gives reasonable results, much better than the built-in MPD resampler. Look at the documentation and listen to the results. This may not give you the quality which you expect.

To automatically set these parameters in Rune we will need to know the type of audio card which you are (or will be) using. Let us know what this is.

janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: About the length of I2S output of PI3...

Postby andre_chang » 28 Aug 2018, 13:10

Hi janui:

We can set up HiFiBerry DAC in CONFIG.TXT.
The conversion chip will use WM8805 to output SPDIF signal ~

Do you have steps to install SOXr plug-ins and enable them?

Thank you!

andre
andre_chang
 
Posts: 84
Joined: 01 Feb 2016, 13:27

Re: About the length of I2S output of PI3...

Postby janui » 28 Aug 2018, 14:27

Hello andre_chang,

MPD needs to be built with the SoXr option to be able to use it. Look at the results of:
Code: Select all
mpd --version
It is included if you see this, or something similar:
Code: Select all
...
Filters:
 libsamplerate soxr
...
You should look for the word ‘soxr’, it may be in a different section depending upon the version which you are using. If it is not there MPD will need to be upgraded. I have a couple of pre-built versions which you may be able to use, please tell me the version number which you are currently using.
Swtching SoXr on is dependant on the version of MPD. For v0.19.xx the following line needs to be included in /etc/mpd.conf :
Code: Select all
samplerate_converter “soxr very high”
For v0.20.xx this needs to be added to /etc/mpd.conf :
Code: Select all
resampler {
  plugin "soxr"
  quality "very high"
}

MPD will fail to start if you set Soxr ON when it is not built in.

See the following post for modifying the file /srv/http/db/redis_acards_details file. This is a way of automatically adding the ‘format’ output_block clause for the Hifiberry DAC: post24782.html?hilit=sabre%20janui#p24782

We need Franks help to do the same for your WM8805.

janui
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: About the length of I2S output of PI3...

Postby andre_chang » 29 Aug 2018, 05:13

hi janui:
Attachments
ALSA.jpg
ALSA.jpg (154.58 KiB) Viewed 1727 times
andre_chang
 
Posts: 84
Joined: 01 Feb 2016, 13:27

Re: About the length of I2S output of PI3...

Postby janui » 29 Aug 2018, 10:10

Hi andre_chang,

For your I2S testing I suggest that you use the hifiberry dac overlay.

Run these commands to automatically add the 'format "*:32:*"' clause to the audio_output block for the hifiberry dac:
Code: Select all
sed -i -e '/snd_rpi_hifiberry_dac/s/)","hwplatformid":/)","card_option":"format\\t\\"*:32:*\\"","hwplatformid":/' /srv/http/db/redis_acards_details
redis-cli del acards
php /srv/http/db/redis_acards_details
Then select the hifiberry dac overlay (this depends on the image which you are using: via the Settings IU or by editing /boot/config.txt) and then reboot.

You will then see that /etc/mpd.conf contains the format clause. To activate it, you will need to select the audio output via the MPD UI.

janui

PS look here for an explanation of what the sed command is doing: post24782.html?hilit=sabre%20janui#p24782
User avatar
janui
 
Posts: 704
Joined: 20 Dec 2014, 12:55
Location: Ollanda

support RuneAudio Donate with PayPal

Next

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 14 guests