chuckkh
Posts: 54
Joined: Fri Apr 01, 2016 8:03 am

Re: The I2S sound thread.

Wed May 04, 2016 2:33 pm

Orbital6 wrote: How are you certain it's playing it too fast? If you feed it ten seconds of data, how many seconds does it play? OR is it 10 seconds but higher pitched?

If you play back audio via the i2s 'sound card' at a sample rate that's different to the source, then you will get a lower or higher frequency playback, it may or may not be your issue.

I'd also find a way of being certain of your BCLK frequency - look at the datasheet for your chip (same chip as the teensy audio right?) and make sure you're following it's recommendations. Are you just using the teensy audio board? Or your own sgtl5000 setup?
Well, yes, if I make a 10-second stereo track of A440 in Audacity, it plays in around 8 seconds and the tone is close to the D above A. It is a Teensy Audio Adapter. I copied all of the power settings from the Teensy library, but with different timing settings. But whether it's timing master or slave, it plays the same speed.
The thing is that I have complete control over what the codec is doing; that is the only part that is well-documented. I am following its recommendations as far as the settings I send to it, but my problem is that I don't know what settings ALSA is using. I do see that, if I play this A440 at 48k, 24 bit depth,

Code: Select all

cat /proc/asound/card0/pcm0p/sub0/hw_params
tells me that the samples are s32_le! But if I set up the Teensy/SGTL5000 to read 32-bit samples, it sounds the same.
It's ironic, when I started using Debian, suggesting that things could be more automatic was enough to get you banned from some forums and IRC channels, but now the problem is that I don't want all of this automatic default business, I just want to specifically tell my RPi what format to write. I'd use bare metal except that I need to run some synth or sampler software.
Again, I don't know where ALSA is choosing its seemingly arbitrary sample rates and formats, but none of the possible combinations the SGTL5000 is capable of make the sound come out at the right speed!

-Chuckk

EDIT: P.S. I ordered two different crystal oscillators to try, expecting them about tomorrow. Maybe the problem is simply that the RPi oscillator is not giving me 9.6 MHz but something faster??

chuckkh
Posts: 54
Joined: Fri Apr 01, 2016 8:03 am

Re: The I2S sound thread.

Wed May 04, 2016 4:10 pm

Wow, 1-day delivery from the UK to Romania with Farnell!
My timing problem is NOT due to the oscillator. I hooked up an external 12.288 MHz crystal oscillator as master clock, changed the SGTL5000's settings accordingly, disconnected the GPIO clock signal from the RPi, and have the exact same playback speed, about 130% of what it should be.
My problem is definitely software, and I can't think of any other explanation than that I'm using a generic simple card driver and I don't know how or where it decides what sample rates and formats to use.

-Chuckk

Orbital6
Posts: 138
Joined: Sat Aug 08, 2015 6:32 pm

Re: The I2S sound thread.

Wed May 04, 2016 5:04 pm

chuckkh wrote:Wow, 1-day delivery from the UK to Romania with Farnell!
My timing problem is NOT due to the oscillator. I hooked up an external 12.288 MHz crystal oscillator as master clock, changed the SGTL5000's settings accordingly, disconnected the GPIO clock signal from the RPi, and have the exact same playback speed, about 130% of what it should be.
My problem is definitely software, and I can't think of any other explanation than that I'm using a generic simple card driver and I don't know how or where it decides what sample rates and formats to use.

-Chuckk
You're using a command like:

Code: Select all

arecord -D hw:1,0 -t wav -c 2 -d 25 -r 64000 -f S16_LE wav.wav
Where -r is the source sample rate?

chuckkh
Posts: 54
Joined: Fri Apr 01, 2016 8:03 am

Re: The I2S sound thread.

Thu May 05, 2016 9:48 pm

Orbital6 wrote: You're using a command like:

Code: Select all

