How to rotate phase of wav sample at 45 degrees

Sound synthesis techniques, DSP and related mathematics

Moderators: electrogear, exonerate

How to rotate phase of wav sample at 45 degrees

Postby Dimmak0001 on Wed May 16, 2012 7:59 pm

Plese help me to find answer. :)
Dimmak0001
essemer
 
Posts: 11
Joined: Fri Apr 27, 2012 7:09 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 4:20 am

You know, degrees are related to signal frequency. It can be sampling frequency (which wouldn't make much sense then) or a certain sound in that sample. What do you exactly want to do?
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Re: How to rotate phase of wav sample at 45 degrees

Postby martinvicanek on Thu May 17, 2012 7:15 am

Do you mean something similar to a Hilbert transformer (=a device which generates a 90 degree phase shift over a wide frequency band)? But why 45 degrees?
martinvicanek
essemilian
 
Posts: 306
Joined: Sun Mar 13, 2011 1:15 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Dimmak0001 on Thu May 17, 2012 8:34 am

I just want to rotate phase of wav sample around 'circle'( formula with 3.14 ). Not shift, but rotate to any degree from 0 to 180. ;)
Dimmak0001
essemer
 
Posts: 11
Joined: Fri Apr 27, 2012 7:09 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 9:41 am

I ask what you mean by "phase of sample". Samples have no phase parameter as far as I know.
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Re: How to rotate phase of wav sample at 45 degrees

Postby Dimmak0001 on Thu May 17, 2012 10:54 am

Warmonger wrote:I ask what you mean by "phase of sample". Samples have no phase parameter as far as I know.

Sorry... Wav section. Phase of frequency :)
Dimmak0001
essemer
 
Posts: 11
Joined: Fri Apr 27, 2012 7:09 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 11:12 am

Phase of which frequency?
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Re: How to rotate phase of wav sample at 45 degrees

Postby Dimmak0001 on Thu May 17, 2012 11:33 am

Warmonger wrote:Phase of which frequency?

phase of wave.
Dimmak0001
essemer
 
Posts: 11
Joined: Fri Apr 27, 2012 7:09 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 12:04 pm

If you want just to delay it by 1/8 of period (or wrap around), it shouldn't be hard, assuming you can have buffer long enough.

I don't think this could be of any use, though.
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Re: How to rotate phase of wav sample at 45 degrees

Postby treacherousumbrella on Thu May 17, 2012 12:21 pm

The delay time related to a 45 degree shift will be different for each frequency, proportional to the wavelength of that frequency. Shifting a harmonically rich waveform by 45 degrees requires a different delay time for each frequency present. You may want to look into both the Hilbert transform and allpass filter. It's not as simple as you might think unless you are talking about phase shifting a sine wave, in which case the delay time for a 45 degree phase shift can be easily calculated from the wavelength
treacherousumbrella
essemist
 
Posts: 65
Joined: Mon Oct 04, 2010 4:44 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 12:37 pm

Hilbert transform is quite different, as these are only two SINE waves which are shifted by 90 degrees.

You may try to google for "phase correction", however that's advanced topic and it will be hard to find something free and usable.
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Re: How to rotate phase of wav sample at 45 degrees

Postby Dimmak0001 on Thu May 17, 2012 1:00 pm

treacherousumbrella wrote:...unless you are talking about phase shifting a sine wave, in which case the delay time for a 45 degree phase shift can be easily calculated from the wavelength

Yes, please. How to calculate in that case?
Last edited by Dimmak0001 on Thu May 17, 2012 2:22 pm, edited 1 time in total.
Dimmak0001
essemer
 
Posts: 11
Joined: Fri Apr 27, 2012 7:09 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby treacherousumbrella on Thu May 17, 2012 4:41 pm

Sample rate / frequency(Hz) = Number of samples per cycle
360 degrees / 45 degrees = 8
Number of samples per cycle / 8 = Delay time in samples for a 45 degree shift at the frequency of the input sinusoid
treacherousumbrella
essemist
 
Posts: 65
Joined: Mon Oct 04, 2010 4:44 pm

Re: How to rotate phase of wav sample at 45 degrees

Postby MegaHurtz on Thu May 17, 2012 5:14 pm

Dimmak0001 wrote:I just want to rotate phase of wav sample around 'circle'( formula with 3.14 ). Not shift, but rotate to any degree from 0 to 180. ;)


180 degree is easy just invert :P
But a typical alpass has the same kind of 180 phase shift. So basically its a paradox :/.
But you could go around messing the signal and cpu up using a hilbert transform. Personally i`d just use it for single sideband modulation. I agree for practical applications a delay is a good solution for phase issues.
If that was what was said when i was skipping over the text, else ^^.
For a practical solution.
Last edited by MegaHurtz on Thu May 17, 2012 5:29 pm, edited 2 times in total.
Visit my website at: http://www.schlukhash.nl
User avatar
MegaHurtz
smaniac
 
Posts: 1515
Joined: Mon Aug 11, 2008 5:29 pm
Location: Eindhoven/Netherlands

Re: How to rotate phase of wav sample at 45 degrees

Postby Warmonger on Thu May 17, 2012 5:23 pm

Compute the offset as sampleSize * (phaseShift / 360), then just copy elementar samples in loop.

or just strat playback at offset and wrap it when it reaches sample's end, if you wnat to create a sampler.
Addictive synthesis.
User avatar
Warmonger
essemist
 
Posts: 172
Joined: Wed Jul 20, 2011 5:40 am
Location: Warsaw, Poland

Next

Return to Sound

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron