2023-03-03 10:50 AM
Solved! Go to Solution.
2023-03-07 11:56 PM
Hello @DOyad.1
AudioProcess is the right callback, where 1ms of audio samples are ready to be used in your application.
How are you saving the files? If it is a .wav, have you added the proper header and description in the file before opening it and start saving data?
Look at the example Datalog_Audio available here: https://www.st.com/en/embedded-software/stsw-stlkt01.html
It has been developed on another ST platform, but it is still based on an STM32L4, so porting should be feasible.
Let me know if this can help you
Best regards
Simone
2023-03-06 08:40 AM
Hello @DOyad.1
It should be feasible, but there is no X-NUCLEO from ST that is natively supporting SD card.
SD card pinout changes in base of the HW provider and depends also from the NUCLEO used; there is no a unique standard to support SD for X-NUCLEO-AMICAM1.
Best regards
Simone
2023-03-06 12:42 PM
Hi Simone,
I'm using the STM32L476RG board and a MicroSD breakout board for the SD card. I'm using SPI to communicate with the SD card, which works fine.
My issue is saving the PCM data into an SD card. The sample code provided uses the USB interface. I thought it would be straightforward since a function transmits the data over USB. I could just take the PCM data and store it on an SD Card instead of over USB.
When I play back the audio, I get a lot of noise.
W_002 is the data stored on the SD card, and Audio Track is audio transmitted over USB.
I've been trying to store the data in the PCM buffer on the SD card.
Is it possible to store the PCM data on the SD Card, or must something else be done before I can save it onto the SD card?
Thanks,
Daniel
2023-03-06 12:43 PM
Hi Simone @SPRAD.1 ,
I'm using the STM32L476RG board and a MicroSD breakout board for the SD card. I'm using SPI to communicate with the SD card, which works fine.
My issue is saving the PCM data into an SD card. The sample code provided uses the USB interface. I thought it would be straightforward since a function transmits the data over USB. I could just take the PCM data and store it on an SD Card instead of over USB.
When I play back the audio, I get a lot of noise.
W_002 is the data stored on the SD card, and Audio Track is audio transmitted over USB.
I've been trying to store the data in the PCM buffer on the SD card.
Is it possible to store the PCM data on the SD Card, or must something else be done before I can save it onto the SD card?
Thanks,
Daniel
2023-03-07 11:56 PM
Hello @DOyad.1
AudioProcess is the right callback, where 1ms of audio samples are ready to be used in your application.
How are you saving the files? If it is a .wav, have you added the proper header and description in the file before opening it and start saving data?
Look at the example Datalog_Audio available here: https://www.st.com/en/embedded-software/stsw-stlkt01.html
It has been developed on another ST platform, but it is still based on an STM32L4, so porting should be feasible.
Let me know if this can help you
Best regards
Simone
2023-03-08 06:39 AM
Hello Simone @[SPRAD.1] ,
Yes, I added the proper header and description in the .wav file before opening it and saving the data. I even saved the data on a text file and imported the raw PCM data into Audacity. Both files had the same noise.
Thanks for the example!
I will look into it and see if I can get it working. I'll let you know how I get on soon enough.
Thanks,
Daniel
2023-03-08 04:37 PM
Hi Simone @[SPRAD.1] ,
When I set the SD card buffer size to uint16_t Audio_OUT_Buff[(((AUDIO_IN_CHANNELS * AUDIO_IN_SAMPLING_FREQUENCY) / 1000) * N_MS)*500], I get an ram overflow error when sampling at 192 kHz. I think the sample code is set to 16 kHz. I haven't tried 16 kHz because I would have to desolder a connection on the STM32L476RG as per the X-NUCLEO-AMICAM1 documentation.
Are ye multiplying by 500, so that the buffer size is half the sampling rate?
The screenshot is the main.h file.
Thanks,
Daniel
2023-03-10 02:08 PM
Hello Simone @SPRAD.1,
I got it working.
I'll just have to use a board with more RAM if I want to sample at 192 kHz.
Thanks for all your help,
Daniel
2023-03-13 12:46 AM
Hi @DOyad.1 ,
Sorry for the late reply.
I'm happy to see that you got the application working well.
Come back to us for any further support.
Best regards
Simone
2023-03-15 11:52 AM
Hi @SPRAD.1 ,
That's no problem.
Thanks again for the help.
Best regards,
Daniel