## 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

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

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.

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

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

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

I ask what you mean by "phase of sample". Samples have no phase parameter as far as I know.
Addictive synthesis.

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

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

Phase of which frequency?
Addictive synthesis.

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

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

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.

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

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

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.

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

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

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

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

MegaHurtz
smaniac

Posts: 1514
Joined: Mon Aug 11, 2008 5:29 pm
Location: Eindhoven/Netherlands

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

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.

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: No registered users and 1 guest