Maker Pro
Maker Pro

Sine Tone Generation Help!

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
http://talkingelectronics.com/projects/200TrCcts/200TrCcts.html#index

Try this website and look at the Phaseshift Oscillator. It has one very cheap BC547 npn transistor, 4 incredibly cheap resistors and 3 4n7 capacitors which are a few cents each (shop around - and ask for a business discount). If you use earphones which everyone has, I reckon you could make your budget. the circuit is advertised as a sine-wave generator.

There are also programs to turn your PC into a virtual oscilloscope to check the waveform. Good luck.
 

Sage

Aug 24, 2012
7
Joined
Aug 24, 2012
Messages
7
They can still be cost effective, an LM386 circuit adds about $1.50, the micro is about $1.50, a few more pennies for misc components and you are right in the budget area less the speaker of course... Not saying it's the cheapest solution but IMO it's one of the more adaptable and stable ones in the end...

I certainly agree that a micro is more flexible and adaptable (and in fact, it's probably less than $1.00 for a suitable micro).

There is also another significant benefit to the micro: the unit might be set externally (that is, not in-circuit) to output a particular frequency. That being the case, each unit may be able to use identical components (lower cost/fewer overall component types).

With a micro you do need to synthesize the sine wave; sine table PWM plus RC filter is straightforward, but we don't know her experience with micros (and that could be a factor, depending on time frame).

Based on the circumstances and requirements it may still be more prudent to go with a Wien bridge, but there are certainly a lot of advantages to micros.

As a side note, there are many other possibilities (including filtering the square wave) but the number of different circuits that need to be built make such options less interesting.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The other advantage of the micro is that you can have the frequency very precisely controlled via a crystal for the micro's clock. A simple cheap analog circuit is likely to drift unacceptably. I really don't think you have a prayer of getting what you want without using a microcontroller.

What are the specifications for the speaker? I.e. impedance and power. You can probably drive the speaker via a half-bridge (two transistors) and complementary PWM outputs.

Bob
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
you can have the frequency very precisely controlled via a crystal for the micro's clock.

This is my concern with an analog circuit, not only holding the frequency steady but setting it to start with... If you use cheaper 10-20% capacitors and resistors I can see it being nothing but a fiddling nightmare... Using better tolerance components drives the price up but still doesn't totally remove the drift...

What are the specifications for the speaker? I.e. impedance and power. You can probably drive the speaker via a half-bridge (two transistors) and complementary PWM outputs.

Good point, many of the cheap sound modules out of Asia are designed with two out of phase PWM outputs, hardly a *boom* sound but enough to drive a small speaker...
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
It's basically a poor man's class D digital amp!

Bob
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Another question. Does each unit have to be self contained? A single more powerful micro could support multiple outputs.

Bob
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
So you have perfect pitch for a 36-note octave? That's pretty unusual! And you want to produce sinewaves at pitches that fit with a 19-note octave? That means each tone will be related to the previous one by the 19th root of 2, which is 3.7155%, is that right? And your frequency range is 100~500 Hz. Remind me never to buy any of your music :)

Generating the frequency with resistors and capacitors is not going to be accurate or stable enough. You need a crystal as your timing source. These are commonly accurate to +/- 200 ppm which is +/- 0.02%.

The microcontroller option is pretty obvious. A microcontroller is clocked from a crystal and produces a digital representation of the sinewave at the desired frequency. This representation is then converted into an analogue signal by a DAC (digital-to-analogue converter), with final smoothing to remove the steps if necessary.

The sinewave is generated using discrete values and discrete intervals. For example, an 8-bit conversion provides 256 different values on the vertical axis (256 is 2^8). The number of points on the horizontal axis is not fixed, but if the points are produced by firmware running in the micro, you can achieve on the order of 100k points per second, so at 500 Hz you would get 200 points per cycle of the sinewave. Both of these figures (8-bit conversion, 200 points per cycle) should be fine for a single sinewave at maximum amplitude.

The points are calculated by firmware from a sinewave table that is included with the program. The firmware design would take a bit of thought. Do you have any microcontroller experience, or a friend who does? If so, what architecture(s)?

Another possibility would be to generate a squarewave at the desired frequency, and filter it using a bandpass filter.

The squarewave would be derived from a relatively high crystal frequency using frequency division by any integer. Assuming say a 20 MHz crystal frequency, dividing by 20000 would give a 1 kHz wave which would go through a final divide-by-2 stage to ensure a 50% duty cycle at 500 Hz. Dividing by 20001 would give a final frequency of 499.975 Hz which is only 50 ppm (0.005%) different, so frequency resolution would not be a problem!

The bandpass filter will remove frequencies other than the desired frequency, i.e. it will turn the squarewave into a sinewave. These can be made from LC (inductor-capacitor) circuits but this is not feasible in this application - the inductor would be too big, and the frequency would be hard to adjust, or they can be implemented using op-amps, or a switched capacitor filter, which is also clocked from a frequency source.

An op-amp-based bandpass filter might be the best option. Frequency accuracy and stability would have to be good, but not extremely good, since the frequency is set by the squarewave that is derived from the crystal.Probably just one preset potentiometer would be needed.

Edit: The bandpass filter would need to be retuned if the frequency was changed, that's what the preset potentiometer would be needed for.

Then of course you need an amplifier and speaker.

There used to be an IC called the SC11313 from Sierra Semiconductor that included the squarewave generator and a switched capacitor filter, but the division ratios had to be programmed by a microcontroller. I think there are other devices for direct sinewave synthesis from a crystal source; I'll do a web search and post again.

What kind of power source are you planning to use? Batteries, I guess?

What's your budget?
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Google direct digital synthesis sinewave.

Analog Devices make a range of parts. Ones that have use SPI or I2C programming will need a micro of some sort (even just a fifty cent one) to set the frequency.

I don't know about prices. Get some representative part numbers and look them up on Digikey. Good luck!
 

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
I have never seen any verifiable proof that even the most anal audiophile could accurately identify a digital from analog audio track in a controlled scientific setting with unaided ears... Especially if the digital track contains or 'spoofs' the analog noise and artifacts from the analog medium used...

What the coke man said. 'anal audiophile' sums it up: a person obsessed with having exacting standards for audio quality, but who's obsession pertains more to the standards rather than the audio. A bit like people buying brand name trainers or other sportswear :p

And as an autistic individual with savant hearing and the ability to see sound as well as hear it, I can say that I couldnt tell the difference between high quality digital and analog either ;)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
What the coke man said. 'anal audiophile' sums it up: a person obsessed with having exacting standards for audio quality, but who's obsession pertains more to the standards rather than the audio.
I strongly suspect that these people hear what they want to hear. If you KNOW when you're listening to analogue, and when you're listening to digital, it's easy to imagine the characteristics that you expect to hear for each, and I think it's quite possible that this will affect their perception enough that they will "hear" them.

