Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio_i2s.pio comment regarding FIFO word reverses channels #59

Open
rde2 opened this issue Mar 4, 2023 · 1 comment
Open

audio_i2s.pio comment regarding FIFO word reverses channels #59

rde2 opened this issue Mar 4, 2023 · 1 comment

Comments

@rde2
Copy link

rde2 commented Mar 4, 2023

The comment in audio_i2s.pio explaining the word format reverses the 'ws' (LRCLK) value. The PIO sends the first (most significant) 16 bits with LRCLK = 1 and the second with LRCLK = 0. For stereo samples the second 16-bit half in memory corresponds to bits 31:16 and hence is the right channel (assuming I2S where LRCLK = 0 for left).

; Autopull must be enabled, with threshold set to 32.
; Since I2S is MSB-first, shift direction should be to left.
; Hence the format of the FIFO word is:
;
; | 31   :   16 | 15   :    0 |
; | sample ws=0 | sample ws=1 |
@rde2
Copy link
Author

rde2 commented Mar 7, 2023

I believe that I2S requires the left channel to be sent before the right, so playback may be out of sync. See the thread https://forums.raspberrypi.com/viewtopic.php?p=2087056#p2087056 for a discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant