Spin Semiconductor Forum Index Spin Semiconductor
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Change reading speed of sample

 
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development
View previous topic :: View next topic  
Author Message
drolo



Joined: 10 Feb 2015
Posts: 10
Location: BE

PostPosted: Mon Jul 10, 2017 3:59 am    Post subject: Change reading speed of sample Reply with quote

I thought this would be trivial to achieve but I can't seem to figure out how to go about it...
Basically I would like to record a 1s sample and slow it down, or speed it up. Just like a tape recorder, where the pitch also changes.

The best I could get until now is using the method as shown here:

frank wrote:

Code:

mem delay 32767

skp run, loop
sof 0, -0.25
wrax rmp0_rate,0
wrax rmp0_range, 0
loop:

sof 0,0
rdax adcl, 1.0
wra delay, 0.0

cho rdal, rmp0
wrax addr_ptr, 0
rmpa 1.0
wrax dacr, 1.0
wrax dacl, 0.0


This code was posted by Frank for a reverse delay. Changing the ramp rate gives me the results I want, but it only allows for a 1/4s long sample.
If someone could give me some pointers on how to get the same for 1 sec, that would be great Smile
Back to top
View user's profile Send private message Visit poster's website
frank



Joined: 19 Oct 2005
Posts: 969

PostPosted: Mon Jul 10, 2017 8:14 am    Post subject: Reply with quote

You may want to try the record/play code from http://www.spinsemi.com/forum/viewtopic.php?t=20&highlight=record and add a pitch shift into the playback routine to shift up/down. The example is stereo but it should be easy to rip out one channel and double the delay for the remaining one.
_________________
Frank Thomson
Experimental Noize
Back to top
View user's profile Send private message Visit poster's website
drolo



Joined: 10 Feb 2015
Posts: 10
Location: BE

PostPosted: Mon Jul 10, 2017 12:28 pm    Post subject: Reply with quote

Thanks Frank
Though wouldn't adding pitch shift not just shift the pitch of the sample?
the actual sample would not be slowed down or sped up ?
Back to top
View user's profile Send private message Visit poster's website
frank



Joined: 19 Oct 2005
Posts: 969

PostPosted: Mon Jul 10, 2017 1:56 pm    Post subject: Reply with quote

Yeah, you are correct. Problem is there is no way to change the playback speed in software it will have to be done via a pitch shift in some manner. Basically the code you posted at the top of this thread is half of a pitch shift so try it in the playback routine.
_________________
Frank Thomson
Experimental Noize
Back to top
View user's profile Send private message Visit poster's website
knutolai



Joined: 23 Nov 2016
Posts: 32
Location: Bergen, Norway

PostPosted: Sat Jul 22, 2017 3:40 am    Post subject: Reply with quote

hey

Have been thinking about this application myself. Why not just do away with the ramp oscillator and increment and reset addr_ptr position directly?

Something like this:
Code:

-Set address increment size (pot ctrl)
-Increment read address
-If read address is beyond delay buffer length (NEG or >32768)
    ABSA (32768 - (ABSA (addr) ))
-Set ADDR_PTR

-Write ADC + Feedback (pot ctrl) to delay buffer
-Read address with rmpa
-Write to DAC and feedback reg

Back to top
View user's profile Send private message
drolo



Joined: 10 Feb 2015
Posts: 10
Location: BE

PostPosted: Mon Jul 31, 2017 10:09 am    Post subject: Reply with quote

Thanks for the tip (and sorry for the late reply, for some reason I never get notifications for post replies)

I was thinking about trying something like this but will need to free up some time to work on it and wrap my head around how to make it work Smile

Your pointers are going to help for sure
Back to top
View user's profile Send private message Visit poster's website
knutolai



Joined: 23 Nov 2016
Posts: 32
Location: Bergen, Norway

PostPosted: Fri Aug 04, 2017 12:37 pm    Post subject: Reply with quote

got around to test the concept. It does work. No need to deal with the ramp function. The sound will get very grainy as you slow it down. Nice spooky vibe when playback is done in reverse at half (or quarter) tempo. Octave down stuff.
Back to top
View user's profile Send private message
igorp



Joined: 19 May 2015
Posts: 12

PostPosted: Tue Oct 03, 2017 10:01 pm    Post subject: Reply with quote

Also, you may write your own ramp LFO. Without crossfades, etc, it's easy -> usual DDS
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group