Pitch Shifting with changing the temp/speed

  • Thread starter btb4198
  • Start date
  • Tags
    Pitch
In summary, you can shift the pitch of white noise up by one octave by sampling it at a higher frequency.
  • #1
btb4198
572
10
so I have a white, brown, and pink noise generators and i want to shift the pitch up by one octave (12 semitones) from middle C, I need to sample 2 time as fast as I play the sounds correct ?

so in the c# code for my white noise generator I have it playing at 44100 Hz( the standard) but I am sampling the 88200 Hz
so it would be this :

buffer[n] = Amplitude * (2 * rnd1.NextDouble() - 1) * Math.Sin(Math.PI * Frequency * n2 / 88200D);

and this should work right ?
I have it set to 2 channels and 44100 Hz but I am sampling at 88200 Hz;

so it should move up one Octave from middle C, without changing the speed
is this correct ?
and if I were to sample at 22050Hz I would be move down one octave from middle C?
 
Engineering news on Phys.org
  • #2
If i play set my wav file to a sampling rate of 44100hz and 2 channels but i generate point using

buffer[n] = Amplitude * (2 * rnd1.NextDouble() - 1) * Math.Sin(Math.PI * Frequency * n2 / 88200D);

88200 hz is 2 time bigger than 44100hz that would be one octave below middle C? so the sound would be lower right? and it pitch shift white noise or pink noise lower after fitler between 2000hz - 500hz you should get thunder right ? is that correct ? or am i just wrong ?
 
  • #3
ok i just did this test. I removes the noise part and just play a normal sine wave so this:

buffer[n]= (float)(Amplitude * Math.Sin(Math.PI * Frequency * n1 / 88200D));

I set my wave file sampling rate to 44100Hz and channel to 2. so I am sampling 2 times faster and I am playing and it seem to be working : middle C (C4) = 261.6 Hz C3 = 130.8 Hz I played 261.6Hz and I got back 129.199 Hz that is really close. C6 = 1047 Hz i played 1047 Hz and I got back 522.180 Hz C5 = 523.3 Hz also very close G4 = 392.0 Hz G3 = 196.0 hz I played 392.0Hz and I got back 193.7988Hz
that is is off more than the others , but still close right? what do you think? oh I used another program i make to do the listening and that it how I know what Frequency i am getting back .
but it did not work when I added the white noise part. I have tried both : temp3[n] = (Amplitude * Math.Sin(Math.PI * (2 * rnd1.NextDouble() - 1) * n2 / 264600));

and temp3[n] = (Amplitude*(2 * rnd1.NextDouble() - 1) * Math.Sin(Math.PI * Frequency * n2 / 264600));

and I have change 264600Hz to everything I could think of... and it does not work... why? what does Audacity's change Pitch without changing tempo effect does that my does not?
 
  • #4
anyone?
 
  • #5

I can say that yes, your approach seems to be correct. Sampling at a higher rate (88200 Hz) allows for capturing more data points and therefore, achieving a more accurate and smoother pitch shift. Similarly, sampling at a lower rate (22050 Hz) would result in a lower quality pitch shift.

However, there are other factors that may also affect the pitch shift, such as the algorithm used for the pitch shifting and the quality of the noise generators. It's important to test and fine-tune your code to ensure the desired result is achieved.

Additionally, it's worth noting that pitch shifting by one octave (12 semitones) may not always result in a perfect octave, as the frequency ratio between two notes is not always exactly 2:1. It may be beneficial to implement a fine-tuning option to adjust the pitch shift by small increments for more precise results.

Overall, your approach seems reasonable and with some fine-tuning and testing, it should be able to achieve the desired pitch shift without changing the speed.
 

1. What is pitch shifting with changing the temp/speed?

Pitch shifting with changing the temp/speed is the process of altering the pitch (or key) of a sound while simultaneously changing the speed (or tempo) of the sound. This technique is commonly used in music production to create unique and interesting sounds.

2. How does pitch shifting with changing the temp/speed work?

Pitch shifting with changing the temp/speed works by using digital signal processing algorithms to manipulate the frequencies of a sound. By adjusting the frequencies, the pitch of the sound can be raised or lowered, while adjusting the speed can make the sound faster or slower.

3. What are the benefits of using pitch shifting with changing the temp/speed?

Pitch shifting with changing the temp/speed allows for a wide range of creative possibilities in music production. It can help create unique and interesting sounds, as well as allow for harmonization and layering of vocals and instruments.

4. Are there any limitations to pitch shifting with changing the temp/speed?

While pitch shifting with changing the temp/speed can be a useful tool, there are some limitations to consider. Extreme changes in pitch or speed can result in a loss of sound quality and may sound unnatural. It is also important to use high-quality software or equipment to avoid unwanted artifacts or glitches in the sound.

5. Can pitch shifting with changing the temp/speed be used in live performances?

Yes, pitch shifting with changing the temp/speed can be used in live performances with the use of digital audio software or hardware. However, it is important to have a stable and reliable setup to avoid any technical difficulties during the performance.

Similar threads

  • Introductory Physics Homework Help
Replies
1
Views
1K
Replies
8
Views
4K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
16
Views
5K
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
3K
Replies
2
Views
6K
Replies
16
Views
5K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
5
Views
6K
Back
Top