http://robertinventor.com
December 17, 2017, 08:24:48 PM *
Welcome, Guest. Please login or register.

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


« Reply #15 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







Linkback: http://robertinventor.com/smf/index.php?topic=58.msg166#msg166
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #16 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.

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg167#msg167
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #17 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.

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


« Reply #18 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.

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


« Reply #19 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

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

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg170#msg170
« Last Edit: June 10, 2010, 11:21:20 PM by Robert Walker » Logged
Robert Walker
Administrator
Full Member
*****
Posts: 165


« Reply #20 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.

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg171#msg171
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #21 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. 

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


« Reply #22 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

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





Linkback: http://robertinventor.com/smf/index.php?topic=58.msg175#msg175
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #23 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……  Cheesy


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


« Reply #24 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,



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


« Reply #25 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.

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg178#msg178
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #26 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

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


« Reply #27 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







Linkback: http://robertinventor.com/smf/index.php?topic=58.msg182#msg182
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #28 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.

Linkback: http://robertinventor.com/smf/index.php?topic=58.msg183#msg183
Logged
DanieLionius
Newbie
*
Posts: 19


« Reply #29 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.

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

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