Can I change 1053 playback speed with a DDS as XTAL?

Designing hardware that uses VLSI Solution's devices as slave codecs such as an external MP3 decoder chip for a host microcontroller.
fwachsmuth
Senior User
Posts: 20
Joined: Sun 2016-01-10 14:58

Can I change 1053 playback speed with a DDS as XTAL?

Post by fwachsmuth » Sun 2016-01-10 15:11

Hey there,

I am planning a little board that plays back MP3 files, where the actual playback speed follows a slightly changing input frequency.
I'll need to support +/-15% pitch changes (equaling +/-15% input frequency changes).

Since such pitch control does not seem to be a native feature of the 1053, I am now considering to replace the system's XTAL with a DDS (Si5153 is the intended candidate). That way, I expect I can alter actual playback speed (and pitch) with changing DDS' frequencies through a µC on the fly.

Questions:
a) Is the assumption correct that a lower external XTAL frequency will lower the playback speed as well? Or has the 1053 some other internal (and hindering) xtal to make sure the pitch is always correct?

b) How would I connect the DDS to XTALI/O when not using an actual XTAL?

c) What is the range of pitch changes I could achieve with such a design?

Thanks a lot for any hint before I start putting this together.

User avatar
pasi
VLSI Staff
Posts: 1510
Joined: Thu 2010-07-15 16:04

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by pasi » Mon 2016-01-11 16:41

I strongly suggest using the samplerate finetuning feature of the vs1053b patches package. ( http://www.vlsi.fi/en/support/software/ ... tches.html )

You will be able to more accurately control (and adjust) the different attributes of the tuning (filtering, maximum allowed adjustment, setting of correct rate when your file/stream changes) without additional components.

To support +15% on a 48kHz rate though, you would use 14.31818MHz crystal for XTALI.

(If you only play mp3 and know each file is the same samplerate throughout, you could even do without the patches package (if you lack the memory to store it) and manipulate the 20-bit samplerate control register directly.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

fwachsmuth
Senior User
Posts: 20
Joined: Sun 2016-01-10 14:58

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by fwachsmuth » Mon 2016-01-11 17:39

Thanks for these hints, Pasi. Very helpful. As you might have realized I am still a noob to this chip (and am more a maker than a pro).
I do know that thesmaplerate of my mp3 files is predictable and not changing, so changing the samplerate control register directly is probably easiest.

Some further questions: Can I change this register during playback without generating pops? (I played with a vlsi1001 breakout board two years ago and always had nasty pops when changing speed). Also, does the "wall clock" stay accurate when I change this, so is the timestamp of what currentyl is playing back independent from the currently set samplerate?

User avatar
pasi
VLSI Staff
Posts: 1510
Joined: Thu 2010-07-15 16:04

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by pasi » Mon 2016-01-11 18:28

A possible pop could be if you are too slow in sending data. Also, if the change is too big, the human ear will notice the change. When adjusting the FREQCTL registers directly, the change is instantaneous.

You just have to note that there are also PLL control bits in the FREQCTLH register. So, you would read out both registers, adjust (or set according to your local copy) the low 20 bits, then write the values back.

FREQCTLL (low 16 bits) is in 0xc013 and FREQCTLH (top 8 bits and PLL control bits) in 0xc014, so writing 0xc013 to SCI_WRAMADDR, then reading SCI_WRAM twice will read out the value.

Note that a change to various settings (samplerate, PLL multiplier, bass or treble control, volume change) may overwrite your value.


(In addition to samplerate finetuning the vs1053b patches package adds a sample-exact samplerate change.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

fwachsmuth
Senior User
Posts: 20
Joined: Sun 2016-01-10 14:58

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by fwachsmuth » Fri 2016-12-23 1:31

I admit that it took an incredibly long time -- but finally, due to the holidays, I found time again for this little project. Thanks to your advice and two days of poking, I got it to work, even better and further than I expected! So I got two methods working:

a) Using the patches package and poking the sample rate registers parametric_x.reserved[0|1]. With 15/16 Bit resampling enabled, this even gives me enough headroom to speed things up noticeably. Amazing that this also seems to work with all kinds of files -- and there are no pops, the transitions are super subtle. Very promising.

b) Using the pitchshifter plugin is magic and works really really well. This will be beneficial e.g. for piano music, where jitter gets apparent quickly. I still have some occasional artifacts when changing AICTRL0 values during playback -- are there any ways to circumvent these?

User avatar
pasi
VLSI Staff
Posts: 1510
Joined: Thu 2010-07-15 16:04

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by pasi » Fri 2016-12-23 11:27

fwachsmuth wrote:b) Using the pitchshifter plugin is magic and works really really well. ... I still have some occasional artifacts when changing AICTRL0 values during playback -- are there any ways to circumvent these?
At which values does it happen? When switching between speed up and speed down and off?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

User avatar
Panu
VLSI Staff
Posts: 2585
Joined: Tue 2010-06-22 13:43

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by Panu » Fri 2016-12-23 16:19

I still have some occasional artifacts when changing AICTRL0 values during playback
Hmm, I think you shouldn't switch it on and off (e.g. once you've activated it, don't set it to exactly 1.0 times normal speed)...?
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

fwachsmuth
Senior User
Posts: 20
Joined: Sun 2016-01-10 14:58

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by fwachsmuth » Wed 2017-02-01 23:24

Hey pasi & Panu,

I haven't explored the pitchshifter plugin much further since sample rate adjustments work so smoothly. I am planning to look into time-stretching later once I got my other problems solved though. :)

Bottom line is that I got the core part working as I wanted -- proof can be found at https://www.youtube.com/watch?v=IrSdjgXpzcg where (the very embarrassing) sound of me playing a kid's xylophone stays in sync with the Projector even though it has heavy speed jitter.

However, I am not able to stay in sync for more than three minutes, usually a noticeable drift happens after 2 minutes already. This is mostly due to rounding errors summing up, also due to differing crsytals... and thus unavoidable. What I need now to correct this is the "I" in my PID controller.
In other words, I know at any time and with 100% precision at what film frame I am (counting 54 pulses per second is trivial) -- but I also need to know at what "timestamp" the playback currently is, thus I can make occasional re-syncs like every 30 seconds or so.

And that's the big question now: Is there a time signal available from the VS1053 side that reflects my exact playback position, e.g. in milliseconds? The tricky part is that I do not need "time passed since playback started" but "timecode at playhead position", since I am speeding playback up and down all the time.

Any hint would be welcome, since I am in a dead-end right now.

User avatar
pasi
VLSI Staff
Posts: 1510
Joined: Thu 2010-07-15 16:04

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by pasi » Fri 2017-02-03 17:24

There is a "sample counter" feature in the vs1053b patches package. Using that value you know which sample number is currently being played back from the DAC, and combined with the knowledge of the samplerate you can convert it to a frame number. Set the value to 0 when starting playback and you should be pretty much close enough to real time.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

fwachsmuth
Senior User
Posts: 20
Joined: Sun 2016-01-10 14:58

Re: Can I change 1053 playback speed with a DDS as XTAL?

Post by fwachsmuth » Fri 2017-02-03 18:00

Hey pasi,

that sounds very exciting! Do you have a hint handy where/how I can access that counter?

F

Post Reply