AM and FM Tone Generators

A couple of tone generators - one of which generates “Amplitude Modulated” tones, the other generates “Frequency Modulated” tones.

Both generators are based on the same code, and use high quality wave-table synthesis to generate alias free waveforms, with a choice of Sine, Square, Triangle, Saw and Inverse Saw. Aliasing distortion is still possible with extreme settings, but will be much less than for simple geometric wave shapes.

Instructions for installing plug-ins:

Feedback, bug reports and suggestions are most welcome (and it is very encouraging for plug-in creators to receive feedback from people that use the effects).
FMToneGen.ny (3.95 KB)
AMToneGen.ny (3.95 KB)

Here’s a little sample of an FM-tone that I then processed with time stretching, reverb delay and filtering.

Hi Steve,

Thanks for the tone generators.

Could you please help with finding a solution to the following problem?
I am quite lost in my search for a software that could FM modulate a voice from a
microphone (or even better a prerecorded voice) with a high frequency sinusoid carrier signal. The
frequency of the carrier signal supposed to be adjustable up to 20kHz.

I have found a code that supposed to do this here
The first 42 seconds of the output wave looks good, but the sin wave starts deteriorating at 43.69020 and it gets even worse at 1:27.38060.
The code also uses a low pass filter, and I am not sure whether it will do any good for my purpose. The best would be a simple FM modulator code, which would allow the setting of the modulation parameters (to make it universal and tweakable).

Can you please advise if such software exists already, or how to write a Nyquist code that could accomplish this task.

Thanks for your help.

So let’s get to the crux. What is “your purpose”?

I want to generate subliminal messages which are AM or FM modulated high pitch 14.5kHz sinusoid signals.
The prerecorded sound modulates the carrier signal. I suppose filters would just lower the sound quality, this is why I said filters may not be desirable for this purpose.

These may be very useful to influence our subconscious minds to get rid of bad habits, or acquire good qualities.
It may be used in learning process as well.
I have created some AM modulated variants, but the FM modulation seems to be more difficult to create.
The patent describing the silent sound messages can be found here
It is still to be tested whether this method is effective or not, and also whether the FM or the AM variants are more efficient.

In the patent they describe a convoluted way of generating the AM message, and I don’t really understand why they don’t just perform a simple AM of the 14.5kHz carrier… Is there a big difference between their variant and the simple direct AM modulated one? If you can enlighten this curiosity I would be thankful.

There’s a topic here that discusses implementing “silent subliminals” in Nyquist:
To the best of my knowledge there is no verifiable or peer reviewed scientific evidence to support the efficacy of “silent subliminals” in any form, so I’m not able to comment on that.

The theory behind AM and FM (modulation) are described here:

Thanks Steve for the link and all the information you posted in those threads.
Now I see the subject with more clarity. Several modulator versions use 17500Hz as the carrier, but the patent mentioned only 14500Hz. Is this higher frequency mentioned in other papers, or is it just a way to make the output more silent?

Regarding the FM version of the modulator you posted on the thread
I have tried it and it works fine for short tracks (like 30s), but when it is longer than 2 minutes the output wave form gets very distorted. It is still possible to use it by splitting the audio track into small segments, modulate them separately using your code and the reassemble them. But this is a bit of bother for long tracks. Can this be accomplished using Nyquist code?

After some digging found this thread, which was also very useful to show me another possible solution
Based on the code on that page I have used the following modification:

(fmosc (hz-to-step 14500) (mult 6000 (aref s 0)))

Which produced a nice looking FM output without visible waveform distortion. Perhaps you can add some improvements to this code, or just give your opinion whether this will produce any good result related to antialiasing etc. which I did not take into account. Would a band pass filter 300-6000 Hz help improve the quality of FM modulation like in case of AM?

There is a lot of effort invested in making the output “silent”, or inaudible. My opinion on this is that from the point of view of effectiveness it is necessary only to be incomprehensible to the conscious mind. This is necessary to prevent the conscious mind from blocking, criticizing, or interfering with the messages, so that the messages can reach the subconscious and influence it.

If the conscious mind would understand these messages it could reject them by judging them to be impossible, or by doubts etc, thus the subconscious mind listening to the conscious mind would also reject them. Therefore, even if some high pitch chirping is audible, it should not influence the effectiveness of the messages, as long as they are heard and understood by the subconscious. So from psychological point of view this should work, just like hypnotic suggestion do work. The only source of error may be whether the subconscious mind can really hear and understand the hidden messages or not.

The output to be completely inaudible would be an important requirement only if intended to be used on others in a covert manner. But even then a masking song could do the job.

