robertinventor.com

Tune Smithy => How do I? => Topic started by: DanieLionius on April 23, 2010, 09:04:59 PM

Forum for Tune Smithy, Bounce Metronome and other software from Robert Inventor

Title: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on April 23, 2010, 09:04:59 PM
G'day Robert,

It's been too long!

I imagine you've been very busy...  :-\

I hope you remember me, Daniel from Australia. You helped me to get the playpack of MTS files working in the beta version, by rewriting some of the code for it!
 This is a great feature as it lets you achieve the good resolution and be able to output it to any of your synths (unlike Timidity, although it is a good program...)

Yes, so I purchased a Yamaha SW1000XG card on Ebay and have it up an running (the mother of all XG cards). It's a great card, with good voices and effects, and I use it with XG-Wizard and XG-Gold etc.

But of course I retune it through FTS, and change the scales with my drum machine as I play! And actually I did some tests. I recorded some of the standard pitches with FTS, and then analyzed them with the Analyze Recording Task, and noticed that the wavetable can vary by 1 or 2 semitones or more! And different voices will vary in their concert pitch! Doh! This is why I have some questions for you:

1) By adjusting each note by cents, I can tune each voice by ear using PB method and custom scales for each voice! (A wearisome task). So far I've achieved very good fine tuning with the rhodes voice! Q: Do you know if the pitches vary on the Yamaha all across all 128 notes or just across the octave? i.e. reusing the samples for each octave? If not you would have to manually retune all 128 notes!! which would lead you to probably having to load a .TUN file so you can have a pitch for all 128 notes. Which leads me to another question:

2) Can you currently load a .Tun file into FTS and edit it in realtime e.g. manually change cents values (like a piano tuner) for all 128 notes, in real time.

3) .Tun files are good because (besides facilitating 128 notes) they let you stipulate a base frequency for the scale. Can you have a different .tun file (scale for) per part with a different base freq for each in FTS? I haven't tried this yet but it would allow you to offset each voice to make sure they share the same Concert C Freq.

4) I know we have had lengthy talks about pitch perception in the past. You said my ability for fine pitch amazed you!! Well would you believe in fine tuning the synth I could hear pitch distinctions between .01 and .02 of a cent in the C3 - C5 range!! And I wouldn't call that fine tuning even, just getting it ti an acceptable level. The question is: Any idea at what stage the PB resolution will peak out? Isn't it at around .02 of a cent? I was increasing the multiplier by 0.16 thereabouts. I know that this increases the resolution, but I don't know how. Could you try to explain this, is it in the FAQ?

5) Well have some more questions about the tuner function in FTS and the Frequency Spectrum. I noticed that in tuning all the Cs with the Tuner in FTS sometimes with repeated tunings of one note the results would vary by 0.3 - 0.4 cents. (This was using the wave counting methon, and was for the Rhodes voice). On the other hand, upon recording the the notes and analyzing them in the spectrum, I noticed repeated tries gave a consistent Hz level. Do you believe the Analyze Recorded Voice function is accurate and to what resolution in Hz or cents do you think? This may just help determine to what degree the SW1000XG voices are out of tune and then I can apply offsets from ET to quickly offset all my Just Intonation scales, perhaps using a shortcut method in Scala.

BTW: I will make the offset scales for the SW1000XG available once I have a few voices fine tuned. Maybe even you could try 'em out if you have one of these cards!

Thanks for your brilliant work Robert,

Talk soon,

Daniel.

DanieLionius Guitars.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 01, 2010, 04:10:32 AM
G'day Daniel!

Yes very busy. Sorry for missing this post.

Yes I remember now, the idea we both had simultaneously for a new option in the FTS 3.2 beta to set the channels to play on each device, instead of parts, to use with MTS sysexes so you have a different sysex for each channel, to get an amazing amount of "pitch polyphony", up to 2048 unique pitches on one midi device if it supports per channel MTS sysex retuning.

I'm not sure I understand rightly. It sounds as though you are saying that the individual voices on the Yamaha SW1000XG are actually in different keys to each other when you play the same midi notes through them, so e.g. a 60 on one voice will play a C and on another voice the same midi will play e.g. a C#. But that seems hard to believe as it would make the soundcard unusable for many purposes. So I think I must have misunderstood in some way. I could believe that they vary by a few cents. Perhaps you mean the actual samples used for the voices in the wave tables?  - so that e.g. one voice would be tuned to a 60 at the correct frequency for middle C, another tuned to 61 for correct pitch for C# etc.

Quote
1) Do you know if the pitches vary on the Yamaha all across all 128 notes or just across the octave? i.e. reusing the samples for each octave?

Generally wavetable synths use different audio samples for each octave or so. It's to do with the timbre of the note, an iinstrument may sound very different in different octaves and just doubling the speed of a sample may not sound like the same instrument played an octave higher.

Within an octave they may use only one sample for entire octave, or only a few samples, depending on amount of memory needed.

Ideally you would want different samples for each semitone since each note has its own individual timbre on most instruments. Also you would want different samples also for many different volume levels for each semitone, as the quality of sound on an instrument varies as you change the volume so e.g. a note played ppp doesn't sound the same as a note recorded as FFF and then played back very quietly.

So that's what the like of Gigasampler etc do, they sample each semitone, and sample it at several different volume levels requiring gigabytes of memory for each instrument, so streaming from disk. They actually get players of the instruments to play every single note on their instrument at many different volume levels to get the samples. But wavetable hardware synths don't have the memory for all those samples, and have much smaller numbers of samples.

So - anyway so you can't rely on the same note being the same pitch in different octaves to better than a few cents, on most wavetable synths. I would expect that you need to retune all 128 notes individually in FTS. Sometimes they may use the same sample for more than one octave in which case e.g. all the notes on the instrument may be sharp or flat by the same amount for two or more octaves.

Quote
2) Can you currently load a .Tun file into FTS and edit it in realtime e.g. manually change cents values (like a piano tuner) for all 128 notes, in real time.

Yes you should be able to do that, I think. When you open a .tun file in FTS then what it does is to convert it into a scale of 128 notes - so yes, you can retune every note in the .tun file individually in FTS - and then resave the result. You can also do that in real time as far as I can remember, in the Scale window. I'll take a look and say a bit more about that in a minute in a separate post.

Since they use the same sample, you might well find that all the notes in an octave, or even several octaves, are sharp or flat by exactly the same amount in cents, which may speed things up a bit.

Quote
3) Can you have a different .tun file (scale for) per part with a different base freq for each in FTS?

Yes that should be possible by using the Scales for Parts. It's just a 128 note scale after all. You can also shift individual parts by any amount in cents in the Parts window (octave shift column, change droplist at the top to Interval).

Quote
4) I know we have had lengthy talks about pitch perception in the past. You said my ability for fine pitch amazed you!! Well would you believe in fine tuning the synth I could hear pitch distinctions between .01 and .02 of a cent in the C3 - C5 range!! And I wouldn't call that fine tuning even, just getting it ti an acceptable level. The question is: Any idea at what stage the PB resolution will peak out? Isn't it at around .02 of a cent? I was increasing the multiplier by 0.16 thereabouts. I know that this increases the resolution, but I don't know how. Could you try to explain this, is it in the FAQ?

Yes, that is an astonishing level of pitch resolution. But I can well believe that it is possible. A lot of it sometimes is just to let yourself  believe you can do it when others may say it is impossible, and learning e.g. to hear as a pitch difference what may originally sound like a difference of volume (because notes which are sharper by tiny amounts such as a cent or so or less, often just sound as if it's the same note slightly louder - or quieter - depending on whether the original note is high or low in pitch).

It's like looking at really faint galaxies in the night sky. Astronomers have the same eyes as everyone else, but because they spend ages looking at the night sky they can see faint smudges that are invisible to anyone else. Maybe partly eye gets more sensitive and maybe partly you learn to notice differences that most observers would find falls below the threshold of perception as "noise".

I know myself that I can train myself to hear finer and finer pitch discriminations. But nothing like that. For most musicians it is good pitch discrimination to get better than 4 cents (1 Hz at about middle C) for isolated individual notes and 10 cents, a tenth of a semitone is nothing to be ashamed of as a musician. You get much better discrimination for notes in chords if you listen out for the beats as a piano tuner does. But 0.02 cents means you are doing better than any tuner could do. At that level then you are talking about minutes for each beat.

So, obviously not using beats, unless you need to listen to each note for several minutes to do the discrimination, must be using direct perception of the pitch of the notes at that level of accuracy. If it is like the astronomers, then you probably don't have significantly more "hairs" in your ears to perceive the notes, just learnt to be able to pick out a slight variation in the signal from them that most people don't notice at all, is my guess.

Quote
5) Well have some more questions about the tuner function in FTS and the Frequency Spectrum. I noticed that in tuning all the Cs with the Tuner in FTS sometimes with repeated tunings of one note the results would vary by 0.3 - 0.4 cents. (This was using the wave counting methon, and was for the Rhodes voice). On the other hand, upon recording the the notes and analyzing them in the spectrum, I noticed repeated tries gave a consistent Hz level. Do you believe the Analyze Recorded Voice function is accurate and to what resolution in Hz or cents do you think? This may just help determine to what degree the SW1000XG voices are out of tune and then I can apply offsets from ET to quickly offset all my Just Intonation scales, perhaps using a shortcut method in Scala.

With the wave count method - you can get it to show the wave crossings, then can inspect by eye to see if it looks as if it is counting the waves accurately. It could show a variation of pitch by  multiples of 1 Hz if it skips a wave by mistake which it could do with a complex waveform. Or if the waveform is inharmonic, which is quite possible perhaps for the Rhodes piano, it could get confused about where the wave crossings are since the basic frequency of the note could have another frequency superimposed on it gradually drifting.

So for a complex waveform, especially if it is slightly inharmonic - and for the most accurate measurements like this, I'd be inclined to go by the fequency spectrum rather than the wave count. You can tell by looking at the waveform as it plays. If the waveform is continually changing shape -well you get some change of shape during the attack of the note - but during the sustained part of a held note - if the wave continually changes shape then it has some inharmonicity. For a wave like that then the frequency spectrum is likely to be more accurate for exact pitch detection since the wave count method can get confused about where to locate the wave crossiing.

With the wave count then to make it as accurate as you can try really long notes like several minutes or more maybe ten, twenty minutes or longer though that mightn't be possible if the instrument decays. Well same applies to frequency detection method as well, the longer the notes the more accurate the pitch detection. But expect you already know that.

Both methods are a bit of an art rather than a science when it comes to finding the pitch of inharmonic timbres.

No don't have the soundcard. But sounds like it is worthwhile looking out for it on ebay. I wonder if it works with Windows 7 which is what I mostly use nowadays.

Thanks for your interesting questions.

I'll check out a few more details and then do a second post. Forgot to answer about the maximum pitch sensitivity for MTS, will need to look that up.

Robert



Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on May 01, 2010, 06:57:50 AM
Thanks Robert,

by varying in concert pitch I meant that for say piano: it may be 2 cents flat from concert, but for say - guitar: it may be 1 cent sharp from concert. Something like that. But this of course relies on your ability to find the frequency of the note. I was using the Analyze Recording Task for this.

