Can VS1000 do pitch shifting?

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
cjh
User
Posts: 5
Joined: Thu 2019-09-12 14:30

Can VS1000 do pitch shifting?

Post by cjh » Thu 2019-09-12 14:46

We have an existing product that makes use of the VS1000. However, we now have a new application that needs playback to be pitch shifted without changing tempo. Is there any way to get the VS1000 to do this? I've seen elsewhere on this forum that the VS1005 can do so, but we can't justify the cost of redesigning our existing product to meet this new application.

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

Re: Can VS1000 do pitch shifting?

Post by pasi » Mon 2019-09-16 10:16

Hi,
What kind of files are you playing? Mono or stereo Ogg Vorbis? Samplerate?

How good would the pitch-shifting need to be? How much of a shift up and down is needed?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

cjh
User
Posts: 5
Joined: Thu 2019-09-12 14:30

Re: Can VS1000 do pitch shifting?

Post by cjh » Mon 2019-09-16 10:59

Hi,

The files are mono Ogg Vorbis. Sample rate would ideally be 44100, but around 22050 might be OK.

Maximum required pitch shift would be a factor of approx. two with the ability to step in approx. 1% increments. The resultant audio would need to sound pretty good with minimal artifacts.

Thanks for your response.

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

Re: Can VS1000 do pitch shifting?

Post by pasi » Mon 2019-09-16 11:10

There is a speed shifter in libdev1000.a, see dev1000.h for the documentation and prototypes. There is also a mono-specific version.

To make a pitch shifter out of a speed shifter, you would "just" need to adjust the playback samplerate in the other direction.

If you don't care about accurate playtime, for Ogg Vorbis you could modify the cs->sampleRate field. Alternatively you can install your own SetRate() function which calculates the DAC control value taking the pitch shifting into account. (We'll probably need to help you there a bit.) Edit: Actually, adjusting the extClock4KHz variable is probably the easiest.

However, if you play 44.1kHz material with 12MHz crystal, without further tricks you can only adjust the playback rate about +6% (one semitone). 22kHz gives you the one octave up/down range.

You would need to test whether the result is good enough for your use. It is not as good as the VS1005 version.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

cjh
User
Posts: 5
Joined: Thu 2019-09-12 14:30

Re: Can VS1000 do pitch shifting?

Post by cjh » Mon 2019-09-16 12:14

OK. Thanks for the info.

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

Re: Can VS1000 do pitch shifting?

Post by pasi » Mon 2019-09-16 12:51

My old test code seems to be limited between 0.75x and 1.5x, but I'm not sure if that's the limit of the pitch shifter itself.

Are you using SD card or SPI memory for storage? I might be able to give you example code.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

cjh
User
Posts: 5
Joined: Thu 2019-09-12 14:30

Re: Can VS1000 do pitch shifting?

Post by cjh » Mon 2019-09-16 14:12

Hi Pasi,

I'm using SPI memory.

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

Re: Can VS1000 do pitch shifting?

Post by pasi » Mon 2019-09-16 15:18

Here's sdplayer with pitch shifting 0.75..1.5 (if samplerate is low enough). UART control 'u' / 'd' / 's' for pitch down, pitch up, and set to 1.0x. (Pitch up is 'd', and down is 'u', you can reverse them.)

The added code is inside #ifdef USE_PITCH_SHIFT sections, so you can integrate into your code.

I might fiddle with spiplayer tomorrow.

(Remove the assignment to extClock4kHz to get speedshifter instead.)
Attachments
sdplayer.c
sdplayer with pitch shifting.
(54.19 KiB) Downloaded 12 times
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

cjh
User
Posts: 5
Joined: Thu 2019-09-12 14:30

Re: Can VS1000 do pitch shifting?

Post by cjh » Mon 2019-09-16 16:22

Thanks for the source code Pasi.

Post Reply