How to display the sampling rate and other information of the current playing file on the screen

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
jacksl528
User
Posts: 4
Joined: Sun 2024-06-02 9:01

How to display the sampling rate and other information of the current playing file on the screen

Post by jacksl528 »

I am using VS1063 to build a portable player. How can I display the sampling rate, playback time (progress bar), and other related information of the current playing file on the screen Ui?


thanks~!
jacksl528
User
Posts: 4
Joined: Sun 2024-06-02 9:01

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by jacksl528 »

MP3 file decoding information can be obtained, but FLAC cannot.
User avatar
pasi
VLSI Staff
Posts: 2145
Joined: Thu 2010-07-15 16:04

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by pasi »

The samplerate (and number of channels) can be read from SCI_AUDATA. The value is even for 1-channel, and odd for 2-channel audio. If you clear the lowest bit, the value then gives the samplerate.

SCI_DECODETIME gives the decoding position in seconds. However, the decoder cannot generally know the total size of the audio. If you want to show a progress bar, you can use the file position divided by total file size to get a percentage or estimate the total and remaining time.

SCI_HDAT1 tells the currently decoded format. See datasheet section 10.8.9. Extra information about bitrate is available for some formats. Some formats also provide additional information through the parametric_x structure, see datasheet.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
jacksl528
User
Posts: 4
Joined: Sun 2024-06-02 9:01

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by jacksl528 »

Thank you for your reply, Pasi
I am currently facing a difficult problem,
I play different types of audio files through an SD card, and I find that after playing the WAV format audio files, my speaker produces a terrifying noise that lasts until the next song starts playing and disappears. This sound is similar to an explosion, very loud

Thank you for your help!
User avatar
pasi
VLSI Staff
Posts: 2145
Joined: Thu 2010-07-15 16:04

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by pasi »

What is the format of the WAV file? (Can you send it to support@vlsi.fi ?)

What is your SPI bitrate? Are you able to read it from storage and send it to vs1063 fast enough?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
jacksl528
User
Posts: 4
Joined: Sun 2024-06-02 9:01

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by jacksl528 »

Encounter a tricky problem.
I tried playing audio files in different formats and found that the "*. WAV" audio files finished playing each time
About to switch to other formats, such as. mp3 FLAC... it will emit a burst sound in the last few seconds of the song.
However, if WAV format audio files are played continuously, this explosion sound will not occur.
At present, I cannot find the reason for this situation. Please provide assistance.

The sample of WAV audio file has been sent to support@vlsi.fi

Thank you very much!
User avatar
pasi
VLSI Staff
Posts: 2145
Joined: Thu 2010-07-15 16:04

Re: How to display the sampling rate and other information of the current playing file on the screen

Post by pasi »

1. Do you have your own filesystem routines? If yes, are you only sending the contents of the file, and not the whole last disk sector? The last block of data may contain invalid data after the actual file has ended.
2. Are you sending 2048 zero / endfill bytes after sending the file?
3. Do you perform the cancel procedure to end decoding of the current audio file before sending the next file? SCI_HDAT1 should contain 0x0000 before you send the data of the next file. This indicates the decoder is trying to determine which audio format to decode next.

The default value for parametric_x.resync indicates that decoding of each file format should proceed even after decoding errors. The decoder does its best to find a valid point to continue decoding from. This operation of resynchronization also allows you want to perform rewind or A-B repeat. You can just skip into a suitable location in the file and the decoding will continue from there. The actual operation is a little different for each audio format.

For example for WAV the data size is ignored, so that you can keep decoding the same file indefinitely. You can jump a suitable distance in the file (a multiple of sample sample times number of channels) and the decoding will continue from there.

mp3 doesn't need resync, because it is a stream format and automatically continues decoding from the next detected mp3 audio header.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply