How to store audio data in flash for the USBAudioClass example

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
rohoc_3075686
Level 1
Level 1

     The USBAudio class read the audio data from flash.

     So I think we should store audio data in the flash first, how can I do this? And where can I get the audio data for it? what's the format of the data?

     Thanks!

0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
alamandaa_16
Moderator
Moderator
Moderator
10 likes received First like received

Hi,

--In order to write the audio file to the SPI flash, first program FX3 with Flashprog example project available with FX3 SDK(C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxflashprog).

There is vendor command to write to the SPI Flash. You can use the same to write the audio data in the SPI flash.

Vendor commands:

bmRequestType = Vendor

bRequest = 0xC2

wValue = 0x0000

wIndex = 0x0000

spiii.JPG

I have attached one audio file. You may use any other audio file which will fit inside the SPI flash.

Regards,

Anil Srinivas.

0 Likes
lock attach
Attachments are accessible only for community members.

Hi, Anil:

      I can now store audio file in the flash. But when I run the UAC example in FX3 SDK 1.3.3 and play the audio in the PC, the voice sounds incorrect.

      Also, it looks like the audio file you provided is incorrect. It doesn't seems to be in correct PCM format.

      I created a PCM file myself. You can see the attached  files, the a.wav is the original audio file, and the pcm16x2.pcm is the converted PCM audio file to be stored in the flash. The audio format is 48000 sample rate, 2 channels, 16 bit.

     Although I can hear the voice in the PC, there's noise and squeak.

     What might be the cause of the issue?

    

     Thanks.

BR

Ronnie

0 Likes
lock attach
Attachments are accessible only for community members.

   The audio played by the PC was recorded in the attached file.

   You can see the sound is not exactly as the original one.

   what's the problem? thanks。

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

I used USB Control Center application to write audio data to SPI Flash and The USBAudio class read the audio data from flash following are the observations.

1.I checked both write audio data and read data from spi are same.

2.Read data from spi and USB Endpoint data are same but Read data from spi and audacity recorded data are different see the attached files.

Please try with different audio players.

Regards,

Anil Srinivas.

0 Likes