I know it is not the subject of this forum to discuss the effectiveness of the method, but it is still interesting to find out whether this really works, and in what form. I have not tested it yet, but even if this silent subliminal prove to be inefficient, some truth still must be in that subliminal hidden in sound is effective.

For example in this article
they reveal that the KGB used subliminals modulated on white noise which could influence the subjects within short period of time. I suppose the subjects were not eager to be influenced, so the placebo effect is out of question. I wonder whether they used FM or AM on the noise…

Try this on a mono audio track with a sample rate of 96 kHz:

(setf cf 20000)
(fmosc (hz-to-step cf) (mult 300 (sum 1 s)))


Tried the code and it produced an output signal.
When listening through HQ headphones I hear nothing, and when magnifying the track I see no sign of modulating signal on the carrier at all.
My previously generated FM signals show signs of modulating signal on the track at certain magnification levels (when the carrier waveform is still not visible), and some subtle high pitch noise or chirping is audible. So I am not sure if this contains enough modulator information to be heard by the subconscious.

Of course the 20kHz carrier is too high to be heard (maybe my headphones can not even produce it) and the modulation band is also quite narrow, so no wonder it is really silent. If I have understood the code right, then it supposed to produce an FM signal with 20kHz carrier and 600Hz deviation band (2*300Hz). Is this correct? The 600Hz modulation band seems to be very limited, not?

The spectrum shows a 20kHz signal with narrow slopes.

Have you tried demodulating it?

How do you do that with FM?

Well there’s a question. I wonder how likely it is that someone’s subconscious mind will not only know how to do that, but also be able to do that. :open_mouth:

Robert J.H. posted FM decoder code here: Has anyone found a demodulator for CD4 (Quadraphonic) Vinyl - #19 by Robert_J_H
You will need to change the cf value to match the carrier frequency used when encoding (like tuning in a radio).
Note, that code is very slow, so don’t try it on a long track :wink:

The output is likely to be very quiet, and there will be a loud glitch at the beginning, so miss out the first fraction of a second, then amplify the rest of it.

Yes this is indeed a good question, and I don’t know the answer to that. There is a lot of misinformation circling on the internet (some of them intentionally spread) and quite often the only way to know if something is true or not is to test it. This is what I am trying to accomplish.

Thanks for the excellent demodulator, it produced a very good quality sound even though I have not changed any cf value, but just pasted the unchanged code into the nyquist prompt and run it. To change the cf to 15500 would you have to add the following line to the top of the code?

(setf cf 15500)

The volume was indeed very low, and I wonder whether this is the fault (or characteristic) of the demodulator, or the modulator signal content of the FM signal is really so low. Would this not be too silent for the subconscious to hear it, if we suppose that it is able do demodulate it? Well, too many questions we can not answer I guess, so just remains the trial and error experimentation.

Actually, I (accidentally) posted some disinformation :blush: :smiley:
In Robert’s code “cf” is set near the bottom.

(setf sig (highpass8 (dem sig 30000) 50))

where “cf” is the value “30000”.
However, this is not my code and I don’t fully understand what it’s doing. I don’t know if “cf” is the “carrier frequency” or a “corner frequency” or something else (a good reason to use longer, more descriptive names for variables :wink:)
Anyhow, it seems to work well as it stands so I’d not worry about it.
No doubt Robert will comment if he reads this thread.

A bit of both.
The modulator can be made to produce a “stronger” modulation by increasing the “300” value, though very high values will create spillover into the audible range. That value must be less than 10000 (half the carrier frequency). Try a value of 5000.

Robert’s demodulator was a proof of concept, so it’s not really optimised.

You have to adjust the multiplication value (300) from Steve’s code.
Also, I don’t thin that the sum term is necessary since the carrier hasn’t to be transferred. As you say, experimenting is probably the best thing to do.
You can of course combine the modulation and demodulation into one piece of code until you’ve found the ideal settings.

Headphones should be able to produce up to 20 kHz, but you’re right, if they can’t then the 20 kHz carrier will effectively be filtered out before it even gets into the listener’s ears. Then again, what do I know - perhaps it’s like homoeopathy and the sound can be “diluted” until it’s totally absent and still work :confused:

Thanks Steve for the clarification. My first try was using a carrier of 14500Hz and modulation value of 6000 and I could hear at least parts of the message, so the FM signal did contain a lot of input signal content. I have demodulated it with Robert’s code and got an excellent quality and almost original amplitude sound.

