cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to record stereo audio through the line-in jack with the STM32F746G Discovery board?

misterstarshine
Associate III
Posted on October 03, 2016 at 20:56

Hi.

I would like to record stereo audio with the line-in jack on the STM32F746G Discovery board. I haven't seen any example that deals with stereo input. Is this supposed to be possible at all or is there a hardware of software limitation? According to the schematic the input jack is stereo and is connected in that manner to the audio codec.

Thanks in advance

#stm32f7-audio-stereo
16 REPLIES 16
rad one
Associate
Posted on April 03, 2017 at 22:49

I've identified the nosie problem and finally did the first DSP project. Here it is: 

https://github.com/sq5mjw/STM32F746G-DSP-Filter-Lab

 if someone interested in. It is DSP 700HZ bandpass filter for radio CW reception.
Posted on July 30, 2017 at 23:42

Nice one

‌!

I tried adding a delay line and using float buffers in sdram, but the data loaded from sdram appears to be corrupted.

Mapping:

#define DELAY_BUFFER_SIZE ((uint32_t)(DEFAULT_AUDIO_IN_FREQ))// 1 second#define AUDIO_BUFFER_IN AUDIO_REC_START_ADDR#define AUDIO_BUFFER_OUT (AUDIO_BUFFER_IN + (AUDIO_BLOCK_SIZE*2))#define DELAY_BUFFER_START (AUDIO_BUFFER_OUT + (AUDIO_BLOCK_SIZE*2))�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

Example:

void Delay(){ uint32_t i, j; arm_q15_to_float ((uint16_t*)(DELAY_BUFFER_START + dReadPos), delayBufferRead, AUDIO_BLOCK_SIZE); for(i=0, j=0; i < AUDIO_BLOCK_SIZE; i+=2 , ++j) { dSample = delayBufferRead[j] * dFeedback; delayBufferWrite[j] = float_buffer_in[i] + dSample; float_buffer_out[i] = float_buffer_in[i] + dSample * dMix; float_buffer_out[i+1] = float_buffer_out[i]; dWritePos = (dWritePos + 1) % DELAY_BUFFER_SIZE; dReadPos = (dReadPos + 1) % DELAY_BUFFER_SIZE; } arm_float_to_q15 (delayBufferWrite, (uint16_t*)(DELAY_BUFFER_START + dWritePos), AUDIO_BLOCK_SIZE);}�?�?�?�?�?�?�?�?�?�?�?�?�?�?

The dry data, saved in the buffers starting fromaddress0x2002f864 (SRAM),is clear.

float32_t float_buffer_in[AUDIO_BLOCK_SIZE];�?�?float32_t float_buffer_out[AUDIO_BLOCK_SIZE];�?�?�?�?

Only the data from the delay line in SDRAM is corrupted

ffr3akk
Associate II
Posted on August 12, 2017 at 14:30

update: if I keep the pointers dReadPos and dWritePos at the same position, the output is a clear bypass, meaning that it can read what I just wrote to SDRAM fine, but if I move the read pointer to an offset behind the write pointer, on the next loop iterations it reads corrupt data.

Any idea how to save a buffer, larger than AUDIO_BLOCK, to an SDRAM location and prevent its data from being overwritten?

Carlos Lopez
Associate
Posted on February 01, 2018 at 17:11

Hi

Freakk.Freakk

I am following this up close as I am trying to do something similar, building an Audio Processor Unit on the STM32F7. Have you been able to implement that delay line you were talking about? I have been trying to do it but I haven't been able so far. I realised if you increase the block size to larger numbers like 22050 or 44100 (I guess this matches the sampling frequency) you get a straight up delay but I want it to be in an algorithm so I can use it at my will. I would be very interested so please let me know if you figured something out! Thanks in advance

Posted on February 08, 2018 at 07:18

Rad one, did you really identified the noise problem? I have tried your DSP project and a get a lot of noise from line in to line out

Posted on February 08, 2018 at 20:40

Hi, do you get noisy data from line in to line out? I am trying to make DSP project, but cant get clear data. I tired rad one project but it seems that there is still a lot of noise.

Posted on May 27, 2018 at 19:32

Thank you

Dalewski.Rados_aw

I too need to do DSP audio processing with the STM32F7

I downloaded and compiled the project and I see the modifications made to allow using line-in. Running the project as is, it works and I hear no noise with headphones and an A 440 Hz tone as input. I see in the code that the sample rate is set to 16 kHz and my processing will require 96 kHz sample rate. I tried setting the sample rate to 96 kHz which failed with a DMA error and then to 48 kHz which also fails with a DMA error. I will work more with this, but it's certainly a start.