Hello,
I am new on I2S protocol. I have a question.
I have s32k148 board and fda903d amplifier. I have a sound data ( voice record) in flash. I am reading that sound and writing in buffer in RAM ( ring buffer ).
I have also adc to change pitch ( not actual pitch).
for example audio data in buffer seems like ( sx : 32bit sample):
s1,s2,s3,s4,s5,s6....s512
if ı want to increase frequency , I want to send data to I2S like ( jumping samples )
s1,s2,s3,s4,s5,s7
or
s1,s2,s4,s5,s7,s9
and if ı want to decrease frequency , I want to send data to I2S like ( repeat samples)
s1,s2,s2,s3,s4,s5,s5,s6,s7
or for more slow
s1,s2,s2,s3,s3,s4,s5
Now , at processor expert there is a function to send data to i2s, that function needs I2S instance, buffer pointer and sample count. but it plays like that:
s1,s2,s3,s4,s5,s6,s7.
Q1: how can i jump or repeat samples ?
Q2: is it possible to send samples by one by without changing sample rate of sound ? should ı use timer for that ? or is there a periodic interrupt for every sample time in SAI
@erdoganguler @Alexis_A I am new with S32K and SAI. I am trying to use SAI to interface fda903d amplifier with S32K148 but getting alot of issues. If you can share some reference code it would be a great help for me. Thanks
Hello Erdogan,
Q1: How can I jump or repeat samples?
For this, the best way would be to set the buffer with the samples you want. In the API, there isn't any way to skip examples.
Q2: is it possible to send samples by one by without changing the sample rate of sound ? should ı use timer for that ? or is there a periodic interrupt for every sample time in SAI
Yes, it is possible but if you do this I don't think the sound quality will be the best, you only need to take care of the fetching to the I2S bus so there aren't any gaps in the audio transmission. Also, the callback could be used to control the fetching.
Let me know if this helps you.
Best Regards,
Alexis Andalon