I've said it before. I'll take notice of their opinion that X sounds better than Y if they can reliably distinguish X and Y in a properly conducted double blind listening test. Otherwise it's just wankery and posturing.

Oh well, _someone_ has to keep those manufacturers of $10k audio systems in business...

And as an autistic individual with savant hearing and the ability to see sound as well as hear it, I can say that I couldnt tell the difference between high quality digital and analog either ;)

Wow! That's so interesting! So you have synesthesia? How does it manifest itself?

What exactly do you mean by "savant hearing"?

I love it when I discover something new and amazing about people that I've been getting to know on the forums.

I agree completely. I can distinguish between a 128k MP3 and a WAV file (I did a double blind test) but when I listen to good quality analogue and digital, all I can say is that they both sound great!
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
I agree completely. I can distinguish between a 128k MP3 and a WAV file

128K Mp3 should have never become a standard, they gave the compression and digital audio a bad name... 256K should be the bare minimum standard for music, and at that point the difference is nil for most humans, bump up to 320K and beyond and you are beyond human capacity in almost all cases... I say almost all cases, since it is a lossy compression and thus there are artifacts that certain individuals might be able to pick out and identify...

I've said it before. I'll take notice of their opinion that X sounds better than Y if they can reliably distinguish X and Y in a properly conducted double blind listening test. Otherwise it's just wankery and posturing.

In ALL the arguments and data I have researched I have never found any conclusive proof that these 'anal audiophiles' would or have submitted and successfully passed such a test... I'm very much of the opinion that what they perceive to hear as 'better' is simply the analog artifacts that they are 'used' to hearing and thus expect that 'noise' to be present...

What really tickles me lately is when they get all excited when a band releases a vinyl LP, and rant and rave about how much better sounding it is... All the while totally oblivious to the fact that it was recorded and mastered digitally to start with, thus the analog version is simply a copy of the digital master and can thus never be superior...
 

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
I just tried out the 3-phase sine wave generator found in the ebook "200 transistor circuits - a free ebook" at
http://talkingelectronics.com/projects/200TrCcts/101-200TrCcts.html

It uses 3 npn transistors and 3 1uF caps and a few resistors.
It produced an audible tone on a piezo or crystal earpiece. I did not have the BC547 transistors so used 2n222's instead. Any npn's should work.

It produced a sine wave of 660Hz. The oscilloscope showed that the wave was not quite rounded - but reasonably sine-like.