1) In regards to my pitch perception! Yes, maybe I was wrong. I am now finding that any small adjustments to scales I am making are not registering on my synth (please see question below), so I really am not sure what level things need to be for me to be happy with it! I think, growing up as an electric guitar player, and being able to bend all the notes with the whammy bar, has probably given me good pitch awareness and I get pretty unhappy if the guitar is not set up or it goes out of tune!

2) I've been using the Tuner in FTS (Ctrl + 62) to try and tune my 3/5 A. I'm trying to tune to 436.03 Hz thereabouts (3/5 A4 in Concert C). Using the pitch bend standard of +- 2 it should be 8192 steps per 200 cents right? Which gives a resolution of  0.0024 cents which is between around 436 - 436.0061 Hz. That's quite good resolution! And should be satisfactory for me. However, when I try and fine tune in FTS by adjusting my note value in the Edit Scale and Arp. and then check it with the Tuner or Analyze Recording Task I can not see a change in resolution between 435.85 Hz and 436.09 Hz thereabouts. That's about 0.95 of a cent! and too much disgression for my ears! It doesn't matter how I fine tune the note, I can not achieve a pitch between these two values! This leads me to believe something is not set up properly in FTS for me to get the full pb resolution. I have it set for +- 2 cents and am using the SW1000XG card which I'm sure has a default of 2 semitones, with the multiplier set at 1. Actually I tried relaying in Scala with same result. Perhaps you are right about the wave counting method. I was using the chorused piano patch. Maybe it is giving me a bad reading. But the frequency spectrum method is giving me funny readings (varying by 10s of Hz!). I will try mucking around with the spectrum anylzer a bit!

a) Can you think of an obvious solution to this problem?

b) Can you explain a little about how the pb multiplier works, mathematically, and how it increases the resolution?

3) Actually just to reiterate, I will explain what I'm trying to do: Because the SW1000XG voices are out by a cent or two I was not happy with the results of just retuning it into a Just scale. I had much more success doing this and then tweaking the values by ear. Then the idea occurred that I could record or play each note at a certain velocity, do a spectrum analysis and then enter the pitch into a data sheet, compare it with desired pitch and then apply an offset. By working out the 'percentage' that the frequency is out it can then be applied to any new desired pitch e.g. to recreate all my just scales etc. I hope to make this spredsheet available here when I have some 'concrete' data. Unfortunately I know very little about spectrum analysis. I have tried reading about it in FTS and being able to zoom in on the frequency etc. I'll have to spend some time working it out. If you could help me get some good data for one of the voices that'd be great! I was hoping to get things to a resolution of between 0.01 - 0.001 of a hz!

BTW: Congratulations on your continual development and refinement of FTS. I recently purchased the program! It is one of the hallmark midi applications on PC, probably the best microtonal app on PC (in my opinion that makes it very important to musicians). It simply let's you do nearly everything imaginable with midi. If you dream it up, Robert has probably thought of it and implemented it!!  However because of the mind-boggling level of options, and features - it can be a bit daunting! Robert and I have talked about this... It is like 201 programs in 1! Anyway, if I can be of any help in your planned refinement of the interface, I'd be honoured. In fact bouncing a few ideas back and forth to your users here could be a good idea.

Thanks!

Daniel.  


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 01, 2010, 08:11:07 AM
Hi Daniel

Quote
by varying in concert pitch I meant that for say piano: it may be 2 cents flat from concert, but for say - guitar: it may be 1 cent sharp from concert. Something like that.


Okay. That's quite normal for a wavetable synth I believe. With sound fonts, which perhaps are similar, you have to enter the frequency for each sample. I don't know for sure what the reason for this is - the technology and software is surely capable of much better.

After recording the note, the midi instrument designer must have to decide what pitch the sample is, when they set up the synth to play it, which may well be a cent or so away from concert pitch one way or another even if well tuned. I'd guess that very probably the entire instrument could easily be a cent or two sharp or flat of concert pitch in case of a keyboard instrument and with smaller variations from note to note.

So, perhaps it's just because designers of midi instrument don't bother to try to find its frequency to better than a cent or two, which for most midi applications is quite adequate but no good for the more demanding microtonalists. Not so easy to find software that lets you find the frequency of short notes to better than a cent or two, which is perhaps partly why it happens.

Quote
1) In regards to my pitch perception! Yes, maybe I was wrong. I am now finding that any small adjustments to scales I am making are not registering on my synth (please see question below), so I really am not sure what level things need to be for me to be happy with it! I think, growing up as an electric guitar player, and being able to bend all the notes with the whammy bar, has probably given me good pitch awareness and I get pretty unhappy if the guitar is not set up or it goes out of tune!


Yes been there myself.

Yes it's really hard when you get to the finest pitch resolutions to tell whether you can really hear a difference or not. I think that when you get to the limits, then you can often hear pitch differences but can't articulate them and e.g. you may know the notes are different in pitch but not sure which is the higher in the two. That definitely can happen when pitches are really close together and you are training in pitch discrimination - statistically it turns up random if you try to test for pitch discrimination, but you do actually hear a difference, just not yet got very good at hearing which of the two is the higher in pitch.

Also, that's very hard to distinguish from the situation where you think they are different in pitch but they are just slightly different in volume instead, because one listens so hard the mind begins to hear things that aren't really there.

You could use FTS to test for this - except trying it right now in the beta it doesn't seem to be working, so may be some bug to fix there.

Idea is to get it to use the random chord quiz in window 28, do them as sequences, set the scale to e.g. 1 cent (or whatever level of pitch discrimination you want to check). Set up three arpeggios, one to play the sequence 0 0 (no change in pitch), one to play 0 1, and one to play 1 0. So - objective is to see if you can tell whether the pitch goes up, goes down, or doesn't change at all. It's a sign of being able to tell the difference if you can tell that it changes pitch even if not sure which way it goes, so if you can tell the 0 0 sequence from the others, get it right more than a third of the times it gets played - then you can discriminate the pitch although maybe not sure yet which way it goes. You could expect then to learn to discriminate up from down for these very fine pitch distinctions with more practice.

I'll give that a go some time when I get back to work on FTS 3.2. Rather a lot on my "to do" list right now so not sure when I'll be able to work on the beta in a sustained way. Hopefully some time late spring or summer. But from time to time do a session or so of programming on FTS 3.2. so can give this a go.

Quote
2) I've been using the Tuner in FTS (Ctrl + 62) to try and tune my 3/5 A. I'm trying to tune to 436.03 Hz thereabouts (3/5 A4 in Concert C). Using the pitch bend standard of +- 2 it should be 8192 steps per 200 cents right? Which gives a resolution of  0.0024 cents which is between around 436 - 436.0061 Hz.


I make that 200/8192 = 0.024 cents. But whatever it is plenty fine enough for even very demanding microtonalists, it would be a rare situation indeed where you need better pitch resolution than this.

Quote
That's quite good resolution! And should be satisfactory for me. However, when I try and fine tune in FTS by adjusting my note value in the Edit Scale and Arp. and then check it with the Tuner or Analyze Recording Task I can not see a change in resolution between 435.85 Hz and 436.09 Hz thereabouts. That's about 0.95 of a cent! and too much disgression for my ears!


When I read this, first I wondered if perhaps it is discarding the fine tune part of the pitch bend - but seems it is doing a bit better than that.

If you use just the coarse pitch bend range which is 128 (2^7) for the entire pitch bend range instead of 16384, it's 64 pitches to cover two semitiones instead of 8192, or 200/64= 3.125 cents resolution. Designers of a synth could argue that that is better than most musicians pitch resolution, so if the pitch bends are designed mainly for pitch bending using a pitch bend wheel, it will sound like a smooth glide rather than separate pitches to most musician's ears - though a few will hear the pitch glide as a sequence of steps like a microtonal scale with 32 pitches per semitone.

But 0.95 of a cent is between the two, better than coarse pitch bend, worse than the high resolution that fine pitch bend retuning is capable of. But it could be that for some reason the synth just isn't programmed to work to better than a cent of resolution for the pitch bends.

Quote
It doesn't matter how I fine tune the note, I can not achieve a pitch between these two values! This leads me to believe something is not set up properly in FTS for me to get the full pb resolution. I have it set for +- 2 cents and am using the SW1000XG card which I'm sure has a default of 2 semitones, with the multiplier set at 1. Actually I tried relaying in Scala with same result.


Okay rather sounds like an issue with the SW1000XG unfortunately

Quote
Perhaps you are right about the wave counting method. I was using the chorused piano patch. Maybe it is giving me a bad reading. But the frequency spectrum method is giving me funny readings (varying by 10s of Hz!). I will try mucking around with the spectrum anylzer a bit!


Oh the chorused piano may be a puzzle for it. It is usually done with several samples slightly out of tune with each other played simultaneously:

http://en.wikipedia.org/wiki/Chorus_effect

What happens with other voices?

Quote
a) Can you think of an obvious solution to this problem?


Unfortunately, no. Is it the same for all the instruments? Try other instruments in case they differ. Especially since Scala also does the same thing, sounds to me like it may well be that the synth just doesn't do pitch bend retuning to better than about a cent for some reason. It's not likely that the midi pitch bends sent by FTS would be in error just at the cent level - most bugs are more obvious than this. Could be but a bit unlikely.

You can test to make sure. Try recording to a midi file as you play the two notes. Then inspect the midi file in the More (2 times) version of Record to File (Ctrl + 11). Go to List all events. Look for the pitch bends. It will say what exact pitch bends were sent.

Quote
Can you explain a little about how the pb multiplier works, mathematically, and how it increases the resolution?


The pb multiplier just multiplies the pitch before converting it to a pitch bend. It won't increase the pitch discrimination. Just means you can e.g. move a pitch bend wheel further to get the same amount of pitch bend.

To increase the resolution in midi the only way is to reduce the pitch bend range. You can make the pitch bend range 0.5 of a semitone and still play all the notes you want. If just 5 limit just intonation you may not need to retune as far as 0.5 of a semitone in which case you might be able to make do with a quarter of a semitone or better.

But that all assumes the device you are using has the capability of playing such fine pitch bends.

For really fine pitch resolution, then wave table synths are hard work because of the way they are designed around recordings of live musicians. While FM synths are much better in this respect because they make the sounds mathematically. Including the wave shape player instruments in FTS.

Though I understand, that's no solution if you want really good pitch control on natural sounding instruments.

I don't know if there is any tweak you can use for this - a question for any experts on how these hardware synths work perhaps.

Anyway yes - you can try out a midi recording in FTS just in case it is a bug and if it is of course I'll do what I can to fix it. But on the basis of what you've said so far, I rather suspect the issue is to do with the internal workings of the SW1000XG

Anyone reading this know any more about all this, about the pitch resolutions of hardware synths like this, how they work, or have any ideas about how to solve Daniel's question?

Quote
Congratulations on your continual development and refinement of FTS. I recently purchased the program! It is one of the hallmark midi applications on PC, probably the best microtonal app on PC (in my opinion that makes it very important to musicians). It simply let's you do nearly everything imaginable with midi. If you dream it up, Robert has probably thought of it and implemented it!!  However because of the mind-boggling level of options, and features - it can be a bit daunting! Robert and I have talked about this... It is like 201 programs in 1!


