You still can use a demoboard as signal generator - add another signal output @ pins 0..7
It has two problems with pins 10/11 and a demoboard
1. it has low pass filter set @1.6 kHz@-3dB (and -20dB @ 20 kHz). This is easy to patch - use 680 Ohm..1k resistor instead (or parallel to) existing 10k
2. it has a headphone amplifier. It is designed to amplify accoustic signals, not high frequency ones.
@pik33
3. The headphone amplifier is nonlinear for AUDIO signals EVEN when patched with 680 ohm resistor. (my scope doesn't lie!)
Bass and treble are amplified and mids are damped... I have a feeling that the spectrum resembles the "loudness curve".
@Ahle2, it sounds like it is the headphone amp, not the RC network, that is the problem. Just use the RC network then?
@groggory - I don't know how hard sine waves would be but I agree it would be a great idea
@jmg, the code is using about half the hub ram. External ram used is about 250 kilobytes. The background could be loaded from the SD card directly to the display and doesn't necessarily have to stay in external ram. The pictures that change need to be in ram for fast refresh. As an example of sizes, the rotary knob picture is 10.5k, the switch is 5.6k and the font for the numbers is 54k.
My audio circuit is a 1k and a 10nF low pass filter, and then a 1uF polyester blocking capacitor.
Adding sin wave should be easy using the LUT in ROM. Of course it will take more than 2 pasm instructions (saw, pulse and triangle takes just two instructions to generate from the phase accumulator), so the 1.25 MHz sample rate will have to be decreased to something like 500 kHz ....
I will look into it tomorrow!
Adding sin wave should be easy using the LUT in ROM. Of course it will take more than 2 pasm instructions (saw, pulse and triangle takes just two instructions to generate from the phase accumulator), so the 1.25 MHz sample rate will have to be decreased to something like 500 kHz ....
It does a nice NCO based Sine table, (and square comes for -free) and has these version notes, which claim 1.25MHz scan rates.
(06-21-2012)
Version 2.0 - This file re-written based on the 2006 submission by Tracy Allen. It provides a 1.25MHz sampling rate over the 524kHz sample rate in the previous version
(06-22-2012)
Version 2.1 - Added the ability to specify Sine and Sync (Square Wave) pins to any I/O
It does a nice NCO based Sine table, (and square comes for -free) and has these version notes, which claim 1.25MHz scan rates.
Yes, 1.25 MHz is obviously possible for a pure sine wave generator that is just launched in a cog and then is free running without any realtime control of frequency, pulsewidth or wavetype.
In my case it's a little bit more complicated.
For every loop, one register is loaded from HUB RAM and that eats 28 cycles, so there's just 36 cycles left to do everything else. Of course I could remove the inverted signal and damping, that would save 8 cycles.
It depends on the voltage rating and dielectric type. A multilayer ceramic cap can easily fit an 0402 SMD footprint in that value range. But a polystyrene cap of the same value may have to be through-hole due to both its size and sensitivity to high soldering temperatures.
In English "sinus" only means the passages inside your nose "Sinusoid" or "sine wave" are the usual terms. (Don't worry, your usage wasn't getting up my nose(!))
I believe the sinus passages are named for their wiggly shape...
Yes, 1.25 MHz is obviously possible for a pure sine wave generator that is just launched in a cog and then is free running without any realtime control of frequency, pulsewidth or wavetype.
In my case it's a little bit more complicated.
For every loop, one register is loaded from HUB RAM and that eats 28 cycles, so there's just 36 cycles left to do everything else. Of course I could remove the inverted signal and damping, that would save 8 cycles.
As a code approach, I see no problem with using MORE of the COG, and having multiple variants that are chosen on init ?
The cog memory is free, and multiple versions can be educational too ?
The nature of a 'duty' DAC is forgiving of sample rates, and faster sample rates drop the DAC (Y axis) precision anyway, so you gain X precision somewhat at the cost of Y. With an external DAC, until you exceed its rate, gains in loop speed are real gains.
Can you post the audio circuit that you think gives the better results?
Just a basic 6 dB RC filter with ~20kHz cut off and a cheap OP as a buffer.
But there definitely are better solutions. That's the reason I will ask Phil!
@Phil Pilgrim
Do you have any schematic for a "cheap" but high quality filter + buffer solution with a steep filter curve?
@pik33
How did you achieve 12bit resolution using the video generator? I havn't had any time to analyze your code yet!
@jmg
I really like the idea of realtime control of all parameters at runtime. Then it can be used as an oscillator for my upcoming subtractive synthesizer.
The thing with my implementation is that you can add "unlimited" amounts of parameters and waveforms without they reducing the sample rate of the already existing code base.
In English "sinus" only means the passages inside your nose "Sinusoid" or "sine wave" are the usual terms. (Don't worry, your usage wasn't getting up my nose(!))...
I believe the sinus passages are named for their wiggly shape...
Actually this is not totally true. From the dictionary we get:
si·nus (sns)
n.
1. A depression or cavity formed by a bending or curving.
2. Anatomy
a. A dilated channel or receptacle containing chiefly venous blood.
b. Any of various air-filled cavities in the bones of the skull, especially one communicating with the nostrils.
3. Pathology A fistula leading from a pus-filled cavity.
4. Botany A recess or indentation between lobes of a leaf or corolla.
[Middle English, hollow in the body, from Medieval Latin, from Latin, curve, hollow.]
Elsewhere on the net we learn that:
SINE comes from the Latin SINUS, meaning a bend or gulf, or the bosom
of a garment. (We know the word from its anatomical meaning: the
cavities or bays in the facial bones - mine are badly congested right
now - and from the names of some "bays" on the moon.) The term was
used as a translation for the Arabic word "jayb," the word for a sine
that also meant the bosom of a garment, and which in turn comes from
the Sanskrit word "jiva" meaning a bowstring.
I would happily refer to "sine" as "sinus" and expect to be understood.
The nice thing about "sinus" is that it works for a lot of other languages with latin roots.
But yes when writing for a young English audience today I would use sine.
There's a small signal being generated at pin 0 , is it just mine or it's a bug somewhere ?
I just run the object (testBench.spin) and read it with an oscilloscope, besides pin 10 and 11 (defined by the object) I have a reading on pin 0, small but enough to lit a led.
si·nus (sns)
1. A depression or cavity formed by a bending or curving.
2. Anatomy
a. A dilated channel or receptacle containing chiefly venous blood.
b. Any of various air-filled cavities in the bones of the skull, especially one communicating with the nostrils.
3. Pathology A fistula leading from a pus-filled cavity.
4. Botany A recess or indentation between lobes of a leaf or corolla.
[Middle English, hollow in the body, from Medieval Latin, from Latin, curve, hollow.]
@heater, all true, but type "sine" into a Latin to English translator (or rely on my increasingly fading Latin from school!) and you get the English "without".
Simply, "without" harmonics.
SINE comes from the Latin SINUS, meaning a bend or gulf, or the bosom
of a garment.
But I shall ponder again the wonderful beauty of the shape so described. Strangely, sine waves look different to me now.
Oh, and as an aside, tonight I wrote about 10 scripts for antibiotics for sinus infections.
@Ahle2, thanks++ for this code. I shall add another switch to the touchscreen program so you can output sine waves.
@Phil Pilgrim
Do you have any schematic for a "cheap" but high quality filter + buffer solution with a steep filter curve?
? Butterworth ? Chebyshev ? Elliptic
Would use a few op amps though.
Then it can be used as an oscillator for my upcoming subtractive synthesizer.
*ears prick up* Sounds great. I'd love to build a graphical front end if you get this working. Lots of knobs and sliders and things.
There's a small signal being generated at pin 0 , is it just mine or it's a bug somewhere ?
Looks like a bug. The call in TestBench uses 32 for the sync pin claiming no pin. But the |< and << operators only look at the lower 5 bit anyway which makes 32 look like 0. As a quick fix you could change the start method in the PSG to:
Comments
Can you post the audio circuit that you think gives the better results?
It has two problems with pins 10/11 and a demoboard
1. it has low pass filter set @1.6 kHz@-3dB (and -20dB @ 20 kHz). This is easy to patch - use 680 Ohm..1k resistor instead (or parallel to) existing 10k
2. it has a headphone amplifier. It is designed to amplify accoustic signals, not high frequency ones.
Amazing. What is the code-footprint of that ? COG/Main Memory / Off Chip memory and Image memory ?
3. The headphone amplifier is nonlinear for AUDIO signals EVEN when patched with 680 ohm resistor. (my scope doesn't lie!)
Bass and treble are amplified and mids are damped... I have a feeling that the spectrum resembles the "loudness curve".
Modified Demo Board
RC filter with 20 kHz cut off
:-)
http://forums.parallax.com/showthread.php?140989-Using-counter-modules-to-control-frequency-of-sine-square-or-triangle-wave
@groggory - I don't know how hard sine waves would be but I agree it would be a great idea
@jmg, the code is using about half the hub ram. External ram used is about 250 kilobytes. The background could be loaded from the SD card directly to the display and doesn't necessarily have to stay in external ram. The pictures that change need to be in ram for fast refresh. As an example of sizes, the rotary knob picture is 10.5k, the switch is 5.6k and the font for the numbers is 54k.
My audio circuit is a 1k and a 10nF low pass filter, and then a 1uF polyester blocking capacitor.
I will look into it tomorrow!
Beau posted this Sinewave_v2.1.spin
http://forums.parallax.com/attachment.php?attachmentid=93836&d=1341006466
in another thread.
It does a nice NCO based Sine table, (and square comes for -free) and has these version notes, which claim 1.25MHz scan rates.
(06-21-2012)
Version 2.0 - This file re-written based on the 2006 submission by Tracy Allen. It provides a 1.25MHz sampling rate over the 524kHz sample rate in the previous version
(06-22-2012)
Version 2.1 - Added the ability to specify Sine and Sync (Square Wave) pins to any I/O
That's what Ive been using, but my hearing is not good enough to judge audio quality anymore.
Yes, 1.25 MHz is obviously possible for a pure sine wave generator that is just launched in a cog and then is free running without any realtime control of frequency, pulsewidth or wavetype.
In my case it's a little bit more complicated.
For every loop, one register is loaded from HUB RAM and that eats 28 cycles, so there's just 36 cycles left to do everything else. Of course I could remove the inverted signal and damping, that would save 8 cycles.
It's not about the signal generator, per se,
An eight knob object in itself would be pretty neat.
What could you use that for?
Oh how funny! You clowns are hystercal.
I'm down with .0001 uF.
But some things I assume are assumed to be thru-hole - in an SMT world.
Are they bigger than a breadbox?
Or smaller than a pea?
-Phil
* Added sine wave
* Added user definable waveform
Thanks Beau, I stole some ideas from your sine wave generator...
I believe the sinus passages are named for their wiggly shape...
OOOps... I just saw that I did the same mistake in the actual object. Have to fix it tomorrow, because it's very late... zzzZZZ
As a code approach, I see no problem with using MORE of the COG, and having multiple variants that are chosen on init ?
The cog memory is free, and multiple versions can be educational too ?
The nature of a 'duty' DAC is forgiving of sample rates, and faster sample rates drop the DAC (Y axis) precision anyway, so you gain X precision somewhat at the cost of Y. With an external DAC, until you exceed its rate, gains in loop speed are real gains.
The Demo Board actually gives a very good result after some more mods.
Just a basic 6 dB RC filter with ~20kHz cut off and a cheap OP as a buffer.
But there definitely are better solutions. That's the reason I will ask Phil!
@Phil Pilgrim
Do you have any schematic for a "cheap" but high quality filter + buffer solution with a steep filter curve?
@pik33
How did you achieve 12bit resolution using the video generator? I havn't had any time to analyze your code yet!
@jmg
I really like the idea of realtime control of all parameters at runtime. Then it can be used as an oscillator for my upcoming subtractive synthesizer.
The thing with my implementation is that you can add "unlimited" amounts of parameters and waveforms without they reducing the sample rate of the already existing code base.
-Phil
(1) set pll at something about 200 MHz (exact value has to be computed), and video generator to generate at pins 8..15
(2) from 16-bit sample value, get 7 higher bits and then compute two vscl values:
This gives 7-bit resolution. Another 5 bit has to be added: I have to shr $FFFFFFFF
And now output :
"mask1" is "1" at bits 10,11, to generate output with standard demoboard audio pins.
Actually this is not totally true. From the dictionary we get:
si·nus (sns)
n.
1. A depression or cavity formed by a bending or curving.
2. Anatomy
a. A dilated channel or receptacle containing chiefly venous blood.
b. Any of various air-filled cavities in the bones of the skull, especially one communicating with the nostrils.
3. Pathology A fistula leading from a pus-filled cavity.
4. Botany A recess or indentation between lobes of a leaf or corolla.
[Middle English, hollow in the body, from Medieval Latin, from Latin, curve, hollow.]
Elsewhere on the net we learn that:
SINE comes from the Latin SINUS, meaning a bend or gulf, or the bosom
of a garment. (We know the word from its anatomical meaning: the
cavities or bays in the facial bones - mine are badly congested right
now - and from the names of some "bays" on the moon.) The term was
used as a translation for the Arabic word "jayb," the word for a sine
that also meant the bosom of a garment, and which in turn comes from
the Sanskrit word "jiva" meaning a bowstring.
I would happily refer to "sine" as "sinus" and expect to be understood.
The nice thing about "sinus" is that it works for a lot of other languages with latin roots.
But yes when writing for a young English audience today I would use sine.
I just run the object (testBench.spin) and read it with an oscilloscope, besides pin 10 and 11 (defined by the object) I have a reading on pin 0, small but enough to lit a led.
Amaral.
@heater, all true, but type "sine" into a Latin to English translator (or rely on my increasingly fading Latin from school!) and you get the English "without".
Simply, "without" harmonics.
But I shall ponder again the wonderful beauty of the shape so described. Strangely, sine waves look different to me now.
Oh, and as an aside, tonight I wrote about 10 scripts for antibiotics for sinus infections.
@Ahle2, thanks++ for this code. I shall add another switch to the touchscreen program so you can output sine waves.
? Butterworth ? Chebyshev ? Elliptic
Would use a few op amps though.
*ears prick up* Sounds great. I'd love to build a graphical front end if you get this working. Lots of knobs and sliders and things.
"sine" -> "without"
Interesting, never heard that before.
Remote audio mixing-desk slice?
@Ahle: Is this no pin feature supposed to work for all pin parameters? Regardless, -1 or a NOPIN constant may be less confusing.
Yes, that's a bug.
I am coding in C/C++ many hours each day (at work), that blurs my "spin vision" a little bit.
I will fix it!
@Phil
Thank's.... that's an awesome site. It has got all you need to calculate the filter too!!