By fiddling with the resistors to the bases the frequency changed. The components cost less than $2, which I think was the target. Also it only took minutes to make (longer to experiment with different frequencies).
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I just tried out the 3-phase sine wave generator found in the ebook "200 transistor circuits - a free ebook" at
http://talkingelectronics.com/projects/200TrCcts/101-200TrCcts.html
By fiddling with the resistors to the bases the frequency changed. The components cost less than $2, which I think was the target. Also it only took minutes to make (longer to experiment with different frequencies).
I doubt that would be accurate enough for this application. The OP wants to be able to choose frequencies in a 1:1.04 ratio, i.e. one frequency is only 4% higher than the next lower one. With multiple frequencies being emitted in different places around a room, there will be audible beat frequencies, which will drift upwards and downwards noticeably unless each frequency is very accurate and stable. I would interpret that to mean an absolute accuracy of 1% or preferably a lot better over the applicable temperature range. It would also require a frequency counter or at least an accurate reference oscillator when retuning any circuit. But clearly the OP is in the best position to make a judgement on this.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
128K Mp3 should have never become a standard, they gave the compression and digital audio a bad name... 256K should be the bare minimum standard for music, and at that point the difference is nil for most humans, bump up to 320K and beyond and you are beyond human capacity in almost all cases... I say almost all cases, since it is a lossy compression and thus there are artifacts that certain individuals might be able to pick out and identify...
I agree completely. It's a bit of a shame that MP3 is still the dominant standard for audio compression; apparently other lossy compression algorithms like AAC and others can get a much better sounding result at the same bit rate.

I've gone a bit anal with my music collection: it's all compressed using FLAC, which is lossless and gets typically 40~45% compression. Unfortunately, it's not widely supported. Even Adobe Audition (formerly Cool Edit Pro), which is brilliant in many respects, doesn't support FLAC natively.
In ALL the arguments and data I have researched I have never found any conclusive proof that these 'anal audiophiles' would or have submitted and successfully passed such a test...
Interesting. I haven't ever researched it. But I'm not surprised. I doubt they ever would consent to being tested, because they would rather stay in their little delusional world, where they can talk about subjective concepts like richness, warmth, mellowness, darkness, etc with other like-minded folks who will humour them by listening to their ramblings in return for having their own ramblings listened to, and try to impress newbies with their depth of knowledge and finely tuned perception.

I could be wrong, and I'm prepared to admit it, IF they can back up their claims with a properly conducted test.

I'm very much of the opinion that what they perceive to hear as 'better' is simply the analog artifacts that they are 'used' to hearing and thus expect that 'noise' to be present...
Could be. I think it could also be a case of simply hearing things that aren't there, because they expect to, and other factors put them in the right mood to feel a certain way when listening to what they believe is a particular reproduction option.

What really tickles me lately is when they get all excited when a band releases a vinyl LP, and rant and rave about how much better sounding it is... All the while totally oblivious to the fact that it was recorded and mastered digitally to start with, thus the analog version is simply a copy of the digital master and can thus never be superior...
ROFL :) Yeah. To be honest, I really have NO time for those people. But I enjoy making fun of them :)
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
This thread goes on a bit and I have not followed it all the way.

There were top octave generators (e.g. MK50240) which gave the 12 notes of an octave. These were divided down to give all the notes on the keyboard. The output was square wave but for 19 notes, two or three low pass filters would probably be adequate to remove the third harmonic to a sufficient extent.

A Google indicates that a PIC can do the job.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I'm very much of the opinion that what they perceive to hear as 'better' is simply the analog artifacts that they are 'used' to hearing and thus expect that 'noise' to be present...
I remember decades ago, when the tube vs. transistor debate was still new, some magazine "Popular Electrics?" did a double-blind test and the the "audiophiles" picked the tube amp quite reliably. Then they analyzed the characteristics of both amps. They then modified the transistor amp by adding in filters to match the poor high-frequency response of the tube amp and added 60Hz noise. Suddenly the test subjects could no longer tell the difference.

Bob
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
...adding in filters to match the poor high-frequency response of the tube amp ...

That wasn't a poor high frequency response, that was "warmth" generated by an enhanced low and mid-range, with just a hint of almost infra-sonic modulation. :D
 

milesdavidsmith

Aug 28, 2012
7
Joined
Aug 28, 2012
Messages
7
It might be a good idea to look into a small, cheap microcontroller (like an attiny). I bet you could get very creative with that, some capacitors/transistors, and pulse width modulation
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Portable MP3 players would be good sources of accurate sinewaves as well, though you would still need to add an amplifier and speaker on each one. You might be able to pick up a bundle of old ones that are being thrown away because they don't have enough gigabytes of storage to be cool any more.

Create the sinewaves using Adobe Audition, Audacity, etc, encode them to MP3 and transfer them onto the player. Each player could store dozens of tones, each of many hours' duration. Because of the signal's simplicity, you could probably encode them at quite a low bit rate.
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I remember decades ago, when the tube vs. transistor debate was still new, some magazine "Popular Electrics?" did a double-blind test and the the "audiophiles" picked the tube amp quite reliably. Then they analyzed the characteristics of both amps. They then modified the transistor amp by adding in filters to match the poor high-frequency response of the tube amp and added 60Hz noise. Suddenly the test subjects could no longer tell the difference.
LOL :)

How about digitised audio that's been ripped from vinyl? Include the needle drop, groove noise, clicks and pops, etc, in the digitised version. Then ask an "expert" to compare listening to the vinyl directly, against listening to the pre-recorded, digitised version. If he couldn't tell the difference, you could certainly argue that converting to and from digital causes no detectable degradation or colouring of the signal.
 
Top