Thanks!

Yes, indeed completely agreed about that. Do hope I can improve this with FTS 3.2. I'm hopeful that I can since BM Pro has worked out well and I've learnt a lot from it. I just don't get the same reactions about BM Pro that I get with FTS 3.2. Its users generally don't seem to find the complexity daunting in anything like the same way that FTS users do. So I hope I can more or less completely solve this when it comes to FTS 3.2 when I have time to work on it properly.

Quote
Anyway, if I can be of any help in your planned refinement of the interface, I'd be honoured. In fact bouncing a few ideas back and forth to your users here could be a good idea.


Thanks, I'll let you know when I start work on it. I've got a short e-mail list of users who want to be notified when I start on the FTS 3.2. beta so will add you to it in case I forget.

Yes discussing it here on the forum seems like an excellent idea in case there are others who visit who can step in and help in one way or another. I'll do that when the time comes.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on May 01, 2010, 10:15:02 AM
Ok, RI!

Lots to digest there.

Get back to you soon with it.

Dan.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on May 05, 2010, 12:00:25 PM
So.... Robert,

I've done a little reading on XG to find that the pitch bend sensitivity is set to +- 2 by default. And it does indeed use the full 14-bit resolution so I do not know why the voices will not tune to a resolution of better than about 1 cent. I cannot get in between the gaps of about 1 cent!?!
 On the plus side it seems that the Spectrum Analyzer in FTS is very good. Repeated recordings of the same pitched note usually give readings varying of only 1,000th a hz, if that - so it should prove to be a useful diagnostic tool!

One thing that I found is that on the XG you can use an RPN message to change the coarse tuning or fine tuning of the note. Coarse in in semitones; fine is in 100/8192ths! - which should provide excellent resolution. I've yet to see if the fine tuning parameter will sufficiently change the frequency of a note but i can easily test that in xgworks tomorrow. I'm guessing sending an rpn will change the value for the whole channel not for a single midi note but..... a solution immediately sprang to mind.

Instead of sending pitch bend messages, you could send RPN fine tuning messages to seperate channels depending on the midi key pressed - just like the method in FTS for pitch bends.

Unfortunately, I have no idea how to do this - so thought i could ask you! It might be easier or harder than I think.....

What do you think? I think the idea has potential for a lot of people who want to retune their sample based synths to a really good resolution - if it works?!?

So I'll test the tuning of that fine tuning parameter tomorrow.   

Great - another crazy, ambitious, workaround. You know, I resent being a good-eared, caring, sensitive musician microtonalist guy I really do!!

