Author |
Message |
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat May 24, 2008 4:47 am Post subject:
|
|
|
Blue Hell wrote: | I did like the rough distortion, sounds usable to me. |
Cool, thanks Jan, that means I'm getting somewhere after all this effort! _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Sat May 24, 2008 5:03 am Post subject:
|
|
|
Inventor wrote: | I just couldn't get a tuner just yet. |
What you could do is generate the open string notes EADGBE from ChucK, one at a time, and tune the guitar to that by listening to the beat frequencies resulting from interference with the reference tones, trust your ears, it'll work, and it's much more useful than a tuner.
When you can't figure out the beat frequencies you can use ChucK again, generate a note of 440 Hz and one of 441 Hz (for instance) at the same time and listen how they interfere with each other, it'll be much clearer then. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat May 24, 2008 6:32 am Post subject:
|
|
|
Blue Hell wrote: | Inventor wrote: | I just couldn't get a tuner just yet. |
What you could do is generate the open string notes EADGBE from ChucK, one at a time, and tune the guitar to that by listening to the beat frequencies resulting from interference with the reference tones, trust your ears, it'll work, and it's much more useful than a tuner. |
This didn't work, I think my ears are made of concrete, haha! But I did whip up a nice little guitar tuner in ChucK, the only thing is, you have to specify what string you are tuning. So it isn't super magical, it needs some info.
What I did was run the signal into a high Q band-pass filter at the target frequency, then observe the time between zero crossings. Naturally there is a lot more to it like a noise threshold and a keyboard interface, but that's it in a nutshell. Took about an hour to write it and tune the guitar to within +/- 1 % of desired frequency. I'll post the code in the ChucK forum if anyone wants it. _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat May 24, 2008 8:27 am Post subject:
|
|
|
It looks like I have solved the ticking problem. It was a grounding issue. I was using a power strip with the ground tab clipped off of it. I should throw that one in the trash since I have the appropriate ground isolation plugs for my scope and such. In fact, I think I will. Sorry for any confusion. _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
Back to top
|
|
|
DrJustice
Joined: Sep 13, 2004 Posts: 2114 Location: Morokulien
Audio files: 4
|
Posted: Sat May 24, 2008 5:09 pm Post subject:
|
|
|
That's better! This one is much kinder to the ears
I've toyed with sigmoid curves in the past, and I agree that they're very useful for soft (or not so soft...) clipping, but even they need band limiting. I'd still advice you to do the sine sweep test and listen for aliasing.
As you have discovered for yourself, "real" modelling is not always the answer - smoke and mirrors often do the trick just as well, if not better
DJ
-- |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sat May 24, 2008 6:07 pm Post subject:
|
|
|
DrJustice wrote: | That's better! This one is much kinder to the ears
I've toyed with sigmoid curves in the past, and I agree that they're very useful for soft (or not so soft...) clipping, but even they need band limiting. I'd still advice you to do the sine sweep test and listen for aliasing.
As you have discovered for yourself, "real" modelling is not always the answer - smoke and mirrors often do the trick just as well, if not better
DJ
-- |
Thanks, Dr. J, I really like this model also. I think I will write it up on a web page.
For the sweep, I know that a guitar's maximum frequency is about 1.5 kHz, so including a few harmonics shouldn't the upper limit of the sweep be about 5 kHz instead of 20 kHz? Also for the band limiting, how about a 2 kHz low pass filter after the tube model's transfer function?
You know, if we are going to use a sigmoid function as a tube model, we will need a name for it. How about the "Zany electro-music.com Sigmoid Tube", or "ZeST" for short?
You are right about the smoke and mirrors, the more I see analog and digital circuit abuse, rules broken, and totally un-kosher circuits that are used in electronic music, the more I enjoy the whole bizarre catastrophe of amateur hobbyists breaking engineering rules for fun and great sounds, haha. So why shouldn't I join in the chaos and make a tube amp model that's not even based on tube amp circuit analysis? Rules are meant to be broken, or so they say! _________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
Back to top
|
|
|
DrJustice
Joined: Sep 13, 2004 Posts: 2114 Location: Morokulien
Audio files: 4
|
Posted: Sat May 24, 2008 6:55 pm Post subject:
|
|
|
The reason for sweeping right up to 20kHz is just to test the algorithm. I don't know if you're familiar with aliasing, but if a signal has acquired aliased components, it is too late to lowpass filter it (unless you're lucky and all the aliases happen to be well outside the passband. Even if a normal steady guitar tone doesn't go all the way to 20kHz, playing the guitar will produce higher frequency content caused by fret noises, fingers against string winding noises and so on. I have never checked, but I would not be surprised if the attack portion has a fairly rich frequency content.
It's of course not the first use of a sigmoid function for soft clipping, but still an original ZeST effect can certainly use it as a basis. Why not to try and play with it, bending the curve some, filtering before and/or after, maybe even a touch of dynamic processing - break some rules, go for what sound good to you. If anything, my advice would be to try oversampling as well; I'd guess Chuck has some support for that(?)
DJ
-- |
|
Back to top
|
|
|
DrJustice
Joined: Sep 13, 2004 Posts: 2114 Location: Morokulien
Audio files: 4
|
Posted: Sat May 24, 2008 7:00 pm Post subject:
|
|
|
Inventor wrote: | Can you hear any artifacts? |
Nope. It sounds nice and clean in that range. Waveform looks good too.
Edit: to refresh my own memory I just tried the god old x - x^3/6 with x scaled by 1.4 and it (and variants) is very clean . This one used to be called the "bandlimited sigmoid" and I now remember why (it's not really bandlimited, of course, but close enough for our purposes).
DJ
-- |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun May 25, 2008 9:15 am Post subject:
|
|
|
Thanks for your ideas, Dr. J, I did what you suggested. I ran the full 20 kHz sweep and sure enough there was plenty of aliasing. So I did the other thing you suggested, which was to play around with it to reduce the aliasing. After hours and hours of experimentation and a long sequence of failed ideas, I was able to create a pretty good solution. It works like this:
I watch for positive-going zero crossings and estimate the frequency of the input signal by averaging them with an exponential running average thingie. Then I vary the shape constant of the sigmoid according to a mathematical expression based on the estimated frequency divided by the maximum frequency. After lots of trial-and-error I was able to vary the shape of the sigmoid so that it is sharper for lower frequencies and smoother for higher frequencies, and also varies nonlinearly in such a way as to reduce the aliasing. That way the lower frequencies get that bendy tubular clipping effect and the upper frequencies see a nearly linear transfer function so they remain sinusoidal.
There are a lot of details that I won't bore you with, but suffice to say the result seems good to me. Sadly, in the process I learned that the frequency response of my hearing is rather poor. I could barely hear sounds above 10 or 12 kHz. Then again, I was sending the audio into my new Fender guitar amp which has a big midrange speaker so maybe that was part of it. So if there is still a lot of aliasing in the upper frequencies it's because I couldn't hear it very well.
Attached below are the final output of the 20 kHz audio sweep and the ChucK source code so you can glance over the algorithm. ChucK is quite readable even if you don't know the language. As always I welcome your comments and constructive criticism.
Description: |
The output of the 20 kHz sweep. Ahh, such gentle tubular bendiness! |
|
Download |
Filename: |
Tube_Amp_out16.mp3 |
Filesize: |
313.88 KB |
Downloaded: |
1234 Time(s) |
Description: |
The source code for the ChucK ZeST model - quite zesty! |
|
Download |
Filename: |
Tube_Amp16.ck |
Filesize: |
3.31 KB |
Downloaded: |
453 Time(s) |
_________________ "Let's make noise for peace." - Kijjaz |
|
Back to top
|
|
|
|