• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Pitch shift using circular buffers

Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
Hi all

Im attempting to perform a very basic pitch shift by writing audio samples into a circular buffer then reading them at a faster or slower speed to effectively raise or lower the pitch, i understand all of the sound quality issues with this method. I have my circular buffer set up and im already using them playing with creating echo effects using the following commands

Code:
CIRC_WRITE(echo,0,x,dm);
CIRC_READ(echo,0,y,dm;
CIRC_MODIFY(echo,z);

with x being my incomeing sample, y being my sample to output and z being a delay value, and echo is the name of the specific buffer im storing values to.

With these commands ive been able to setup quite a nice reverb/echo with multiple voices and reverberations or reflections with different decay times but i just cannot get my head around how i could output from my circular buffer at a faster or slower speed them im writing to it?
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
If it is a RIFF WAVE, wouldn't you only have to change the sample rate in the header? If it is 48 kHz and you played it at 96 kHz, it would sound like it is going twice as fast. If it is 48 kHz and you played it at 24 kHz, it would sound like it was half as fast.
 
Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
sorry im working on a dsp board, a Analog DEvices adsp-21065l EZ-lab



I don't know how or if i can change the samplerate it inputs at differently to that it outputs at plus im using it to create a bit of a multi effects thing, got wah wah, chorus, echo/reverb, tremolo and auto pan already running on it and you can switch between them and change values for the different effects, wouldn't changing the boards samplerate on the fly cause glitches, if you can even do that?

sorry i should have added that in the op
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I have no experience with the hardware you're working with so I can't tell you anything specific but, you should be able to simulate the effect. To make it sound like it's playing twice as fast, only play every other sample. To make it sound like it is playing at half speed, play every sample twice.
 
Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
done it


Code:
count5++;
CIRC_MODIFY(echo,count5+1);
CIRC_READ(echo,0,L,dm);
CIRC_MODIFY(echo,L1-count5);
CIRC_WRITE(echo,0,x,dm);


if(count5==3000){
count5=0;}

need to add a window and a few other things as it sounds quite awful at the moment :p
 
Top