So of course you will need to apply an offset for EACH midi note just yo put the damned wavetable back into perfect ET, and then you can either apply the pitch bend method, but that depends on whether the voice tunes to the full pb resolution (which it wasn't).

The other way is to have a tuning table full of all these offsets and the fine tuning rpns for each scale for each voice!

And another way is that you have an algorithm for the scale you have set in FTS to automatically add or subtract the needed fine tuning value for that scale....

But I don't even know how to send an rpn by pressing a midi key yet.....

If you like.... there are details on the rpn messages on the www.studio4all.com (http://www.studio4all.com) website and also by googling "xg guidebook".

BTW: Also of smaller concern is that when you load seperate .tun file for each part in fts, they will all tune to the freq in the pitch window. You have to aply an offset in the modulate by cents drop down. That's not too much trouble. It'd be nice to be able to have a feature to define the freq for each part, or even for it to load the .tun to the freq. given in the file.

It might be cool that when you modulate by interval (in the parts window), say 27/32 from C4, that instead of starting that scale from the C4 key again, you start it from the Eb4 key. In other words, being able to set the midi note for 1/1 for each part. Maybe I'll put that in the Wish List Section in the forum.

So before I get crazy on this idea, i'll check that the fine tuning works. But why would they have q fine tuning if it didn't work?? God knows, Yamaha?!?

Ok, seeya mate!

Thanks again.

Daniel

BBTW: setting these offsets makes a big difference, I can DEFINATELY hear it. If you like I'll do one for the SYXG50 VST so you can hear and compare, if you like??


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 05, 2010, 01:23:38 PM
Daniel,

Yes I could add that as an option to vary the fine tuning and coarse tuning for the channel instead of sending a pitch bend, would probably be quite easy to implement and just add as an extra check box in the UI. It already uses rpns to set the pitch bend range, so it is same idea only to set the channel coarse and fine tuning.

But I think you'll find the sensitivity is less than you expect. The fine tuning has only 2^7 i.e. 128 bits which covers +- 1 semitone, I think it is, so that gives a sensitivity of 100/64 or a bit over a cent, so not enough for your purposes.

The thing is, your 100/8192ths is in semitones, not cents, so it works out as a resolution of 1.22 cents.  I wonder if that is anything to do with the other thing about its rather coarse 1 cent resolution response to pitch bends?

Can't tell why the pitch bend resolution would be less than you'd expect without knowing how the hardware and software works. But an example, of the sort of "gotcha" that could happen - suppose someone programmed the coarse and fine tuning first - then converted any input pitch bends into coarse and fine tuning, instead of directly into a frequency change, thus losing some of the resolution - then you would have a resolution of 1.22 cents for the pitch bends.

Yes you are right, if you want to load multiple .tuns - as it is at present, you'll need to just load them to convert them into scales, then copy / paste the scales into the separate parts and then apply individual pitch offsets to each one. I don't think that it would be able to load a .tun file into an individual part for the Scales for Parts option.

So - that's something to add to the wish list.

Yes for suitable voices the spectrum analyser can achieve those sorts of resolutions, such as 1,000th a hz, that's its "selling point" as it were, though it isn't well automated at present, and you have to make decisions about whether to use the spectrum analyser or count waves. With the spectrum analyser one should take a good look at the spectrum to make sure the dots do lie on obvious peaks and that the spectrum does have clear peaks and that it isn't identifying peaks in a part of the spectrum that is obviously noise.

But when the instrument is suitable and you match the method to the instrument, it can achieve really good pitch discrimination and I think you'd be hard pushed to find another program that can do it more accurately :-).

I did many tests with various waves generated with known pitches,and they found pitches accurately and consistently.

I'll do a second post answering the rest of what you say but thought you'd like an immediate reply about the coarse / fine tuning. Do correct me of course if I have misunderstood or what I say doesn't match what your manuals say.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on May 13, 2010, 07:22:16 AM
Hey robi,

Just giving you some more information for you about the SW1000XG. I have done some tests, and it seems that every 41 out of 8192 pitch bend increments will yield a change in pitch of approx. 1.15 cents. I checked this with the grand piano voice (I assume the other voices will follow suit). I checked by setting a pb in xgworks and recording it and then getting the fts spectrum analysis. I must have done this about 30 times! I have it in a spredsheet which i can put up here when i'm not on the iphone.
 So 8192 / 41 = 199.8 Which tells you that the synth has an intended resolution of 1 cent. Oh well. I haven't checked to see if changing the sensitivity to 1 will halve it but from a few preliminary tests - i don't think so.

So.... yeah, I've been a little bit miffed at yamaha for a few days. It definitely showed me that as a person that wants a just intonation scale with fairly good resolution (in the modern world), I've got my work cut out for me.

Oh well....... one mustn't give up. Maybe you know of an XG or otherwise synth that uses the full pb resolution? I might talk to Manuel about that...

You mentioned a way to set the frequency for soundfonts somewhere here on your forum. A good soundfont player is that sfz+ program plus you mentioned another one on another post.
Short of sampling my own fonts, how can i dictate the frequency for each sample in the bank? Will Vienna do this? You mentioned the autotune program. But that only retunes .wav files and the like doesn't it.

It seems like the next step for me would be to experiment in getting soundfonts tuned to exact ET and then use FTS to retune. I think many of the available soundfonts are probably out of tune from ET by varying amounts, would you say?

A quick way to detect their frequencies and then retune using some kind of FFT would be ideal. And then would they respond to the full 8192 steps or foes that depend on the player?

Probably my future is going to be in some kind of physical modelling, and using old analogue circuitry, (like the modular synths) to create great natural sounding microtuning synths with good resolution. I believe analogue synths could still create better resolution because they are on an electron rather than digital level.

Sorry, a lot of questions there. I will post those spreadsheets up soon...,

Daniel. 


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 13, 2010, 08:27:56 AM
Hi Daniel,

Yes, most curious. I can't think why the resolution of a midi synth would be about 1 cent, or every 41 pitch bend increments.

I don't know whether or not it would make a difference to try another instrument. If it does, you'd get the most accurate pitch readings for either a very pure waveform such as the Ocarina and use the wave count method, or one steady in pitch without vibrato and rich in partials such as reed organ (possibly) for the FFT method. The piano would be likely to be a bit tricky because of its non harmonic partials but sounds as if you are getting good readings for it even so.

Yes you could retune the samples if you can get at them. Yes indeed, at the sub 1 cent level, I'd expect most sound fonts to be slightly "out of tune".

One trick is that you may find that the sample player will accept any value you like for the sample rate, not just the standard values like 44100. If so then you can retune a sample by just changing the sample rate without changing the waveform at all, just resave it with a new sample rate. It is a while since I did anything with the Vienna software and can't remember now how it works, sorry, so can't help with details of how to do things.

I'd expect a software sample player to play the full pitch bend resolution, but haven't done tests for this. When testing for pitch bend accuracy my aim usually is to check that FTS is working okay and for that I use e.g. the FM7 etc. rather than a sample player because of the way sample player pitches are so dependent on the correct pitching of the samples - so I haven't tried examining sample players in high resolution pitch wise.

Anyway yes, you could try using a sound font or sample player and play sound fonts like that, it might give you the resolution you need. It sounds like a good idea to explore to me. I don't know much about physical modelling. There are some CSound instruments I know of that use physical modelling but they don't sound that "life-like", though interesting in their own right. Perhaps there are better methods available now.

Yes automatically retuning an entire sound font does sound like something ideally suited for FTS so long as it is able to detect the pitch of the samples exactly.

You would tweak FTS to measure the pitch of a particular instrument very accurately first. Then set it to batch process e.g. all the files in a folder, and automatically detect the frequencies, then retune them as exactly as possible to the nearest 12-ET note by adjusting the saved sample rate. I could see it doing that so long as the pitch detection is sorted out.

So, I can add that to the wish list for FTS 3.2 for some time in the future. Basically I'd say feasible and relatively straightforward, since you find FTS can detect the frequencies accurately for the played notes it should be able to do the same for the samples they are based on, I'd have thought, then rest is routine programming.

Easiest to do if the sample rate changing trick works for the target sample player. Or if that trick doesn't work, you could still slow down or speed up the note and resample - you'd need to do a lot of interpolation to do that, main concern would be whether the sound quality suffers and it might involve careful programming to find clever ways to interpolate to minimise effect on the sound quality, but probably doable. The resampling would be toughest for the highest pitch notes - at very high pitches you have only a few samples for each wave.

Again, if anyone reading this has any idea about what may be causing this 1 cent pitch resolution of the Yamaha SW1000XG in response to pitch bends, do step in and say more about it, if you have any thoughts about it at all that may be a lead on what is happening.

Thanks,

Robert


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 15, 2010, 02:20:02 PM
Hi Daniel,

Just been talking to Jeff Scott who is the software author of Li'll Miss Scale Oven (http://"http://www.nonoctave.com/tuning/LilMissScaleOven/") for the Mac and knows a lot about the hardware side of things. He is much more expert in that area than I am.

So anyway - he had a few ideas, though none of them solve your problem, just to do with trying to understand why it might happen.

Anyway he also found it a bit of a puzzle. He agreed that it's unlikely to be anything to do with the actual calculations used to adjust the waveform itself to do the pitch bending, which should be way more accurate than is needed. It could be that the synth just discards some of the information in the pitch bends before processing them. Many synths use only 7 or even 6 bits for pitch bends sent when you adjust a pitch bend wheel  (128 or 64 separate values for entire range) - though with more recent synths 10 or 12 places are more likely (1024 or 4096 separate values). That's to do with the resolution of the analogue to digital converter from pitch bend wheel postion to digital midi pitch bend messages.

So even though the soundcard doesn't have a pitch bend wheel, its probably using the same chip, and it might be that they use the same resolution as the pitch bend analogue to digital converter (ADC) throughout. But if that is what it was, you'd expect the total number of pitch bend steps to be a power of 2 (e.g. +-64 or +-128 steps etc) which doesn't fit with your 41 pitch bend increments observation.

So - he thought from what we know so far, it might perhaps be due to the 12 note tuning system for the XG synth, which is adjusted in increments of 1 cent at a time for range of + - 64 cents. Maybe for some reason they use that throughout internally instead of pitch bends and transform pitch bends to the tuning in cents. Seems a bit surprising but may be the reason - maybe they designed the tuning table features of the chip first, and then added on the pitch bends later??

So anyway that is the best guess we have come up with so far, but not conclusive at all.

To know for sure need someone who can tell us how the hardware Yamaha XG midi synth processes pitch bends.
 
Wiki article:
http://en.wikipedia.org/wiki/Yamaha_XG (http://en.wikipedia.org/wiki/Yamaha_XG)

I found a data sheet for the Yamaha XG chips for notebooks here, which perhaps might be related
http://en.wikipedia.org/wiki/Yamaha_YMF7xx (http://en.wikipedia.org/wiki/Yamaha_YMF7xx)

But unfortunately, it doesn't tell you anything about how the midi synth pitch bends work.

However he also had a suggestion which may help you to find the resolution more quickly so you can e.g. try it out for many instruments, and varying pitch bend range etc, faster than using the FTS spectrum analyser or wave count to find the frequency of each note.

Also this could help to test new soft synths, hardware synths or soundcards as a quick way to check that they have something like the resolution you require (then if you find one that passes this test you can then measure the exact frequencies to make sure).

Perhaps you have done this already? If not then this may help.

The idea is rather than find out the exact frequency of each note, just look for when the frequency changes.

The easiest way to do it in FTS is to set it up with a scale of say 0.1 cents equal steps, so that successive notes on your midi keyboard or the on-screen PC keyboard player play pitches just a tenth of a cent apart. Just enter "0.1 cent" as the scale step instead of e.g. 100 cents for 12 equal.

Then play two note chords in that scale, keep one note as the 1/1, and then vary the pitch of the other note - and look out for sudden changes in the beats pattern, which will show that the pitch of one of the notes has changed. This will be easiest to hear with high frequencies.

If you have better than 1 cent resolution in your hearing for melody lines without chords, which I think some musicians do, you might be able to hear a 1 cent step. But with playing chords and listening for changes in the beat patterns, you can hear even tiny changes in pitch using this technique, well beyond whatever your best resolution is for monophonic lines.

That will give a first idea of what is happening. If you find all the notes are distinct in pitch with 0.1 cent steps you can try smaller steps e.g. 0.05 cents etc until you find out what the resolution is in cents (or you could use midi pitch bends similarly, just that doing this scale approach in FTS may be a quick way to do the experiment).

You can vary the pitch of the 1/1 to try this experiment for different frequencies. Then if it passes this test, you can then do frequency measurements with FTS as a final check.

So anyway thought that might be a useful idea to pass on.

Again, if anyone reading this knows anything about the design of the Yamaha XG synths that may bear on this do say. Jeff - do step in if you have anything to add or correct in what I have said.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 15, 2010, 03:01:15 PM
BTW just tried out Jeff's method with the Ocarina instrument on the Microsoft GS Wavetable synth which comes as part of DirectX so on many computers. All the notes for a one cent pitch range seem to be identical - then it jumps to another pitch for the next cent.

http://en.wikipedia.org/wiki/Software_synthesizer#Microsoft_GS_Wavetable_Synth (http://en.wikipedia.org/wiki/Software_synthesizer#Microsoft_GS_Wavetable_Synth)

For differences as small as 0.1 cents or less then if the notes are genuinely different in pitch then you get really slow beats like several seconds for each beat. But it's not that, with the Ocarina on the Microsoft GS Wavetable synth you get no beats at all like this:
-0.3, -0.2, -0.1,
1/1, + 0.1, + 0.2, ... , +0.7, +0.8, + 0.9, + 1.0, + 1.1, ...

The 1/1 beats with the -0.1 and with the + 1.0. But the pitches from 1/1 to 0.9 are all beatless with each other and the 1/1. They all beat with the -0.1 in the same way (even the 1/1) and all beat with the + 1.0 again all in the same way, even the +0.9.

Strongly suggest it has an internal 1.0 cents resolution for some reason.

That's for concert pitch BTW.

That suggests the same may happen with the Roland Sound Canvas since it uses the same software - and that is remarkable considering that it is presumably all done in software.

Some of the other instruments are hard to test because they have a bit of residual vibrato or tiny variations of pitch perhaps during the note, anyway it depends when exactly each note starts as a note can beat in an irregular fashion even with another note at the same identical pitch.

When I try it with e.g. the triangle wave for the Waveform player in FTS then you get really slow beats when you play two notes 0.1 cents apart - and you have to wait a moment to make sure that the volume is changing. The beats then are faster if the notes are 0.2 cents apart and so on, gradually get faster and faster as the notes get further apart.

So you can try that one out first to get an idea of what you should hear if it is working properly.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 15, 2010, 03:44:18 PM
That was a real surprise, didn't expect that to happen with what is basically a soft synth.

Just tried it out with the Yamaha XG WDM soft synth and that does the same thing too, so I've duplicated your observations there - again that one has the jumps in pitch exactly at one cent intervals relative to concert pitch. Which has no connection at all to the way the pitch bends work with 4096 pitch bend increments to a semitone, it must be that it uses some other system internally based on cents rather than pitch bends.

Tried it out with the Roland VSC and that works exactly like the FTS triangle wave, really slow beats for the 0.1 cent intervals gradually increasing the further the notes are apart. So it has pitch resolution at least 0.1 cents, so that's an example of a wavetable soft synth with better than 0.1 cent resolution.

Should try out a few more but I don't have much of that sort of thing installed on my computers at present (mainly focussed on programming just now).

So anyway definitely something to do with how your Soundcard works I'd say,  and sadly, probably nothing you can do about it though if there is anyone who knows how the card works in techy detail maybe they could say more, so need to look for sample player, or sound font player or similar.

The Roland Sound canvas is a reasonable wavetable synth, not stellar perhaps but has nice sounds, comparable to the Yamaha soft synth, different in the actual sound set you get.

It's 5/4 is pretty much beatless on the Ocarina, maybe a little "soft" for high pitches but not bad at all. But on most other instruments the 5/4 on the Roland Sound Canvas beats quite strongly, with a wide variety of beat rates.

Sometimes it is because the instrument has a small amount of vibrato or tremolo when played on its own with no effects (usually meaning the recorded sample had level of vibrato or tremolo in it already when recorded) - but others I think may just be because the patches are a little out of tune - just now testing the 5/4 on the Roland Reed organ and it is beatless at some frequencies and has beats at others - not in a regular fashion it is just kind of random depending on both the choice of 1/1 for the 5/4 interval and choice of instrument - so I think that is a sign that the beats are caused by recordings in the wave table a cent or two above or below concert pitch, best guess anyway for why it happens.

So anyway if you had a wavetable synth, soft synth or sample player with the resolution of the Roland Sound Canvas - together with a sound font with perfectly in tune patches played without vibrato or pitch variation of any sort then you would be close to what you want.

If you did auto retune all the notes in the table for a sound font, if the individual notes vary in pitch slightly (not necessarily vibrato, just a small variation of pitch during the note) then you will still get beats when you play the notes with each other or even when you play unisons. So you need to make sure that the pitches are very steady for instruments of interest.

I haven't tried measuring the Roland Sound Canvas pitches with FTS but these tests probably give a good idea of what one would find if one did. I don't really have the time to do it at present as it is a bit slow measuring the frequencies like that - have to record a note, then take its spectrum and do the analysis for each one as you've discovered, and it needs to be automated more when I get the chance to work on it again.

The next obvious thing is to test sample players and the like. But I have a new installation of Win 7 on my computer which I've been using for programming rather than for composing or making realisations of tunes etc - so I haven't installed any of those yet. I'll give them a go some time.

Anyone reading this got any recommendations of wavetable synths, soft synths etc for beatless harmonies? Or any sound fonts that are already tuned sufficiently accurately e.g. all the samples accurate to within 0.1 cents of concert pitch (or preferrably better as you would still notice a 0.1 cent deviation as very slow beats), for this sort of work?


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 16, 2010, 01:07:57 AM
Hi Daniel,

Just tested the SynFont player and it passes the test for 0.1 cent steps distinct in pitch and close together pitches beating at similar rates to the FTS waveform player on triangle wave - and also passed the beatless 5/4s test:

http://www.synthfont.com/SyFon_news.html (http://www.synthfont.com/SyFon_news.html)

I tested it with the TimGM6MN.sf2 sound font available here:
http://ocmnet.com/saxguru/Timidity.htm (http://ocmnet.com/saxguru/Timidity.htm)

and it had beatless 5/4s for e.g. the reed organ. (Ocarina isn't a fair test for beatless 5/4s since the instrument needs to have a reasonably prominent 5th harmonic to hear the beats).

Tested that with a scale:
5/4 380.0 385.0 390.0 400.0
so you can compare the 5/4 with other close approximations quickly on different instruments and pitches for the 1/1.

I've found in the past that often the smaller sound fonts are better for j.i. harmonies as they use fewer samples per instrument. If e.g. you had just one sample for the entire range of the instrument and that sample is played at a steady pitch then it would be perfectly in tune throughout the range and the most that can go wrong is that the entire instrument might be sharper or flatter than other instruments by a few cents.

Some of the instruments in this sound font have residual tremolo or vibrato on some of the notes. E.g. some of the trumpet notes (not all of them, depends on the frequency).

Apart from that pretty good so far. Maybe the font designer retuned the samples to ET when designing the font? (e.g. with Autotune? - does that retune them to this level of accuracy I wonder).

Actually that's also a thought. Retuning a wave table to equal temperament isn't particularly microtonal, so maybe someone else has already designed a program to do this or maybe Autotune or similar can do it?

FTS if reprogrammed could probably do a particularly good job of this task, because of its focus on detecting pitch as exactly as it possibly can - but if the samples are long enough wouldn't be that hard for software to find the pitch to within e.g. 0.1 cents or better to auto retune it.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on May 19, 2010, 03:35:35 AM
Just fixed a bug in the FTS 3.0 release which may affect you if you try out the 0.1 cents scale idea from the PC keyboard instead of from a Midi keyboard

Details here: Tune Smithy 3 - Minor Bug Fixes - May 19th, 2010 (http://www.robertinventor.com/software/tunesmithy/bug_fixes.htm#2010_05may19)



Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 04, 2010, 09:56:13 AM
Hi Rob,

have been meaning to give you an update on this. Have been quite busy at college, and we have exzms coming up (again). There's quite a lot I've been wanting to bring you up on.

First of all I'll say the most success I've had with retuning a synth is with a nasty little soundfont called the CT4MGM.sf2 I think it's called (Creative Technologies 4 Meg General Midi) that is onboard the Audigy 2 card, because you are absolutely correct about sampling techniques for smaller fonts. My firdt foray into microtuning was me putting some favourite midi files through Timidity into a just scale with the CT4MGM loaded, and tuning wise, to this day, these still sound the best - but not perfect - and now I know why.
 After putting a voice range through the spectrum analyzer, I can see that you will get a cluster of notes with the same offset to ET (say C3-G3 offset all by .5 cent) but then suddenly your G#3-C4 range are all out by maybe as much as 4 cents! So you were entirely correct - you may have a large set of notes all using the same sample with the same offset to ET. (Some of the samples are quite close, others not).

So this poses a problem, and is probably even unknown to many microtonalists.

As for the SW1000XG, you are simply not going to believe the trouble I have had trying to retune that! For a start the pitch bend will only change every 41 steps, and the every 6 or 7 one of them is skipped so you actually won't have a change in pitch for 82 steps!! It's true, I have tried it for about 1/2 range for the C4 voice on Grand Piano (that's about 100 recordings!). I have tested the range in small increments and have zrroed in as 41 as the resolution increment, although why they leave out a step every 6 or 7 is beyond me, maybe the increment itself changes, or they just leave one out, I haven't checked yet. Yes, I know it sounds hard to believe. They couldn't have made it harder to retune!!
 Also they double up on samples for different notes e.g. The same sample for C4 and B3, only they take C4 halfway through it's pitch bend range, and make that B3. This means that the whole sequence of steps with every 6 or 7th left out is changed for B3, and is no longer predictable. In short the PB increments are unpredictable for many of the notes, and this makes it very hard to set up a spreadsheet to offset to the right PBs. It sounds like a nightmare - and it is!  >:(

The only way to get around this is to record the PB increments for every key for every voice and enter them into a data sheet and do a match up affair. It's a stupidly momentous affair. I already have the spreadsheet, just not the data! But the reason for doing this is that you could predict your offsets, and get them within good range of each other. Right now I have Grand Piano C IonianJust differing by at the most .5-.6 cents and it sounds a damn sight better than ET, and actually not TOO bad!

So, on any hand, to get a good result from an existing sample player, we need to be able to record and analyze the frequencies and apply offsets or just change the frequencies outright. The latter is probably not possible with a hardware synth.

Possibly there is a way to put all those soundfonts into ET, using Vienna or the SynthFont version: Viena. Any ideas?

As for recording the existing samples? Yes, it would be great if it were possible to automate this task spmewhat. Do you think FTS is capable of this, without too much trouble? You could have it record every key for say 30 - 40 sec and then run the files through the analyzer (you woild probably still have to do this manually). Or you could have it record the entire PB range for one note (good for synths with low resolution). Tell me, what do you think? Is that something that I would be able to program?

Another thing for the wishlist, it'd be nice to be able to enter scales into FTS using pitch bend notation e.g. -41, 82, -8192, 310 etc. and also that you'd be able to see which pitch bend value is applied in Notes in Play. Will make it easy to test pitch bend resolution and such.

Well, that's all I've got now!!

Talk soon,

Daniel. 


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 04, 2010, 06:22:12 PM
Hi Daniel,

Great, glad to hear from you. Yes that's really curious about the SW1000XG. I wish someone could step in with detailed knowledge of the design and why it is like that.

I've remembered a bit more about how it works e.g. in Viena (or Vienna) - as I said before, the samples used are quite long. The attack is left untouched, and you set "loop points" in the rest of the waveform. You adjust those loop points so that the waveform is as near as possible in the same place in the individual wave for each one. E.g. when both cross the zero line, but can be anywhere in the waveform so long as it matches smoothly across the join. If the sample has tremelo or vibrato, then you also need to set the loop at the same point in the pitch or volume fluctuations at each end as well to make a sample with regular and smooth natural vibrato or tremelo.

So if you had the same note on the same instrument ecorded just a cent or two sharp or flat compared with each other, you would set those loop points at slightly different places in the waveform. That's why soundfont designers sometimes talk about the need to tune their samples carefully. Also the looped portion is long enough so that if you don't get the loop points quite right, then it is heard as more like a glitch in the sound rather than an adjustment of the frequency. With the SB Live! I remember one of the instruments had a visible step in it when you looked at a recording of the note played - every so many waves you'd get this wave with a glitch in it. I can't remember which instrument it was now, or for which pitches (though it was quite detailed so presumably low-ish in pitch) anyway presumably just was because someone goofed slightly when setting the loop points for that particular sample. Sounded okay, for some reason you didn't notice it so they wouldn't have heard anything wrong.

Yes, I could program FTS to let you input a list of pitch offsets - or calculate them automatically. Sounds like an ingenious way to correct for known small (or sometimes not so small) fine tuning errors in a hardware synth which you want to use and can't do anything about in any other way. Also sounds as if you could set it to the same pitch offset for many notes at once e.g. octave or whatever, so I think you'd want to let the user multiselect many notes and set the bend for them all in one go.

Except on rare occasions when there is a techy reason you can't do it - normally anything which you do in a totally routine way, exactly the same way every time for e.g. every note in the midi range, or every file in a folder etc, I could program FTS to do.

Are you a programmer yourself - I can't remember now what your field of study is, if you said before. BTW good luck for your exams!

The way FTS is written, it wouldn't be easy for anyone else to add in a "plug in" or their own programming, not at present, I haven't figured out a way to do it. I do have some ideas for the future, you could write a program to send messages to FTS to do a sequence of actions, if you knew what numbers were used internally for each message - but the problem is that those numbers get changed with every build of the program.

So I had the idea to let you program it by sending script instructions basically, same as for the script feature within the program. I mean, you could write a script within FTS itself but its own scripting facilities are very limited - since the focus is on things you want to script for music such as repeating a section of the script a fixed number of times, rather on e.g. for loops, variables and function calls. So I can either investigate ways of making its own "scripting engine" more versatile - or else ways to let you write an external program which can call FTS in the background to carry out various tasks.

So - may get that done at some point in the future but it needs thought to do it properly and I have no immediate plans to do it.

For this, probably best bet is that I write the programming myself, when I next get some time to work on it.

I don't have any thoughts about how you can get a sound font for a particular instrument from a hardware synth - except by recording all the individual notes, play each one for a longish time, and then set your own loop points just as if you were working with the original acoustic samples.

So anyway in detail for the programming.

First - to record every note for 30-40 seconds and save all those recordings to disk - so long as your computer can record and play at the same time, that is pretty straightforward, and when I get some time to work on this could do it within a few days, possibly quicker than that.

To analyse them all and calculate the pitch offsets for each - if you have to keep changing the parameters when you analyse a new note then you need to do it by hand. If you can do them all with identical parameters for the spectrum analyser peak detection and so forth, then that also could be automated.

You can see the pitch bends that FTS sends in the More version of the Notes in Play window - and it shows the current numbers as cents and as pitch bend units for each midi out channel - the pitch bend units value is shown after the cents value in square brackets. If you can't see them, try resizing that window very wide which makes the lists wider, you can also see the pitch bend for the highlighted part in the text box at the bottom of the list of pitch bends for all the channels.

You can't show the scale as pitch bend offsets at present. I'm not sure that this is particularly helpful for what you want to do, but you may be interested to know that you can show scales using a sort of variation on the pitch bend notation in a way - you can set it to show the scale in hundredth units of 983.04-et (i.e. 12*8192/100).

So for instance an interval of 100 cents then gets shown as 8192.0 centisteps in this particular "centisteps" notation where 100 centisteps is one step in 983.04 et. Well actually gets shown as 983.04=8192 - all the numbers prefixed with 983.04= to show that they are centisteps in 983.04 et. If you don't need to mix cents and centisteps in the same scale then you can switch on the option to treat the centisteps notation as "cents" and so show e.g. 1 semitone as simply 8192.0 throughout FTS wherever you normally enter and display values in cents.

Anyway if you want to play with that, you can try it out in the Cents Notations window (Ctrl + 161). If I do add a pitch bend offsets notation then that might be a possible place to do that as well, as an extension of the centisteps notation. There is an option to show all the scale values as offsets from an ET but you have to use the same ET for the offsets as you do for the notation so e.g. here can only can show offsets from multiples of 100.0 centisteps 983.04 et which isn't particularly useful.

But I think more likely might be a specialist window which just shows the current scale in pitch bend offsets, e.g. with two columns one for the nearest 12-et midi note number, and one for the offset in pitch bend units, for each entry in the scale - as it is the sort of thing you'd only use on occasion rather than throughout FTS.

Anyway that is just a quick first reply. I'll think this over some more - just mull it over while I work on other things. Do have loads of stuff to do right now and can't imagine when I'll find the time yet, but perhaps eventually I'll catch up enough to have a bit of a breathing space to work on other things again, and a natural time to do this would be when I work on the next release of FTS 3.2 whenever that is.

It would be great to have an automatic retuner for a soundfont, at least as automatic as one can make it, even if it requires some user intervention, it will still be much easier than doing it by hand. And also sounds like a great idea to let FTS automatically record and measure pitches for hardware synths in order to work out the pitch bend offsets needed to play the notes exactly in pitch for exacting microtonal work such as j.i. chords.

I had basically given up on the idea of doing exact j.i. work and other microtonal work requiring really exact fraction of a cent accurate pitches with high quality multi-sample wave table synths. But this may well provide a way to do that after all.

So it would be really cool to be able to do this. I'll think about it some more and add it to the wish list for FTS.

Thanks, and great to hear from you too.

All the best for your exams!

Be sure to say if you notice anything I have forgotten to reply to.

Thanks, great to hear from you again,

Robert







Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 10, 2010, 09:38:48 AM
Yes so Robert it seems like we can get a better resolution with these sample based synths, it is just a matter of getting this data in the first place.

I have been putting off going into vienna and trying to retune the samples, because the creative ones are pretty cheesy. Prob. the one I like most is the General_User_GS font which uses more samples and I really like the Synth Bass 2 patch on that.

What's really interesting is when creating a soundfont, if using only one sample for a note range, Vienna will tune that pitch into very good ET (or so I've read). Because when I analyse say C3-C5, they are all out by 4.52 cents. This means that the software must tune the sample very precicely to the other notes to create the font. I wonder what technique is used to do this?

I'm guessing that if you retune a sample using FFT, you will have to reset the loop points?

Well about recording an instrument for it's offsets: one way I thought of doing this would be to set up timecode in Cubase or something fo 30 secs or so and then creating a midi file playing note after note and record it as one long wave file. Then chop it up and run each one through the spectrum analyzer and compile your data! Yes it still takes a long time but most of your time is saved.

Of course I'd be in gratitude if you found the time to automate this task. Your resulting frequencies could end up as a list as a txt file and you could just copy and paste all 128 into your data sheet. Sometimes (very rarely) the freq you want is not the one with 100% amplitude, which could be a problem. Maybe you could charge a price for that release of the program (i would pay)!
Of course as I am finding at this point in my life even if there is money involved it is not necesarily worth your while unless it is something you're really interested in doing so I'll leave it up to you.

But please let me know if this feature interests you and I'd like to help you if I can. I too agree that it'd be cool to do if you had a synth you liked and knew the samples were out. Many VSTs are just sample players.

Actually, here's a Big Q for you: Is the FM7 VST actually an additive synth or is it just based on samples? I will have get round to checking that one out!

Again I'm sending from the iphone but when on the computer will send you those spreadsheets that calculate the offsets.

Thanks for the info about the pbs in play, had no idea i had to resize that window.

As for changing the parameters in the spectrum analyzer, no i don't have to do that. So i can use the same settings but have to go in manually and get the freq for each recording. So to be able to automate that and have it export them all as a list would have to go on the wishlist!
 And yes i find the analyzer quite accurate. Sometimes i might have to do 2 or 3 recordings of the same not and usually they will show as within 1 or 2 thous of a hertz. Actually I have never worked exactly the physics behind pitch resolution. I suppose the means the level to witch the wave transforms matter, as waves actually just disturb matter and our ear picks up the vibrations in matter, apparently to a molecular level (very fine machines). What would be interesting is what decimal of hz one would need to get at an electron level! That is something to find out! It is always important as an engineer to know what level you are engineering to. How perfect do we want all this to be?? Ahh, I love physics.

BTW, I don't study programming. Actually physics and maths but consider myself an inventor and musician too as i have innovated a fretting system for the guitar.

Thanks for your encouragement.

Daniel.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 10, 2010, 10:15:08 AM
Sorry about the diction in that last post. Darn these little iphone keys!

What i meant in the first paragraph or so is that Vienna will take one sample, say a C3 and you may have recorded it "just out" by say 4.52 cents. When you've specified the range for that sample to cover, say C3-G3 the software has some technology that will convert that sample into the required pitches. This seems to be very accurate, as when I analyze that note range, they are all out by 4.52 cents. I'd like to find out how they do that!

Daniel.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 10, 2010, 03:18:23 PM
Oh, I'd expect that part to be accurate, if I think about how I'd make a start at programming it myself.

I don't know how they do it, but if I had that task to do myself, the starting point would be to interpolate and resample the wave, and they may well use some variation on this.

JOIN THE DOTS - INTERPOLATING AND RESAMPLING

So - in the wave recording at 44100 samples per second, think of the sample points as a series of points on a graph. "Join the dots" - simplest is just to use straight line segments, but you might use  some other curve which works well for interpolation. You've surely come across this with your maths, e.g. cubic splines or whatever.

Then to change the pitch while preserving the wave shape the soundfont player needs to resample it for a different frequency. E.g. to go up an octave that's dead easy, just use every second data point. That way the wave requires half the number of data points so half the time, so double the frequency.

To down up an octave you need the wave to take twice as long, so you need twice as many data points so need to add an extra samples inbetween the ones in the original recording. So that's when you need to look at your interpolated curve. In this case add interpolated values for the midpoints between each of the original samples.

For other intervals then e.g. to go down a tritone it turns out the soundfont player needs to divide the frequency by root two, so you need a sample point at 0, 1.414159 samples, 2.828427 samples, ... So for instance for the data point at 2.828427 samples, you need a number between the second and third sample in the original waveform, so you would look at the interpolated curve there and find out what the value is.

There probably are subtleties to do with making the process as fast as possible (since it has to be done in real time) and to do with preserving the original wave shape as well as possible. Also there are other methods that don't involve resampling. For instance you could make a frequency analysis with FFT, then you adjust the pitches in the detected frequency - then you do a reverse FFT to reconstruct the waveform for the new frequencies - or do whatever it is that AutoTune does. But I rather suspect the soundfont player probably uses interpolating and resampling.

Anyway - whatever method they use, the process is likely to be very accurate as far as the adjustment it makes to the original frequency is concerned, probably accurate to the limit of floating point arithmetic so to maybe 7 or 8 decimal places. Even more so if they use double precision arithmetic but they probably only use single precision floating point. In cents, for a frequency at middle C, and with single precision floating point, you would expect it to be accurate to better than 0.0000001 cents if there is no other source of error (261.00000001/261 in cents).

So you would expect intervals between notes played using the same original sample to be accurate to a tiny fraction of a cent, and if a soundfont instrument uses just a single sample, then over its entire range you would get very accurate intervals between the notes, and only error you would get might be that over its entire range it might be slightly above or below concert pitch as you discovered.

YOU COULD USE THE SAME METHOD TO RETUNE THE ORIGINAL SAMPLES IN A SOUND FONT

So anyway if we want to retune the original samples we can do it the same way, by interpolating and resampling. Should be very accurate in pitch, though disadvantage that by interpolating you lose some fidelity of the original recording - because then the sound font player will then resample your new resampled waveform again a second time to retune, so you go through the process of interpolating and resampling twice and every time you do that you will lose a bit of the fidelity. But might work well.

VARYING THE SAMPLE RATE TO RETUNE THE ORIGINAL SAMPLES

The other way we could do it is to vary the sample rate .Has advantage that it involves no editing of the sample except to change the sample rate recorded in the file. Might be not quite as accurate pitch wise but certainly to a small fraction of a cent, and might be slightly better as far as fidelity (though not sure if this would be noticeable).

Suppose you want to make the sample 4.52 cents sharp for instance

If the original sample is recorded with a sample rate of 44100, you want it to make it 4.52 cents flatter. With a bit of calculation, I find out that the sample rate you need will be 43985 because the ratio 44100/43985 is almost exactly 4.52 cents. Reducing the sample rate increases the time that each sample takes so reduces the frequency of the wave.

Then - how accurate is it to adjust frequency by changing sample rate? Well as it happens 4.52 cents is very close to 44100/43985 so in this case it is accurate to better than 0.0005 cents.

Generally, you'll be accurate to better than 44100.5/44100 (or so, slightly more inaccurate the flatter you get but we are making only small pitch adjustments here) anyway turns out better than 0.02 cents. Not bad. And that's the worst case, many retunings will be more accurate than that, on average then the samples will be retuned to within 0.01 cents of the desired pitch.

I'd feel, was a job well done if you could do that. In practice you would probably include both methods and leave it up to the user whether they prefer to use sample rate changing or interpolation to retune the soundfont.

This is all assuming that the soundfont players do let you use different sample rates. But going into Viena it does show a "sample rate" field for each sample. So not hardwired to 44100 Hz. And if it can use different sample rates you would think it would allow any arbitrary sample rate (possibly within limits). Plus I have a memory of reading about this technique for retuning soundfonts somewhere though I can't seem to find anything about it right now.

So I am pretty hopeful that the sample rate changing method can be used, and if not the interpolation is certainly possible whatever.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 10, 2010, 04:13:57 PM
Hi Daniel,

Yes I am pretty certain it can be done using the approach you are pioneering.

ROADMAP

Your experiments suggest a roadmap for it as well. When programming something tricky then it is helpful to have intermediate steps that are more easily achievable that are useful in themselves.

So from your experiments, we have a nice clear ready made roadmap like this:

1st, program FTS to automatically record all the notes for a midi instrument. Probably saved as a whole lot of recordings in the same folder with note number as part of the file name.

If the samples are from a soundfont and you can export the originals, you can skip this step and just use the original samples.

2nd get it to auto analyse each note (perhaps as it records it). Probably save those as text files with same name as the audio recording.

3rd get it to calculate pitch offsets for each note from the analysed frequencies. It could just add this information to the text files it saves. Also have some simple way to re-analyse any sample you feel needs more attention and resave a new version of its spectrum analysis. Make it readable for the software for the next stage 4.

4th Get it to read in those pitch offsets again and collate them together in a big table. Then use that to adjust the pitches of notes just before they are sent, to compensate for the fine tuning inaccuracies of the original samples.

5th In the case where the samples come from a sound font - could get it to auto retune the samples either by interpolation or by sample rate adjustment.

MY PROGRESS SO FAR

Although I haven't had much time to work on it yet, I have done a bit already and can tell you how far I got.

I had a look at the code for FTS recently, and I already have an option to make a recording of the fractal tune for all the midi instruments.

It's rather hidden away - you can find it under Make audio clips of all the MIDI voices (Ctrl + 54) in the fractal tune tasks and it isn't in any of the menus - you get to it via Edit Custom Multi-Instrument Voices and then edit as timbre.

It might be useful already as it is. But anyway what I've done is to add an extra field in that window for the next upload, to enter the midi note numbers you want to record for the  midi instruments. So you would just enter a list of the midi nstruments you want recordings of, and the midi note numbers you want, and then go away and leave it to play all the notes and record them. I've also added a check box to auto analyse each clip. Also I'll add it to the menus for the Analyse Recording and Analyse Midi Instrument tasks in FTS and make sure it works for those tasks.

So done the user interface and also first draft of the code. But it needs to be tested and debugged. I haven't tested it yet. But don't expect any serious problems when I do.

So - probably some time in the next fortnight or so I hope to set aside a day or two to work on this and get it sorted out.

After that, with 1 and 2 done, 3. and 4. are straightforward too, and I might see if I can program them as well at the same time, just depends how quickly it goes and what else I have on my urgent to do list at the time.

In 3. if you get the pitches, without need to change the parameters, and only issue is which of the spectrum peaks to use - then there is a shortcut the software can use there. It can make the assumption that the pitch is correct to within a few cents - and then look for a peak at the correct pitch for the midi note number.

E.g. for midi note 69, since it knows the intended note number, it can look for the peak closest to 440 Hz in the spectrum, and you can be pretty sure it will pick out the right one. That is - unless you get doublets, pairs of peaks close together in pitch - which you might get for a church bell sound perhaps, but I'd expect that to be rare. Oh and another thing - that you may get some instruments that have a very weak or even non existent first partial. For those it might detect the pitch at 880 Hz instead for midi note 69 (e.g. for descant recorder that's quite possible). But that's easy to deal with.

In 4. then the issue is how to do it elegantly and efficiently to reduce chance of running out of midi output channels for complex pieces. I can think of different ways to approach the problem and would need to spend a bit of time to think it over to figure out which one would work best. You could "bash on" and get something together fairly quickly but it might be better to mull it over first and figure out the best way to do it.

WHEN WILL I DO THIS?

Don't worry, I do want to do this, and will get it done when I can. But I can't say when exactly. Will do 1 and 2 sometime fairly soon if I can, and 3. and 4. when time permits.

RESIZING THE PITCH WINDOW

Yes I should add an extra More button there for FTS 3.2 - I agree it's not obvious that you need to resize it to see the pitch bends. Should make a larger version with a broader column for that last column (or a separate pitch bends column).

ABOUT THE FM7

With the FM7 - it uses FM synthesis. It doesn't use wave samples at all. Rather it uses feedback loops between oscillators at various frequencies and connected with each other in complicated ways to make the different sounds.

You will probably have a better idea of this than I do, here is a wikipedia article about it:
http://en.wikipedia.org/wiki/Frequency_modulation_synthesis (http://en.wikipedia.org/wiki/Frequency_modulation_synthesis)

Making FM patches is an art rather than a science, it is a case of adjusting the weightings and feedback loops etc. until you get the sound you want. Or more easily, just go to the large libraries of already invented DX7 patches and download and use those until you find the one you want.

Pitch wise it is very accurate indeed. The actual sounds don't sound that "realistic" if that is what you want, it does have e.g. brass, wind instruments etc, but if you expect them to sound like the original instrument, that's not really its strong point. More like, take the original instrument and paint a sound that somehow carries some of its essense, but on a different canvas, a bit like impressionist painting or Fauve painting, in sound. Or more often, completely new sounds - typical "synthesizer" type sounds.

Also, they often have tremolo type effects in them, sometimes very exaggarated. If you want a plain steady pitch you can find plenty of instruments like that too, just that you have to hunt around to find them.

INVENTOR

Yes a new fretting system for a guitar certainly qualifies you as an inventor :-).

Anyway will be looking into this more in the reasonably near future.

Thanks again,

Robert


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 10, 2010, 04:25:38 PM
Oh - and on changing the loop points for the sample. If you just vary the sample rate then you don't need to change the loop points as it still uses the same number of samples and the loop points would be set at a particular number of samples from the start of the recording rather than a particular time from the start (almost certainly).

But if you interpolate and resample you would need to change the loop points. So that's another point in favour of the sample rate changing technique.

Probably you would program the sample rate changing first.

The other option for more in the future is to actually program the software so it can edit the soundfont directly to auto retune it.

I belive it is an open file format, the specification is available, just checked, it is a variety of the RIFF file format. So should be possible to do the programming to do that. Just dive in to the sound font, extract the samples, retune them, put them back in again, adjust the loop points as well while interpolating if you need to, and so retune the entire .sf2 file automatically.

That's the sort of thing you could do if you were to spend more time on it, e.g. if it turned out to be easy to do, or if there seemed to be a high level of interest in the feature, or for whatever reason, you are able to work on it over a more extended period of time. Certainly feasible if you have the time and resources to do it.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 11, 2010, 10:08:13 AM
Robert,

it is 2:00 am and I was just checking my emails on the iphone and when I discovered your message I read your post with such rapt awe at your thoroughness.

My dream is to find people of your caliber to work with. Recently I am doing a research report and I chose to research space exploration. It amazes me that these engineers grind and polish telescope lenses like the Hubble to such fine accuracies, that can see light years away. Or the gyroscopes they build, or measuring equipment. I know our ears and eyes are such fine machines. I look at the Hubble images, my ears and heart crave for the music that is in my head and heart and in the heavens. And it is all there in the nature.

That is a lot of fluffy words; but every day I just follow my ears and heart, and they tell me I am getting closer; there is a song to the universe; music can illuminate the truth - I think the Greeks knew this. And I know all this is working for my music. For instance the just guitar prototype I built, which I call the "JustFighter"! I listened to a recording of that the other night. And it is just the best tuning for an electric guitar I've heard on Earth. And it's just in E Ionian! Or when I play a passage on the synth to fine resolution, I start to hear the simple nature of it, and I can just, you know, start to let go! I hope one day you can see my successful guitar product.

So, that's a little bit about me. I know when you know the physics, and the pure ratios (and how they all work together and gravitate) you can get preachy! But it's simply the best thing I ever did for my music and my happiness. Period. It gives me such hope! And I use my mind and it puts the notes in my inner ear and I can hear the right notes (and I keep training myself on these ratios). And that's the simple truth.

For instance lately I really like the natural dorian mode: 1/1 9/10 27/32 3/4 27/40 3/5 9/16 1/2, which is a direct permutation of the just major.
 And that brings up a good point: That 1/1 27/32 27/40 sounds gnarly to most anyone's ears. But - and I've tested this - with good resolution (and I mean to the 10th of a cent or better) it is just a bittersweet, lamenting chord and to me is the true iim chord. I know some microtonalists disagree with it and substitute it as being dissonant. What do you think?

Wow, off track! And there's work to be done.

Yes, your ROADMAP explored an idea I hadn't even thought of: To directly set the required offsets in FTS depending on the voice and depending on the scale selected in FTS. In other words in Part 1 you could have Synth Bass and FTS with afformentioned Dorian ratios loaded as Scale (and FTS will detect that voice I'm supposing) and the correct Offsets will be applied. No need for more output channels. Just different PBs  sent for different midi notes. Henceforth you could have Detuned Piano in Part 2 also in Dorian but with the different offsets.

I have been getting all the recordings into excel, setting the offsets for a particular just scale, importing into Scala and saving as a tun. This means I need to do this every time for a new scale, key or voice! your way sure beats the pants off this! And imagine the scales you would have to load into FTS!?!

It's now late!

Thanks again and will reply to you tomorrow.

Dan. 


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 13, 2010, 02:43:33 PM
Daniel,

Oh yes, I'm amazed by what they do in Astronomy these days as well :-). I'm a keen armchair astronomer.

Yes, all the best for your guitar!

Yes, just tried it, 1/1 27/32 27/40 or if you do it ascending from 1/1 at the original 27/40,
1/1 5/4 40/27
nice chord on the instrument I tried it.

I used one of the Wave Shape Player instruments (in fact the "metallic pluck") in FTS - expect you know them - designed them for just intonation experiments originally - so very accurate indeed, 14 decimal places or something for the calculations. But probably not the sounds you want if you want something that sounds very like natural acoustic instruments.

Yes I like exploring just intonation scales as a mixture of low ratio pure just intonation and higher ratio intervals, and just see what one likes, and work around that.

Do you know about the JustIntonation Yahoo Group?

http://launch.groups.yahoo.com/group/JustIntonation/messages (http://launch.groups.yahoo.com/group/JustIntonation/messages)

just in case it might be of interest. You may find some kindred spirits there.

Yes that's exactly how it will work. You do the analysis of the instruments for the synth or soft synth or soundcard once only. Then would set it up so you can have a drop list of the different synths you have analysed, and choose the one you want.

Then FTS would do everything else automatically, whenever you select an instrument into any of the Parts, it would then automatically apply the necessary fine tune offsets for that instrument, for every note played. You would just enter the scales as you normally do and can forget about the offsets from then on.

Enthusiasts using the same sound fonts or soundcards or hardware devices could then share their files with their analysed offsets for each instrument.

It's a bit of a way ahead. But if I do work on it from time to time when I have the opportunity, hopefully should get done eventually.

I'll set aside a couple of days some time soon, and just see how far I get. Hopefully will get as far as automatic recording of all the audio clilps and automatically doing the saved text analysis for each one but will see how it goes. Hard to predict, you can sometimes be stuck for hours on a number of very minor but essential points, and sometimes it all goes very quickly.

Thanks,

Robert

Robert





Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 15, 2010, 10:14:00 AM
OK,

Well I've been mucking around in both Vienna and Viena (which is made by the SynthFont guy), and can't seem to be able to change the sample rate in those programs. Yes, the sample rate shows as a property but isn't editable like many of the others. You can get at the wave samples and import them and export them and such; possibly you could export them and do an FFT and then import them again....

BTW: Do you remember if any of the Creative cards allowed you to load a soundfont bank into the card's memory and use it as the midi synth (no latency)? I'm wondering if my Audigy 2 will do this?.... (will google that).

I have uploaded that 'Tuning Specs for Voices' Data Sheet with this post. Hope you get that. Probably the most pressing thing that I am able to do at the moment is record the voices for some of these synths and softsynths and start looking at ways that I can retune them.

But I do believe the pb method will give us some highly satisfactory results. In the case of the SW1000XG, there are problems with it's pb range. For instance I couldn't get a D4 in tune for a voice. I then realized after many recordings that you can not get in between the cracks of an interval of about 12 cents for that particular point in the pitch bend range. It must have been right at the limit of the pitch bend range (probably the top of C4 or something) to have a jump of 12 cents! Amazing but true! So, sadly I think the only way I can predict this synth is to record the pitch bend range of every note in that voice and then enter all of those frequencies into my table. I know that sounds like pure pure insanity but you wouldn’t record every note in the range, maybe just every 20 or 40 pitch bends until you find what increment it’s resolution is and then just record the first fifty or so of those (50 cents up, and then 50 down)! I know it sounds like a dumb plan but in the case of the SW1000XG the increment is 41 but every 6 or 7 they skip one so you are left with an increment of 82 there! That’s about 2.25 cents. And who knows if this is the same for all the voices. Unfortunately the pattern of 6 or 7 is not consistent for each midi note so you can see what my options are here……..

I had a look at Ctr+52 (record midi voices). Yes that is the trick. So far it will only record what the fractal tune is set up for I guess and I haven’t gotten into that yet. So, that will be useful to set the voice, the notes (whole range), the duration, and also – the pitch bend. In my case it would be really helpful to be able to record just one note in pitch bend increments. Say, 41 as a multiplier about fifty times and then down again. And I would have to do that for every note in the range for that voice! And then you would need to have a labeling system for all those files.

I know it seems like total overkill but in the case of the Yamaha synths and the Microsoft Wavetable (ughh) (as you found) and I presume many other sample based hardware synths the resolution is not always consistent. Anyway the hard part is recording all the data, extrapolating all the frequencies is a lot quicker. (Although it will still take a while with the task I’ve set!!). Any way that’s about the only way I can think of to get my synth into a good range.

Oh, and you may want to be able to set the velocity too. Because some voices kick in with another sample at higher velocity (the Rhodes with that punchy sound).

As for your idea with the resampling trick. Wouldn’t that be cool if you could use that idea to retune your synth in realtime by resampling the note. Seems like it would be more accurate than pbs but probably impossible to send that kind of message and you would have to know the architecture of the synth (I wish I knew more about such things).

So, as I said, I would find that recording feature very useful when you make some progress on that!!!! The analyzing feature isn’t as important, doesn’t take too long to do it by hand, but one way to speed it up I suppose was if you could do it in batches, and then export as txt and copy paste into excel, say.

I might get onto Jeff Scott and see if he can guide me to a very cool sounding, versatile microtunable synth with good resolution.

Again, thanks very much for your support on this, I hope we can make a step in the right direction and find a good way to tune those many hard and soft synths out there!

I hope the sheet isn’t hard to understand. It has three different methods of retuning. The first is by straight setting a new frequency with offset. The second is using a cent value for a multiple in pitch bends (such as an oddball 1.1 cents every 41 steps). And the third is by taking the recorded values for each step in resolution and matching them (an insane task needing in this case two extra sheets for each note in the voice, 256 sheets!). The last is not complete for obvious reasons.

We are making progress……  :D


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 15, 2010, 01:48:18 PM
Hi Daniel,

A few things I can answer right away.

VARYING THE SAMPLE RATE

You can't vary the sample rate in Viena or Vienna as far as I know.

Instead, if you wanted to do it by hand, you would need to export the .wav sample first - in Viena you can do that with the Export file button.

Then you need to change the sample rate without changing anything else in the file somehow. Then reimport it with the AddSample button.

I gave that a go just now, with the audio samples for the default soundfont for Timidity, TimGM6mb.

I noticed that it does show different sample rates for different samples so should work. So then I exported it, and I tried to change the sample rate using Goldwave using Effects | Time Warp but it didn't work. Ths is a Goldwave rather than Viena issue. For some reason Goldwave resampled rather than just change the sample rate even when I pressed the "Rate" button - don't know if that is just a bug in Goldwave or I haven't understood something about how it works.

Anyway if you know of software that lets you change the sample rate without changing anything else in the file you could do that.

It would be possible for software to just adjust the sample rate directly since it is embedded in the soundfont somewhere within each audio sample. You might do that with soundfont auto retuning software.

But you would need to do special programming to add that as a feature and so no surprise that it isn't editable in Viena, usual assumption would be that the sample rate recorded in the audio file is correct and doesn't need to be edited, just displayed to the user.

ANOTHER WAY - SOUNDFONT SAMPLE CORRECTION FIELD

But, just taking a closer look at Viena (i.e. the SynFont Viena) right now, I noticed a "Correction" field in cents for each sample. So an easier way to do it is to adjust that. Not so accurate as the sample rate change method - but would be accurate to the nearest cent so the note you hear will be within half a cent of the desired pitch.

A bit of a "gotcha" there - the correction field only affects the way the sample is used for the soundfont instruments - doesn't change the sample in any way. So at first I thought it wasn't doing anything.

So, when you use the Play button for the sample, it sounds the same after you apply the correction. But if you let Viena update the soundfont with the new parameters for the sample (you get a message asking if you want to update) - then go to the instrument presets you can hear the result of the change in the parameter.

Another "gotcha" that could be a bit confusing. When I tried it here, adjusting with the spin control worked but when I edit the number directly sometimes my change didn't "take" - obviously a minor bug in Viena - so anyway that was just a minor thing but could be confusing if you try this out and it happens to you. I ended up always using the spin control to adjust the correction.

After sorting those two things out then it worked fine - the pitch of the note changed when corrected in this way.

Also Viena has an option to automatically find an appropriate correction for each audio sample - using FFT. That promises to be a fairly fast way to retune the entire soundfont - but when I tried it I found that it didn't work that well, giving obviously wrong values a lot of the time. Finding the pitch using FFT is tricky of course, because it is easy to base it on the wrong peak in the analysis. If the author of Viena improved that feature then that would be a similar idea to my auto retuning of the sounfont idea, except I'd vary the sample rate for greater accuracy.

GETTING THE SOUNDFONT FROM THE SOUNDCARD

I don't think you can do that. The soundcard can play soundfonts and you can edit those, but for the ones that are hardwired into the soundcard - I couldn't find a way to get at those.

RECORDING ALL THE NOTES FOR A MIDI VOICE OR SELECTED NOTES

I will almost certainly be able to do this in the next week or two - don't think it will take long to program. So I wouldn't spend too much time on trying to find alternative ways of doing it if you can wait a couple of weeks for it.

PITCH BEND INCREMENTS

Okay can do this, have a text field to show which pitch bend increments to use for each note and add the information to the saved file name.

VELOCITY LAYERS

Yes, okay can do that, I can add an option to set the velocity for the recording (and include the velocity in the file name). So you can set a list of velocities to use and it can record the sound at each of those.

When it comes to the automatic pitch bending again I could make it depend on the velocity of the midi note as well.

It is a good idea to think about all that at this stage before you write the code.

GUI DESIGN

So I'd have - the note numbers to record for each note, the velocities for each note, and the pitch bends for each note. Then the software would just loop around all of those until they are all done.

Will probably have radios in the user interface, so you can set a single value or multiple values for each one. So e.g. for the pitch bend recordings, you could select a single note and single velocity level and single instrument and use multiple values just for the pitch bends.

Straightforward and simple to program, once you have the basic code working, each of those new features would only add minutes or so of extra work (not hours anyway).

TUNING SYNTHS

When I get to that stage what makes sense is to ship some presets with the program. An obvious one would be the Microsoft SW Synth since many computers have that - also the Roland Sound Canvas. Could automatically select those by the Midi Out device name. They would be a good test too of the feature, I'll give a go at autoretuning them, as by trying it out that's a good way to find out extra tweaks for the software to speed up the process.

SPREADSHEET

Did you attach a spreadsheet to your post? I can't see it, but I have a good idea of what it is from your description. I think you can attach it via additional options or you can send it to me via e-mail.

Thanks,



Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 15, 2010, 02:16:24 PM
Had another look at the auto correction feature in Viena and when it gets it wrong is usually because it gets the second or foufth partial so out by 1 or 2 octaves.

So assuming the cents value it gets for the adjustment is accurate, then you could just copy over the correction and keep the original value for the root key.

So could be more useful than I thought.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 16, 2010, 06:41:15 AM
Hey, thanks for that update.

The spreadsheet should show up for you. I'm visiting the forum again and can see it. You probably won't recieve it in your notification, but will have to visit the forum and it's just below my last post.

That's great that you can understand everything in my post - sure to confuse most people! Actually by checking out the spreadsheet you will probably see why I needed to record the pitch bend range in increments just for one note. So, yes I think it will be important to recordbup to 100 files of the pbs for just one note, if the synth has a sort of pb anomoly! (like mine).

What's interesting for my synth is that i think they use different sampling techniques for different voices. Was playing the rhodes voice and it sounds like it tunes up much better (maybe better pb res.) will have to check that out. It's a bit like the DX7 synths, because they are a fm type synth they don't rely on samples and should have better pb res.

Didn't understand the last thing you said about Viena. Yes I saw the correction feature but it's only accurate to about .5 cent. I'm guessing you're saying if you get the corrected cent value you could try to get it to match this for the rest of your samples for that voice?..... Not sure what you meant there....

If you wish to charge for this up and coming feature, I'd be more than happy to pay for it. I've bought FTS.  It's worth much more than asking price. And if I can be any help in programming..... trouble is I don't know how program FTS. I'll try to find a software that changes just sample rate.

Of interest to you maybe is that XG Works supports 32 midi channels simultaneously. 48 with a plug in card. And you can load soundfonts into the audigy 2 card and use it straight as a midi device (no latency) and i'll run it into xg works! I have a copy of this now discontinued product if you want it.

Thanks again,

Daniel


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker on June 16, 2010, 06:41:04 PM
Hi Daniel,

Thanks, I can see the spread sheet now. Probably just missed it somehow before.

Not sure I understand every detail of it but in a general way can see what you are doing, and can see the way that you did an analysis of each pitch bend for a single note for quite a number of values.

The way I'd do it in FTS for the auto correction is to make one big table of the corrections you need to apply to every midi note (and separate corrections for each velocity layer for each note if necessary) to get 12-et exactly. Then for all the other scales, would just add those corrections to the usual pitch bends before the notes are played.

Yes the DX7 synths should have better pb res. When you asked about the FM7 in an earlier post - that's what it is basically, a DX7 synth in software with some extra tweaks.

Oh with the correction feature, I just meant, that without FTS, if you had access to the font itself you could correct it and get it accurate to within 0.5 cents.

If I programmed FTS to retune a sound font automatically - I wouldn't need to use that correction field - but could use the correction feature then too (assuming it is a standard part of the soundfont spec) and use the sample changing trick just to do the last bit of fine tuning for fractions of a cent.

PRICING

I'll do it as a feature in the FTS 3.2. beta to start with, so you can try it out. Not sure of what to do about charging for it - if it is part of FTS 3.2. then normally I wouldn't charge any more.

But it would be possible to release a stand alone version of one of the FTS 3.2 tasks with more features than the original. I could do that. So you get the basic program as part of FTS 3.2 but get a more advanced version of it as a stand alone program with more features. I already have plans to do that with a multi-touch version of the Lambdoma Music Therapy on-screen keyboard, in fact that's what I plan to work on next after I finish the most recent revision of Bounce Metronome Pro.

Unfortunately, microtonal features don't tend to lead to many sales I found. So you spend months sometimes programming something - then you get one or two really enthusiastic users but not enough to make selling the software a viable business. Maybe that will change with FTS 3.2., maybe part of it is user friendliness of the program, anyway will see. With Bounce Metronome Pro that's now my top selling program and that's why I want to get it working really well, because the aim is to make this work as a viable business.

So, to price microtonal software to take account of the actual work involved you would have to charge many hundreds of pounds for each sale, indeed for the entire FTS with all its features you'd charge more like thousands of pounds, and then who would buy it?

But may get a few extra sales, and it's possible all this may change when I release FTS 3.2. which will be much more user friendly. Also anyway it is a great thing to do and something I am keen to do.

Anyway will think about that later on and see how it goes first, and perhaps I may charge for it if there is some indication that enough people might be interested in buying it as a standalone program.

If not, if you are very pleased with the results when I do it, another possibility is that you could give a donation to show your appreciation.

But anyway don't worry, I'll do it quite soon, certainly the automatic note recording, that's just a matter of a few days work at most I think. Whether I'll do the automatic soundfont retuning I don't know, it may just be too much work to be worth the programming time involved. But adding in the automatic correction based on the tables again is a small enough amount of work so I'm pretty sure I'll do it sooner or later.

Thanks for your offer to help. I'll let you know if I think of anything.

Robert







Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 18, 2010, 07:37:48 AM
Dear Robert,

i have tried using using a program to change the sample rate of a gont. It's called PRAAT! Another one is Wav Sample Rate Converter. And while I am changing the rate to half, the pitch sounds the same. These programs must be converting the rate while retaing the character i.e. pitch of the wave. Not to worry, I'll see what I can find.

The Creative Audigy 2 can load soundfonts onto the card and it plays with 0 latency, loke an onboard synth! Using my recorded voices for the synth bass 2 and spreadsheet I have it going into XGWorks and I think it's the best tuning I've heard!

Now if i could just somehow resample or interpolate some samples.....

Reply at your own leisure,

Daniel.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 18, 2010, 08:06:38 AM
Yes Goldwave can do it. You must use the Playback Rate dialog in the Effect menu. The Resample command will change the sample rate while retaining the pitch and file length. The playback rate command permanently changes the sample rate and it will affect the pitch and file length.

BTW: It looks like a bang up program. I like the way the control screen flares up when you play a note!

I just hope Viena lets me import these files back in with a new sample rate and won't ask me to set a new loop point and that it does it's maths for the rest of the notes in the range despite an oddball sample rate!

Will let you know,

Dan.


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker 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 (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





Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: Robert Walker 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) (http://www.google.co.uk/search?q=44100+in+hexadecimal+%3D)

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) (http://www.google.co.uk/search?q=44100%2F2+in+hexadecimal+%3D)
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  (https://ccrma.stanford.edu/courses/422/projects/WaveFormat/)


Title: Re: Pitch Resolution and Retuning the Yamaha SW1000XG by hand
Post by: DanieLionius on June 18, 2010, 08:58:50 PM
Wow that's amazing. Gonna try that soon.

Daniel.