I have a Geeetech Arduino shield which I use with the Leonardo. I am using Adafruit's player_simple program.
I have worked through all the pinouts and settings (running at SPI_HALF_SPEED). I have made small changes in order to initialize the player correctly.
I can play an .mp3 file from the onboard SD reader (i have a high speed 4G card) but it comes out slightly slow and has this 'wobbly' sound.
I have messed with sciWrite(VS1053_REG_CLOCKF, 0xC000); using different values but I think 0xC000 is correct for the 12.288 Geeetech board.
Anything else I need to try?
Please help! Thanks.
VS1053 MP3 play back slow and 'wobbly'
Re: VS1053 MP3 play back slow and 'wobbly'
Does the song play the correct amount of time? Does it otherwise sound correct, i.e. no noise or interruptions?
Check that you DO NOT set the SM_STREAM_MODE bit of the SCI_MODE register.
Are you reading or writing other SCI registers during playback?
Check that you DO NOT set the SM_STREAM_MODE bit of the SCI_MODE register.
Are you reading or writing other SCI registers during playback?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: VS1053 MP3 play back slow and 'wobbly'
Hi - it plays all the way to the end but sounds awful (and slower than it should be).
Here are the registers:
VS1053 Simple Test
Mode = 0x800
Stat = 0x48
ClkF = 0xC000
Vol. = 0x2828
Version = 4
It looks like the SM_STREAM_MODE is not set.
I have put the code here: https://github.com/ylh888/VS_player_simple
The "New recording" has a sample of the output: first from the VS1053, then from my desktop.
Thanks.
Here are the registers:
VS1053 Simple Test
Mode = 0x800
Stat = 0x48
ClkF = 0xC000
Vol. = 0x2828
Version = 4
It looks like the SM_STREAM_MODE is not set.
I have put the code here: https://github.com/ylh888/VS_player_simple
The "New recording" has a sample of the output: first from the VS1053, then from my desktop.
Thanks.
Re: VS1053 MP3 play back slow and 'wobbly'
Hi,
What bitrate is the file you're trying to play?
Possible problems that could create that sound:
1) Too slow clock - but 0xc000 in CLOCKF should be enough (check that you don't overwrite the value and it reads back correctly)
2) Too slow data transfer - is DREQ high all the time?
3) Byte/word count mixup - you are potentially sending dummy data after each sector data? xDCS low during SD access?
What bitrate is the file you're trying to play?
Possible problems that could create that sound:
1) Too slow clock - but 0xc000 in CLOCKF should be enough (check that you don't overwrite the value and it reads back correctly)
2) Too slow data transfer - is DREQ high all the time?
3) Byte/word count mixup - you are potentially sending dummy data after each sector data? xDCS low during SD access?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: VS1053 MP3 play back slow and 'wobbly'
Hello,
have you been able to solve your issue?
Based on how your sample sounds, I think (2) is the most likely of Pasi's suggestions, possibly also (3).
I'll make some wild guesses based on this observation:
- It seems that the sound comes out in 28-30 millisecond bursts
Assumptions and guesses:
- Do you read, then send data one 512-byte disk block at a time?
- If so, a 128 kbit/s file played too slow would cause artifacts like in your file
So, if you do read/send data 512 bytes at a time, and the file you played is a 128 kbit/s CBR (constant bit-rate) MP3, I'd say Pasi's suggestion (2) is extremely likely to be your issue.
Kind regards,
- Henrik
have you been able to solve your issue?
Based on how your sample sounds, I think (2) is the most likely of Pasi's suggestions, possibly also (3).
I'll make some wild guesses based on this observation:
- It seems that the sound comes out in 28-30 millisecond bursts
Assumptions and guesses:
- Do you read, then send data one 512-byte disk block at a time?
- If so, a 128 kbit/s file played too slow would cause artifacts like in your file
So, if you do read/send data 512 bytes at a time, and the file you played is a 128 kbit/s CBR (constant bit-rate) MP3, I'd say Pasi's suggestion (2) is extremely likely to be your issue.
Kind regards,
- Henrik
Good signatures never die. They just fade away.
Re: VS1053 MP3 play back slow and 'wobbly'
Hello,
Thanks for the response.
The code seems to indicate that I read 32 bytes at a time:
#define VS1053_DATABUFFERLEN 32
Changing this to 512 does not play.
My buffer is declared in bytes and I believe the SD file read() is also in bytes.
I verified that the clock speed is at 0xC000 and that does not change through playing.
The DREQ pin is digital connected to pin 2 from the VS1053 shield and does seem to be held high at all time.
Thanks for the response.
The code seems to indicate that I read 32 bytes at a time:
#define VS1053_DATABUFFERLEN 32
Changing this to 512 does not play.
My buffer is declared in bytes and I believe the SD file read() is also in bytes.
I verified that the clock speed is at 0xC000 and that does not change through playing.
The DREQ pin is digital connected to pin 2 from the VS1053 shield and does seem to be held high at all time.
Re: VS1053 MP3 play back slow and 'wobbly'
If DREQ is high all the time, you are not sending data quickly enough.
You can't send 512 bytes at a time (without checking the fill state of the SDI FIFO), but you can read 512 bytes from the storage, then send that 512 bytes in 32-byte blocks, checking the DREQ state before sending each 32 bytes.
You can't send 512 bytes at a time (without checking the fill state of the SDI FIFO), but you can read 512 bytes from the storage, then send that 512 bytes in 32-byte blocks, checking the DREQ state before sending each 32 bytes.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: VS1053 MP3 play back slow and 'wobbly'
So the symptom seems to indicate that I read too slowly to be feeding the VS1053 (hence also why the music is slow - the 'wobbly' output is just an effect).
Reading 512 bytes at a time might help but I will need to do that asynchronously to feeding the VS1053 at 32 bytes a time.
It will take me a little time to make the change.
Thanks for the insight.
Reading 512 bytes at a time might help but I will need to do that asynchronously to feeding the VS1053 at 32 bytes a time.
It will take me a little time to make the change.
Thanks for the insight.
Re: VS1053 MP3 play back slow and 'wobbly'
Come to think of it: the SD library's read() is blocking. Reading 512 bytes from it each time will likely miss sending data to the VS1053.
I now wonder if there is something else other people are doing that could make this Geeetech board work.
I now wonder if there is something else other people are doing that could make this Geeetech board work.
Re: VS1053 MP3 play back slow and 'wobbly'
Try this:
Read 512 bytes (= one disk block) at the time from SD, then send the data in sixteen 32-byte chunks to VS1053. If that makes your SD read faster, it may solve your issue in one stroke. The VS1053 has an input buffer that is 2 kilobytes, so it can easily tolerate that you don't feed data to it all the time.
Kind regards,
- Henrik
Read 512 bytes (= one disk block) at the time from SD, then send the data in sixteen 32-byte chunks to VS1053. If that makes your SD read faster, it may solve your issue in one stroke. The VS1053 has an input buffer that is 2 kilobytes, so it can easily tolerate that you don't feed data to it all the time.
Kind regards,
- Henrik
Good signatures never die. They just fade away.