http://robertinventor.com
October 21, 2017, 05:01:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Forum for Tune Smithy, Bounce Metronome and other software from Robert Inventor
Pages: 1 2 [3]
  Print  
Author Topic: Pitch Resolution and Retuning the Yamaha SW1000XG by hand  (Read 12859 times)
Robert Walker
Administrator
Full Member
*****
Posts: 165


« Reply #30 on: June 18, 2010, 08:26:59 AM »

Just a quick reply. Tried that - it does change the pitch, but despite the name, here anyway it does it by resamplilng rather than changing the sample rate.

The change of file size is a give away - if it does that then it isn't just changing the sample rate, it is resampling.

If it only changes the sample rate - then the waveform should look exactly the same in the editor after the change - same number of sample points per wave etc - even if you zoom in until you can see the individual steps - the steps should all be the same as well.

The file size should remain exactly the same number of bytes. That's because when you change just the sample rate - all you do is to adjust a few bytes in the header of the file where it tells any software that plays the file what the sample rate is to use for playback of the sample - and that's a fixed size field so it shouldn't change the size of the file at all.

Techy detail - its the nSamplesPerSec field in the WAVEFORMATEX structure at the head of the RIFF file, details here:
http://msdn.microsoft.com/en-us/library/dd757720%28VS.85%29.aspx
That's a 4 byte field near the head of the .WAV file. All you do is to change the number recorded there. The rest of the file remains unchanged when you do that.

If the file size changes then the loop points will need to be adjusted when you re-import it because there is a different number of samples making up the wave. The advantage of just changing the sample rate without changing anything else is that you don't need to do that, but that can only work if the file size remains the same.

Back to work on BM Pro. I'm hoping to get the next upload finished soon, maybe today.

After that, I will take a quick look at the FTS 3.2 version of the spectrum analyser and see if I can get the recording window to work very quickly like in a few hours to a day or two. I don't know how it will go just because I haven't even looked at that task in FTS 3.2 for a year or two now. But if all is well then I may be able to get it underway or at least get started thinking about how to do that.

Then I plan to work on the Lambdoma music therapy for a bit as I very much want to send the latest to Barbara Hero so she can take a look at it, but hopefully some time in the next week or two after that then I'll return to it again and do a bit more on it if necessary (if I don't manage it this we/e.)

Anyway I'll let you know more soon about how I get on with it in FTS 3.2 - my first impressions of how it is likely to go.

Thanks,

Robert





Linkback: http://robertinventor.com/smf/index.php?topic=58.msg185#msg185
Logged
Robert Walker
Administrator
Full Member
*****
Posts: 165


« Reply #31 on: June 18, 2010, 01:24:43 PM »

I found a way to change just the sample rate. It's a bit techy but straightforward.

So just did it and transposed an example exported audio file down by an octave by halving the sample rate, then imported it back into Viena - and it did change the pitch, and what's more, also preserved the original loop points.

So the method certainly works

TECHY DETAILS IF YOU WANT TO TRY IT YOURSELF

Here is how to do it if you want to give it a go.

You need to use a hex editor. I used WinHex. But it is pretty easy to do, so don't worry if you have never edited hex before.

Then open the .wav file. You will see its contents in hexadecimal.

Look for the sample rate. It is at the position 0x18, i.e. 24 bytes into the file, and is four bytes long, and all numbers in the header are recorded with the LOW BYTE FIRST (opposite of the order you'd expect)

So for instance if the original sample rate was 44100, then in hexadecimal this is AC44.

You can use google for decimal to hexadecimal conversions if you don't have a hexadecimal calculator:
44100 in hexadecimal = (google search)

AC44 is two bytes (its two hexadecimal digits for each byte). As a 4 byte number its 0000AC44

Since it is low byte first order, you reverse those bytes to get.

44AC0000

So look for that sequence of bytes in the file.

To reduce the pitch by an octave, then you divide that by 2, so using google again:
44100/2 in hexadecimal = (google search)
44100/2 in hexadecimal = 5622

Put this into low byte first order and you get
22560000

So edit the file in your hex editor and replace the 44AC0000 by 22560000

There's another field in the header you need to edit as well to make the header consistent - but no need to do that by hand, you can use Goldwave to do that.

Just open your edited file, and resave it in Goldwave. You can check that Goldwave does indeed play it an octave lower.

That works because Goldwave will happily open a file with just the sample rate changed - most programs will complain that it is "corrupted".

Now import it into Viena. Use the same file name you used when you exported it from Viena and Viena will replace the original sample, and play it an octave lower. Any the instruments in the soundfont that use that sample will play it an octave lower

This is basically what FTS would do if I program it to auto retune the samples in a soundfont.

For details of the .WAV file format in detail, with a nice diagram and an example,
WAVE PCM soundfile format

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg186#msg186
« Last Edit: June 18, 2010, 02:24:51 PM by Robert Walker » Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #32 on: June 18, 2010, 08:58:50 PM »

Wow that's amazing. Gonna try that soon.

Daniel.

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg187#msg187
Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!