Play sound two times with short delay inserted on VS1000 GPIO

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
Miyuki
User
Posts: 8
Joined: Thu 2022-02-10 20:57

Play sound two times with short delay inserted on VS1000 GPIO

Post by Miyuki »

Hello,
I want to modify default GPIO firmware to have second play pin what will play the sound not once but two times

What is the best way to insert about 500ms to 1s delay?

Im thinking about to have some "play_twice_flag" and when first play ends just play again. Hook it to same check as when enable playing outpit pin.
User avatar
pasi
VLSI Staff
Posts: 2019
Joined: Thu 2010-07-15 16:04

Re: Play sound two times with short delay inserted on VS1000 GPIO

Post by pasi »

Will all files always be played twice with a pause in-between? Do you have control over the files?

The easiest way (no coding required) is to create ogg vorbis files with the content twice and the pause as zero samples.

Otherwise you'll need a bit of a state machine to detect when the playback ends (player.currentFile becomes -1) and then capture the time using ReadTimeCount(), detect when the appropriate pause time has elapsed using the stored value and ReadTimeCount(), then restart the same song. (And perhaps reset the state machine if other GPIOs are detected in the meantime.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Miyuki
User
Posts: 8
Joined: Thu 2022-02-10 20:57

Re: Play sound two times with short delay inserted on VS1000 GPIO

Post by Miyuki »

I need 1 pin to play once and the second pin to play twice
I will have about 3 sound files so I can prepare 3 extra ones it is not so big deal
Just wondering now what is a better option
Post Reply