arecord -D hw:1,0 -t wav -c 2 -d 25 -r 64000 -f S16_LE wav.wav
Where -r is the source sample rate?
No, I'm trying output. I've been using Audacity, which I have set to 48k / 24 bits, checked the project that it complies with this.
I will try telling bcm2835-i2s that the card only accepts S24_LE and 48k (I finally figured out where that occurs on my own, after some days of searching), and I will set the bclk ratio to 64, as the codec will be the timing master, so it needn't be a multiple of 19.2 MHz, and recompile it.

Alas, I'll have to do that later, as my Pi has suddenly decided to stop connecting to my WiFi network and I can't control it from my laptop. None of the standard configuration tips, including the ones I used at the beginning, work to convince it. I predict about 5 days to work through this new problem, then I'll let you know how my I2S plan works!

-Chuckk

chuckkh
Posts: 54
Joined: Fri Apr 01, 2016 8:03 am

Re: The I2S sound thread.

Tue May 10, 2016 8:00 am

My Pi is back in commission.
I still have this problem, though, despite recompiling the I2S driver to only use 1 sample rate and 1 bit depth. I believe I'm giving up on it. I'm working on an embedded project and I don't need general-purpose; I don't want to watch videos or listen to my favorite songs on my Pi, I want to use it to create musical notes when I tell it to, to be sent to an external amp or mixer.

So, having done some reading, I believe it will be easier for me to manually write the appropriate registers according to the ARM peripherals datasheet, which already has I2S implemented and *explicitly documented*. No? I have to check, that may have been talked about in this very thread. It means lots of manual hex notating, but it's all very explicit, at least the I2S/PCM part, if not the GPU. Csound has a straightforward API, and the basic example of how the Csound executable actually runs contains all but the part of accessing the audio output buffer, which is trivial, and then I should be able to simply write that to the address of the ARM FIFO... right?

That's some programming, but I believe it will be less wading through code than trying to write an ALSA driver.

-Chuckk

Orbital6
Posts: 138
Joined: Sat Aug 08, 2015 6:32 pm

Re: The I2S sound thread.

Tue May 10, 2016 10:02 am

Can you upload a clip of how the audio sounds?

chuckkh
Posts: 54
Joined: Fri Apr 01, 2016 8:03 am

Re: The I2S sound thread.

Tue May 10, 2016 6:31 pm

Orbital6 wrote:Can you upload a clip of how the audio sounds?
Well, upload, no, I can't, but I can link to one. There's a link in the first post in this thread:
viewtopic.php?f=44&t=147516

Under "A 440 played fast on RPi codec:"

I swear the crackling is periodic, and must be something being dropped, possibly different sections of bytes, but no settings I have available on the audio chip make it go away, and I still believe I'll get it right faster without ALSA. Any ideas?

-Chuckk

rufus.x.sarsaparilla
Posts: 4
Joined: Thu May 12, 2016 12:38 am

Re: The I2S sound thread.

Thu May 12, 2016 1:28 am

By "bare metal", do you mean that you would literally use no OS at all? If I don't need to run synth/sampler software, is that the way to go? I want to turn my RPI into a special kind of "realtime" synth at standard 44.1 kHz/16-bit resolution, producing as few samples as possible at a time. Can I handle interrupts at the user level, or would I need to be hacking the kernel? I would expect the DAC to drive my generation of samples. Obviously, I don't want to code at a lower level than is necessary, especially for an initial "proof-of-concept". It would be nice to start, at least initially, with Raspbian sans GUI. I'm not sure I'm up to bare metal, but then again most services, including display, filesystem, etc, would not be useful for the final product, and would probably be in the way. Any advice on where to start? Thanks.

[quote="chuckkh"][quote="Orbital6"]

I'd use bare metal except that I need to run some synth or sampler software.
Again, I don't know where ALSA is choosing its seemingly arbitrary sample rates and formats, but none of the possible combinations the SGTL5000 is capable of make the sound come out at the right speed!

