3

how to change frequency (pitch) and the amplitude in wave file using c# like this but on wave file not tone http://www.youtube.com/watch?v=Tumpkl-xJuA

Fadi
  • 2,320
  • 8
  • 38
  • 77
  • Sound is a very complex subject and your question is very broad. You probably need to start by trying to read a wave file into memory and break it out into the different chunks that define a wave file. To change the amplitude you'll just multiply each sample by a scale value. Pitch is a **very** advanced thing to change without changing other factors, so good luck finding anything on that without running into a patent. – BlargleMonster Jun 20 '13 at 19:49
  • no i want to do the same thing this guy do in video but on wave file not tone – Fadi Jun 20 '13 at 21:02
  • *pitch amplitude*? This makes no sense. – marko Jun 21 '13 at 08:11

1 Answers1

1

This answer here provides all you need to read a wave (.wav) audio file into a c# array. It normalises the values from -1.0 to 1.0.

So all you need to do is

  • Use the above code to read the file into a c# double array. It actually returns two arrays, one for the left and right stereo channels. Just uses one if its mono though.
  • Make the modifications to the c# array in memory:
    • Changing pitch means resampling the array at a lower or higher sample rate, in effect stretching or shrinking the waveform to adjust the frequency. You may need to use some form of interpolation at this point.
    • Amplitude adjustment can be done at the next step.
  • Write out the array into a new Wave file; refer to https://web.archive.org/web/20141213140451/https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ for full Wave format specification ... its not that complex.
dodgy_coder
  • 12,407
  • 10
  • 54
  • 67