In the present phase of my experimentation it is of no concern whether a chirping (or low volume) sound can be heard or not. All I am interested in is whether the output sound has got any noticeable effect on the subconscious or not. In fact to make sure we don’t err on making it inaudible due to hardware and ear limitations I intend to keep the carrier frequency in the middle of the 10kHz-20kHz slope, because this slope supposed to demodulate the signal (according to the patent). This way the ear has got also a good chance to hear it.

Regarding the dilemma whether the ear and subconscious mind can really hear and demodulate the AM and FM messages I have found a paper titled “Amplitude and Frequency-modulated Stimuli Activate Common Regions of Human Auditory Cortex”. The file is attached to this message.

In the document they describe the reaction of certain brain regions to both pure carrier signal, and AM or FM modulated sounds. The measurements proved that the ear and brain is indeed able to differentiate between the pure carrier and its modulated versions. They used a very low 300Hz carrier, and it is no big wonder that the AM version has got an effect, but the FM version’s effect is a bit surprising. This does not prove whether the messages have any effect on the subconscious, but it is a good start nevertheless.

Another interesting coincidence is that the article claims that if instead of a single carrier, several carrier signals are modulated then the effect on the brain is more intense. This seems to support my suspicion, that the Russian KGB used white noise as carrier for a good reason. I am sure they knew about the “silent subliminal” claims, they would surely prefer it if it would be more effective than using a white noise. The noise is composed of infinite number of sin signals which corresponds with the multiple carrier experiments in this document. So there is a high probability that the white noise based messages are more efficient (or only they are effective) than the silent sounds with a single carrier.

Therefore I will have to test the white noise variant as well. To get that done in FM mode there seems to be 2 options. One is to use Steve’s FM modulator that can modulate two sound tracks for short segments of the message and then finally reassemble the FM outputs. The other is to generate a significant number of white noise sinus signal components and modulate them with the input track using the fmosc command, and then mix them all together. This will be only an approximation of modulated white noise, but it should produce similar results as the real modulated white noise.

If anybody feels like writing a code to automate any or both of these versions I would be very glad, because I am new to the nyquist and don’t plan to get into it deep. I would not use it for anything else so it would not pay for the time and effort invested in learning it.

Thanks Robert for your code and help. I wish I could understand how your demodulator works, but it would be quite sufficient if you could just describe what the constants and variables represents. This way we could tweak it for different frequencies and situations.
Cereb. (815 KB)

I think the variable names should be clear.
CF is the carrier frequency.
CS means cosine and SN sine.
REF-… means reference oscillator.
The multiplication brings the modulated signal down to be centered around DC.
ATAN2 calculates the phase difference between two consequent pairs (CS-1;SN-1 ↔ CS0;SN0)
The difference calculation is so complicated because Nyquist implements no complex difference.
We are interested in the instant frequency, which is nothing but the slope of the instant phase.
For example: the phase could go 0 45 90 135 180 etc. This makes a difference of 45 degrees from one pair to the other. The slope for this sequence is 0 like a constant velocity, i.e. we have no modulation.
We take the difference first because otherwise, the phase would go beyond 360 degrees and we had to unwrap the phase.
This is exactly the problem that we have in Steve’s modulation code. The signal is modulated with a time table. This ramp is created by integration, thus 1 1 1 … gets 1 2 3 …
After a while, the floating point precision is not enough to express the time index for the next sample.

My demodulation code has it’s limits too, most notably when the instant phase difference goes over 360 degrees (or rather 2 PI).

You can of course modulate your signal with any carrier signal you like.
For a sawtooth for example:

(fmosc (hz-to-step 20000) (mult 8000 s) *saw-table*)

Another predefined wave form is tri-table.
White noise would be made with e.g.

(maketable (abs-env (noise 0.1)))

instead of the term.
The problem is that those sounds are not band-limited and you’ll get a lot of aliasing, apart from the fact that you can not demodulate these signals (and I am pretty sure my brain can’t do it either). They are more interesting from a FM Synthesis point of view. You could of course build up a separate lookup table for your custom waveform, for instance with the build-harmonic function.

Thanks Robert for the excellent explanation. You have basically solved the FM white noise problem.
Now I have got all the tools required, and generated the 4 types of subliminals.
Only the testing remains.

Thanks for all who contributed to solving the modulation problems. :smiley:

Hi Steve and thanks for Your modulation program.
I have one question: it would be so difficult to include the possibility to have a message in the form of “Cosine” wave? In this way it would be possible to have, for message frequency equal to an odd multiples of the carrier, the correspondence of the peaking level of the message with the zero of the carrier. I need this feature for generate a test signal in the form of “shaped burst” (If someone of You have ever work with Audio Precision measurement instrument know what I’m talking about)
Please let me know, I hope that this will not be so difficult to realize!