-Chuckk

jayeye
Posts: 1
Joined: Tue Mar 31, 2015 8:08 pm

Re: The I2S sound thread.

Tue May 17, 2016 4:35 am

Yes, I have waded through the 700-odd messages of this thread; still can't figure out why I am unable to use I2S microphones on the Pi. Here is the question (with 50 bounty) on stack exchange:

http://raspberrypi.stackexchange.com/qu ... pi-2-and-3

Help?

Thanks

alaimodiloro
Posts: 2
Joined: Wed Feb 03, 2016 8:22 am

Re: The I2S sound thread.

Wed May 25, 2016 8:43 am

Hello,
is it possible to set the driver to understand bclk of 128fs instead of the default 64fs? my ADC only supports 128fs the rpi is configured as clock slave.
thanks in advance,
Alex

squerut
Posts: 2
Joined: Sat May 28, 2016 6:58 am

Re: The I2S sound thread.

Sun May 29, 2016 9:56 am

I have a Raspberry Pi 3 and a Teensy 3.2. I would like to connect them through i2s interface.
The idea is that Teensy 3.2, as master, capture sounds with an analog microphone (Adafruit AGC Electret Microphone Amplifier - MAX9814) and send that to Raspberry, as slave.
I've successfully compiled and loaded the audio Module but when I try to record audio on Raspberry i2s interface the result is a mute wav file. I think sound is collected correctly by Teensy (I've tested Teensy ADC with a Testing Hardware Audio Example).
More details:
- Raspberry Pi 3 with Raspbian. The kernel version is 4.4.9-v7
- In /boot/config.txt -> dtparam=i2s=on
- Here is the module my_loader.c I compiled

Code: Select all

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/platform_device.h>
#include <sound/simple_card.h>
#include <linux/delay.h>

void device_release_callback(struct device *dev) { /* do nothing */ };

static struct asoc_simple_card_info snd_rpi_simple_card_info = {
.card = "snd_rpi_simple_card", // -> snd_soc_card.name
.name = "simple-card_codec_link", // -> snd_soc_dai_link.name
.codec = "snd-soc-dummy", // "dmic-codec", // -> snd_soc_dai_link.codec_name
.platform = "3f203000.i2s",
.daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM,
.cpu_dai = {
.name = "3f203000.i2s", // -> snd_soc_dai_link.cpu_dai_name
.sysclk = 0 },
.codec_dai = {
.name = "snd-soc-dummy-dai", //"dmic-codec", // -> snd_soc_dai_link.codec_dai_name
.sysclk = 0 },
};
static struct platform_device snd_rpi_simple_card_device = {
.name = "asoc-simple-card", //module alias
.id = 0,
.num_resources = 0,
.dev = { .release = &device_release_callback,
.platform_data = &snd_rpi_simple_card_info, // *HACK ALERT*
},
};

int hello_init(void)
{
const char *dmaengine = "bcm2708-dmaengine"; //module name
int ret;

ret = request_module(dmaengine);
pr_alert("request module load '%s': %d\n",dmaengine, ret);
ret = platform_device_register(&snd_rpi_simple_card_device);
pr_alert("register platform device '%s': %d\n",snd_rpi_simple_card_device.name, ret);

pr_alert("Hello World :)\n");
return 0;
}
void hello_exit(void)
{// you'll have to sudo modprobe -r the card & codec drivers manually (first?)
platform_device_unregister(&snd_rpi_simple_card_device);
pr_alert("Goodbye World!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_DESCRIPTION("ASoC simple-card I2S setup");
MODULE_AUTHOR("Plugh Plover");
MODULE_LICENSE("GPL v2");
- After sudo insmod my_loader.ko command, dmesg:

Code: Select all

...
[ 1486.426866] request module load 'bcm2708-dmaengine': 0
[ 1486.428639] register platform device 'asoc-simple-card': 0
[ 1486.430359] Hello World :)
[ 1486.434468] snd_soc_simple_card: unknown parameter 'index' ignored
[ 1486.437319] asoc-simple-card asoc-simple-card.0: snd-soc-dummy-dai <-> 3f203000.i2s mapping ok
- the pins mapping between Teensy 3.2 and Raspberry Pi 3

Code: Select all

Teensy --> Raspberry
Pin 9 - BCLK --> Pin 12 - CLK
Pin 11 - MCLK --> NONE
Pin 22 - TX --> Pin 38 - DIN
Pin 23 - LCRLK --> Pin 35 - FS
- when I put arecord - l command

Code: Select all

**** List of CAPTURE Hardware Devices ****
card 0: sndrpisimplecar [snd_rpi_simple_card], device 0: simple-card_codec_link snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
- the command I used to record is

Code: Select all

arecord -D hw:0,0 -t wav -c 2 -d 5 -r 44100 -f S16_LE sound.wav
I don't understand what is going wrong (connection between boards? wrong settings in audio module?) because the result is a non null audio sound.wav file; but when I try to listen it the result is a 5 seconds silent audio..

User avatar
josve
Posts: 3
Joined: Mon Jun 13, 2016 9:06 pm
Location: Netherlands
Contact: Website

Re: The I2S sound thread.

Wed Jun 22, 2016 3:36 pm

Hi,
I am busy with developing yet another I2S DAC device with driver, and I remain unsuccessfull to get 24-bit audio to work. I am using a Raspberry Pi 2 model b, initially with a Raspbarrypi Linux 4.1 release, now upgraded to 4.4.
  • I found out that an update was made to support 24-bit in the raspberry pi I2S driver:(https://github.com/raspberrypi/linux/co ... 002995f9cf). Although this was originally pushed into some 3.x release, I found out that this update was not present in the 4.1 raspberry pi linux: it only got inserted from 4.2 onwards. I upgraded my system now to 4.4, which seems a popular version.
  • Although I believe that update is good for me, I still cannot play 96kHz/24bit audio. 'aplay' complains about the mismatch between the 'S24_3LE' audio format and the 'S24_LE' capability of the card hw_param:
    $ aplay -v ~/Music/goodtime-96kHz.wav
    Playing WAVE '/home/pi/Music/goodtime-96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
    ALSA ERROR hw_params: set (FORMAT)
    value = S24_3LE : Invalid argument
    ACCESS: RW_INTERLEAVED
    FORMAT: S16_LE S24_LE
    SUBFORMAT: STD
    SAMPLE_BITS: [16 32]
    FRAME_BITS: [32 64]
    CHANNELS: 2
  • Adding an alsa slave device 'jedac24' and format 'plug' in /etc/asound.conf changes the error message slightly, but does not solve the issue:
    $ aplay -v -D jedac24 ~/Music/goodtime-96kHz.wav
    Playing WAVE '/home/pi/Music/goodtime-96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
    aplay: set_params:1297: Unable to install hw params:
    ACCESS: RW_INTERLEAVED
    FORMAT: S24_3LE
    SUBFORMAT: STD
    SAMPLE_BITS: 24
    FRAME_BITS: 48
    CHANNELS: 2
    RATE: 96000
  • If I test the 'mplayer' application as was kindly suggested by forum user apatel, it apparently does try to do a format change: it says it will convert to an intermediate 96kHz, 16-bit representation, and then seems to start playing the audio. I say 'seems to', because the output stays silent:
    $ mplayer -msglevel all=5 -ao alsa ~/Music/goodtime-96kHz.wav
    MPlayer2 2.0-728-g2c378c7-4+b1 (C) 2000-2012 MPlayer Team
    Playing /home/pi/Music/goodtime-96kHz.wav.
    Detected file format: WAV / WAVE (Waveform Audio) (libavformat)
    [wav @ 0x75b8a5b8]max_analyze_duration 5000000 reached
    [lavf] stream 0: audio (pcm_s24le), -aid 0
    Load subtitles in /home/pi/Music/
    Selected audio codec: Uncompressed PCM [pcm]
    AUDIO: 96000 Hz, 2 ch, s24le, 4608.0 kbit/100.00% (ratio: 576000->576000)
    [AO_ALSA] Format s24le is not supported by hardware, trying default.
    AO: [alsa] 96000Hz 2ch s16le (2 bytes per sample)
    Video: no video
    Starting playback...
    Obviously, I do not appreciate the intermediate step through a 16-bit representation.
  • The issue on 96/24 playback is not caused by the 96kHz rate: 'speaker-test' works fine like:
    speaker-test -f 400 -F S16_LE -r 96000 -c 2 -t sine
  • I looked in the source code of libasound, in particular in 'src/pcm/pcm_plug.c' In there, I do not recognize any source-code that would do a S24_3LE to S24_LE conversion. (Although I might overlook some things...)
Currently I do not see how 24-bit audio playback over I2S is supposed to work: Other external (I2S) audio drivers also seem to provide the S24_LE hardware format as I do in my driver, and I fail to see how the conversion from S24_3LE audio is supposed to function... Can 'aplay' and the alsa-lib never do this? Can someone hint me how to get around this?
Thanks for your help.

epalaima
Posts: 48
Joined: Tue Apr 05, 2016 6:16 am

Re: The I2S sound thread.

Wed Jun 22, 2016 8:58 pm

Hi, I am working on a project for which I am trying to create an audio codec for the pi, using the ADAU1781, for which I have the development board. I am new to linux with the Pi, as well as I2S with the project. I have been researching the subject a lot, but there are several things I am still unclear on. I am using a Pi 3 Model B.

There are several guides that say to solder a header to pin 5 (ex: http://blog.koalo.de/2013/05/i2s-suppor ... ry-pi.html), however they are all fairly old (so pinout may have changed with model) and don't make a clear mention of what should be connected to this pin from the chip. What pins in the GPIO do I use for digital audio in and out? I am using the Raspberry Pi 3. Would they be connected to one of the GPIO_GEN(X) pins, or to an I2C (which is what pin 5 is on the Pi 3).

Additionally the above article mentioned a SoC driver which is included in the Raspberry Pi kernel. Does this mean it would be included on a standard build of Raspbian Jessie? If I have this installed will it support all I2S audio codecs, or will I have to take additional steps to have the chip be recognized as an audio device by alsa?

All help and advice are greatly appreciated. Thanks!

User avatar
josve
Posts: 3
Joined: Mon Jun 13, 2016 9:06 pm
Location: Netherlands
Contact: Website

Re: The I2S sound thread.

Thu Jun 23, 2016 9:23 am

epalaima wrote:Hi, I am working on a project for which I am trying to create an audio codec for the pi, using the ADAU1781, for which I have the development board. I am new to linux with the Pi, as well as I2S with the project. I have been researching the subject a lot, but there are several things I am still unclear on. I am using a Pi 3 Model B.
Hi epalaima, it seems that the link you referred to presents somewhat outdated info
As I have just gone though this process, let me give you some tips... (Although I work with a Pi 2): Success,
Jos

epalaima
Posts: 48
Joined: Tue Apr 05, 2016 6:16 am

Re: The I2S sound thread.

Thu Jun 23, 2016 7:40 pm

Great thanks so much! Those links were super helpful.

I looked in the git for RPi ASoC codec support you posted and there are files that seem to provide support for ADAU1781. Is the code here included with Raspbian Jessie or do I need to install it?

Going from there are there any steps I need to take to set up the Pi and the driver to recognize and work with a specific codec chip? I can't seem to find any instruction or documentation on this topic.

desant
Posts: 2
Joined: Thu Jul 28, 2016 2:22 pm

Re: The I2S sound thread.

Thu Jul 28, 2016 2:34 pm

Hello everybody,

I have to make a project for highschool to create an 'audio interface' for the rpi.

I capture the sound with a dynamic microphone, then I have two stages of amplification and then entering the ADC - PCM1804 from TI.

I want to communicate with the rpi via I2s interface. I have provided a 12.228MHz oscillator to the ADC on the system clock, in order to make it the master.

I have a fresh install of RASPBIAN JESSIE with Kernel version 4.4 on my Raspberry Pi.

Can you please guide me on how to pair the ADC board with the rpi? I'm not very familiar with all the software stuff that it's needed.

Thank you very much!

bashywash
Posts: 3
Joined: Tue Jul 26, 2016 1:39 am

Re: The I2S sound thread.

Fri Jul 29, 2016 12:07 am

Excuse my low level question however after spending some time on the forum I had question as to using a i2s Mic.

I'm trying to broadcast video with audio using the RPi Camera and looking for a solution for the Audio in.

So far I've looked at these 2 i2s audio in solutions
-ICS43432 I2S Digital Microphonee
-Knowles SPH0645LM4H-B

To continue my research and development has anyone had experience with the above two?

obbardc
Posts: 2
Joined: Tue Jun 05, 2012 2:46 pm

Re: The I2S sound thread.

Sun Jul 31, 2016 9:40 am

i have a project which needs audio in and audio out at the same time. is the pi 3 i2s and current driver capable of this?

ive compiled a custom kernel with support for the TLV320AIC32B codec, but i cannot get recording and playing back to work at the same time !

my other option is to use a cheap USB soundcard for the stereo input (this doesnt need to be high quality, but the output does).

what do you guys think?

remkovdz
Posts: 10
Joined: Tue Jul 05, 2016 1:20 pm

Re: The I2S sound thread.

Sat Aug 06, 2016 9:33 pm

I'm trying to get a TDA1543 to work but did not succeed yet. What's unclear to me it which drivers to load exactly (at least I think this is the problem).

I'm using Volumio, the things I have done so far:
- Adding dtoverlay=hifiberry-dac to /boot/config.txt
In Volumio:
- Setting audio output format to 44.1/16
- Setting I2S driver to Generic and audio output to sndrpihifiberry

I2S is connected as follows:
(RPi > TDA1543)
DOUT > DATA
FS > WS
CLK > BCK

I'm probably forgetting to enable a driver somewhere though. I scanned the whole thread and tried everything but no sound. Most solutions are 3 years old so I'm not even sure if they would still work. Can someone point me in the right direction?

remkovdz
Posts: 10
Joined: Tue Jul 05, 2016 1:20 pm

Re: The I2S sound thread.

Tue Aug 09, 2016 9:42 am

remkovdz wrote:I'm trying to get a TDA1543 to work but did not succeed yet. What's unclear to me it which drivers to load exactly (at least I think this is the problem).

I'm using Volumio, the things I have done so far:
- Adding dtoverlay=hifiberry-dac to /boot/config.txt
In Volumio:
- Setting audio output format to 44.1/16
- Setting I2S driver to Generic and audio output to sndrpihifiberry

I2S is connected as follows:
(RPi > TDA1543)
DOUT > DATA
FS > WS
CLK > BCK

I'm probably forgetting to enable a driver somewhere though. I scanned the whole thread and tried everything but no sound. Most solutions are 3 years old so I'm not even sure if they would still work. Can someone point me in the right direction?
Ok I made some progress. I reinstalled Volumio with the above settings and now the silence is gone but replaced by cracking IF there is music 'playing'. There is no music at all through the cracking, also the cracking is totally independent of the music.

I've also tested with Pi MusicBox, same result.

So I guess my question remains: is there anything I'm missing here? Perhaps someone could post the correct settings for /boot/config.txt and /etc/modules for TDA1543?

Thanks!

remkovdz
Posts: 10
Joined: Tue Jul 05, 2016 1:20 pm

Re: The I2S sound thread.

Tue Aug 09, 2016 12:43 pm

remkovdz wrote:
remkovdz wrote:I'm trying to get a TDA1543 to work but did not succeed yet. What's unclear to me it which drivers to load exactly (at least I think this is the problem).

I'm using Volumio, the things I have done so far:
- Adding dtoverlay=hifiberry-dac to /boot/config.txt
In Volumio:
- Setting audio output format to 44.1/16
- Setting I2S driver to Generic and audio output to sndrpihifiberry

I2S is connected as follows:
(RPi > TDA1543)
DOUT > DATA
FS > WS
CLK > BCK

I'm probably forgetting to enable a driver somewhere though. I scanned the whole thread and tried everything but no sound. Most solutions are 3 years old so I'm not even sure if they would still work. Can someone point me in the right direction?
Ok I made some progress. I reinstalled Volumio with the above settings and now the silence is gone but replaced by cracking IF there is music 'playing'. There is no music at all through the cracking, also the cracking is totally independent of the music.

I've also tested with Pi MusicBox, same result.

So I guess my question remains: is there anything I'm missing here? Perhaps someone could post the correct settings for /boot/config.txt and /etc/modules for TDA1543?

Thanks!
Problem solved! I did not know grounds of RPi and TDA1543 needed to be tied together... :?

Bitplayer
Posts: 2
Joined: Sat Oct 10, 2015 3:12 pm

Re: The I2S sound thread.

Sat Sep 03, 2016 5:38 pm

It is quite a while since using the Pi I2S output in slave mode was discussed in this thread. Does it still need a kernel recompile to change those settings, or is there a simpler way now?

swlightn
Posts: 1
Joined: Thu Sep 22, 2016 5:29 pm

Re: The I2S sound thread.

Thu Sep 22, 2016 5:42 pm

Hi,

I'm currently doing I2S recording/playing device with Raspberry Pi 3.

I2S playing was quite easy by enabling hifiberry-dac.
I2S recording was little bit tricky.
I added capture device over pcm5102a.c as follows.

static struct snd_soc_dai_driver pcm5102a_dai = {
.name = "pcm5102a-hifi",
.playback = {
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE
},
.capture = {
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE
},

};

After this, I can see record device with
arecord -l

But, saved wave file shows a lot of resonance.

I feed 1khz sine wave for left channel only, but it shows 1, 3, 5, 7, ... khz frequency as attached image.
Do you know what part should be fixed?

[img]

[/img]

bg3mdo
Posts: 7
Joined: Sat Oct 08, 2016 10:51 pm

Re: The I2S sound thread.

Sun Oct 09, 2016 2:59 pm

I am currently working on a project, which porting a WM8731 (proto audio card) to Pi 3.

HW and SW are based on: https://github.com/raspberrypi/linux/issues/1302

'rpi-proto audio codec on Raspberry Pi v2 model B #1302'

Now I am encountering some problems, where my LRCK (sample rate) is much higher than I expect. I can get sound played, but the sound is pitched.

Here is my father testing method:

Code: Select all

speaker-test -Dplughw:sndrpiproto -f 400 -F S16_LE -r 48000 -c 2 -t sine
I was using scope to check the LRCK rate under different sample rates, what I got as follows:

96K what I got 125K on Pi
48K ---> 62.5K
32K ---> 41.68K
8K ---> 10.42K

It supposed to be a clocking system problem of I2S. I am really no idea at this moment, I am wondering is anyone able to point out some items I can further investigate?


Cheers!!

bg3mdo
Posts: 7
Joined: Sat Oct 08, 2016 10:51 pm

Re: The I2S sound thread.

Sun Oct 09, 2016 5:27 pm

Even using audioinjector audio card driver, I have exactly the same results, high pitch sound.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 13 guests