Audacity PEMF tone generators

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
dmonty
Posts: 20
Joined: Sat Feb 25, 2017 9:15 pm
Operating System: Linux *buntu

Re: Audacity PEMF tone generators

Post by dmonty » Wed Mar 15, 2017 6:29 am

Attempt to duplicate the pemf machine waveform. However the magnet frequency can't go as high due to the long lead in.

Code: Select all

;nyquist plug-in
;version 4
;type generate
;name "PEMF v1"
;preview true
;action "Generating PEMF Pulse ..."
;author "Dean Montgomery"
;copyright "Released under terms of the GNU General Public License version 2"
;control magfreq "Magnet frequency" int "Hz" 120 1 22050
;control magduty "Magnet duty cycle" int "% (5)" 5 1 99
;control magamp "Magnet Amplitude" int "% (98)" 98 80 100
;control pulsefreq "Pulse frequency" int "Hz e.g. (12),4,8,20,2" 12 1 50
;control pulseduty "Pulse duty cycle" int "% (49)" 48 1 99
;control dur "Duration 5m,8m,10m,20m" int "seconds (60) = 1min" 60 1 3000
;;control dur "Duration" int "minutes (10)" 10 1 20

(print (type-of magduty))
(setf magduty (* magduty 0.01))
(print (type-of magduty))
(setf pulseduty (* pulseduty 0.01))
(setf magamp (* magamp 0.01))
;;(setf dur (* dur 60))
;;(setf x (/ magfreq 60))
(setf x magfreq)
(setq *mag-pulse-table* (list
  (congen (pwl (* 0.0001133787 x) -0.21 (* 0.0031746032 x) 0.13 (* 0.0032653061 x) 0.95 (* 0.0032879819 x) 0.94 (* 0.003446712
 x) 0.018 (* 0.0036281179 x) 0.00 (* 0.0037 x) 0 1.00 ) 0.003 0.003)
  (hz-to-step 1) t))
(setq *pulse-table* (list
  (pwl 0 1 pulseduty 1 pulseduty 0 1)
  (hz-to-step 1) t))

(seqrep ( i dur )
  (mult
    (hzosc magfreq *mag-pulse-table*)
    (hzosc pulsefreq *pulse-table*)))


steve
Site Admin
Posts: 47319
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: Audacity PEMF tone generators

Post by steve » Wed Mar 15, 2017 10:06 am

That is a strange shape waveform. Why that shape? Is that the optimum / ideal shape, or is it just the best that the manufacturers could do within constraints of their chosen methods, development time. profit and manufacturing considerations... In other words, what were the technical design goals that resulted in that waveform?

The visual appearance of waveforms can be misleading. For example, these two waveforms have identical spectra, but their waveforms look very different. If our design goal was to produce the spectrum of these waveforms, the first form (a simple on/off square wave) is much easier to replicate exactly than attempting to match the complicated curves of the second version. On the other hand, if the phase relationship of the frequency components in the second track is the most important design issue, then first track, though much easier to produce, would be far from optimal.

Looking at it another way, is the "sawtooth" part of the waveform required to produce the desired magnetic and physiological effects, or is it just an irrelevant side effect of the hardware design? The final part of the pulse looks much like a transform-limited pulse - is that perhaps the design goal?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

dmonty
Posts: 20
Joined: Sat Feb 25, 2017 9:15 pm
Operating System: Linux *buntu

Re: Audacity PEMF tone generators

Post by dmonty » Wed Mar 15, 2017 9:55 pm

steve wrote:That is a strange shape waveform. Why that shape? Is that the optimum / ideal shape, or is it just the best that the manufacturers could do within constraints of their chosen methods, development time. profit and manufacturing considerations... In other words, what were the technical design goals that resulted in that waveform?
Only reason why I posted it is because my pwl was generating a horrible pulse as you guys pointed out.
steve wrote:The visual appearance of waveforms can be misleading. For example, these two waveforms have identical spectra, but their waveforms look very different. If our design goal was to produce the spectrum of these waveforms, the first form (a simple on/off square wave) is much easier to replicate exactly than attempting to match the complicated curves of the second version. On the other hand, if the phase relationship of the frequency components in the second track is the most important design issue, then first track, though much easier to produce, would be far from optimal.

Looking at it another way, is the "sawtooth" part of the waveform required to produce the desired magnetic and physiological effects, or is it just an irrelevant side effect of the hardware design? The final part of the pulse looks much like a transform-limited pulse - is that perhaps the design goal?
Good questions - I don't have an answers to. Been reading through medical papers on Google Scholar some are specific about the waveform and frequency and others are just using a pre-build machine.
https://scholar.google.ca/scholar?hl=en ... +arthritis
https://scholar.google.ca/scholar?hl=en&q=pemf+bone
https://scholar.google.ca/scholar?hl=en ... tendinitis
https://scholar.google.ca/scholar?hl=en&q=pemf+headache

Right now I'd like to improve the PEMF wave-form generator so it creates good clean magnetic pulse and scales from low Hz to high without too much distortion. It is somewhat broken at higher frequencies.
So far I've learned:
* When the duty cycle is too long then the DC pulse turns into an AC pulse.
* When the duty cycle is too short the magnet looses power. With the exception of higher frequencies.
* If the amplifier or audio line out on the computer are too loud the DC pulse morphs into an AC pulse.
* If the slew-rate is too fast (square), Audacity's Frequency Analysis tool shows a "mess" especially at higher frequencies. When the pulse has a (bell-shape) then the Frequency Analysis tool shows a somewhat linear frequency report with equally spaced peaks. It seems the bell-shaped pulse has more control over magnet.
* Generally aiming for approx ~1ms pulse with ability to fine tune the slew-rates and duty cycle.

I really like the Audacity platform. Thanks again for the help and feedback.

dmonty
Posts: 20
Joined: Sat Feb 25, 2017 9:15 pm
Operating System: Linux *buntu

Re: Audacity PEMF tone generators

Post by dmonty » Thu Mar 16, 2017 1:38 am

steve wrote:That is a strange shape waveform. Why that shape? Is that the optimum / ideal shape, or is it just the best that the manufacturers could do within constraints of their chosen methods, development time. profit and manufacturing considerations... In other words, what were the technical design goals that resulted in that waveform?
Trying to figure and answer the same question. In terms of wave forms, it appears like each manufacturer has their own. Some patented wave forms are explained with more detail:
https://www.google.com/patents/EP0995463A1?cl=en
https://www.google.ca/patents/US6786859 ... 8Q6AEIPjAE

Commonalities:
* sawtooth(ish)
* vary over time - not a constant pulse. i.e. change every few minutes.
* magnet's Hz is cycled on and off with a secondary very low Hz.
* 2 of the machines indicate that it is DC pulse. Not AC.
* Even though the machines use different wave forms and use different magnetic intensities, they all have positive results.

So far Audacity has been successful with creating waveforms that has greatly helped various ailments in the family: chronic back pain, calcified tendinitis, arthritis, eczema.

steve
Site Admin
Posts: 47319
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

Re: Audacity PEMF tone generators

Post by steve » Thu Mar 16, 2017 10:10 am

dmonty wrote:* Even though the machines use different wave forms and use different magnetic intensities, they all have positive results.
Then perhaps the pulse shape is not particularly important in terms of effectiveness ?

I presume that the intensity of the magnetic flux is important (otherwise they would run the device with lower power). So for your home-made equipment which has limited power, higher flux is better, right?

As Robert mentioned earlier, running an audio amp flat out with a square pulse risks frying components in the amp.
I'm also imagining your neighbours wondering why they keep getting "tick tick tick" on their TV / radio. Have you tested for RF interference produced by the equipment?

Regardless of whether your amp blows up, or whether you ruin your neighbour's evening in watching TV, we know that we want to efficiently produce discrete pulse of high magnetic flux. So perhaps a good way to proceed would be to test different shaped pulses, keeping everything constant except for the pulse shape, and measure the flux produced. So the amp needs to be set the same for each test, the pulses to have the same peak amplitude (a limiting factor on how much voltage gain the amp can provide), and measurements made in the same way.

Some ideas:

Square and trapezoid pulses can be made easily with PWL (as you have been doing).

A raised cosine pulse can be easily produced using something like:

Code: Select all

(setf dur 0.1)
(abs-env 
  (mult 0.5
    (sum 1 (osc (hz-to-step (/ dur)) dur *sine-table*  -90))))
This gives a nice "Gaussian" bell-shaped pulse:

Code: Select all

(defun pulse (y n)
"n is the number of samples returned"
  (setf y (float y))
  (setf arpulse (make-array n))
  (let* ((ln (1- (length arpulse))) ;arrays are zero indexed
         (step (/ 2.0 ln))
         (offset (/ y))
         (norm (/ (- 1 offset))))
    (do ((x -1.0 (+ x step))
         (index 0 (1+ index)))
        ((> index ln)(snd-from-array 0 44100 arpulse))
      (setf val (power y (- (* x x))))
      (setf (aref arpulse index) (* norm (- val offset))))))

(setf pulse (pulse 2000 451))
(setf hz 10)
(seqrep (i 100) (at-abs (/ i (float hz)) (cue pulse)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 4513
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows Vista

Re: Audacity PEMF tone generators

Post by Trebor » Fri Mar 17, 2017 8:36 am

dmonty wrote:Some patented wave forms are explained with more detail:
https://www.google.com/patents/EP0995463A1?cl=en
https://www.google.ca/patents/US6786859 ... 8Q6AEIPjAE
#1 Patent application, (not granted) , #2 lapsed Patent , (non-payment of fees).
If the thing worked they'd have enough money to pay the fees, and reason to do so: to maintain monopoly control.

NB: Having been granted a patent is not proof the invention does work, or could work,
e.g. https://patents.google.com/patent/GB1310990A :D
dmonty wrote:greatly helped various ailments in the family: chronic back pain, calcified tendinitis, arthritis, eczema ...
see ... http://rationalwiki.org/wiki/Panacea

dmonty
Posts: 20
Joined: Sat Feb 25, 2017 9:15 pm
Operating System: Linux *buntu

Re: Audacity PEMF tone generators

Post by dmonty » Sat Mar 18, 2017 4:06 am

Trebor wrote: #1 Patent application, (not granted) , #2 lapsed Patent , (non-payment of fees).
If the thing worked they'd have enough money to pay the fees, and reason to do so: to maintain monopoly control.

NB: Having been granted a patent is not proof the invention does work, or could work,
e.g. https://patents.google.com/patent/GB1310990A :D
dmonty wrote:greatly helped various ailments in the family: chronic back pain, calcified tendinitis, arthritis, eczema ...
see ... http://rationalwiki.org/wiki/Panacea
Trebor wrote:PEMF is recommended by Dr Oz
Trebor, I completely agree with you. Our family jokingly calls these expensive PEMF machines: "the best snake oil ever tasted"! The Wikipedia page on Dr. Oz notes
"An investigation by the British Medical Journal found that 46% of his claims were misleading or incorrect".
It is also illegal in my country to use testimonials for proof that something works. The testimonials that I posted could very well be a placebo effect due to an elaborate placebo machine. We are receiving pain relief, not because the electromagnetic pulse works but because we anticipate and believe that it works. I may just be Pavlov's Dog - salivating over a "bell shaped" sinusoidal tone generated in Audacity to drive an electromagnet.

The placebo effect is know to be so persuasive that in order for medical research to be valid, it must be blind or double-blind. i.e.
* The subjects are divided up and half receive no magnetic pulse ( a placebo ).
* The doctor analyzing the physiological and biochemical changes of the subjects must also not know know if the subject received the magnetic pulse or not. This avoids medical bias.

The best way to investigate if PEMF is placebo or not would be to read the double-blind scientific peer reviewed articles. Try Google Scholar (not Dr Oz website):
https://scholar.google.ca/scholar?hl=en ... +arthritis
https://scholar.google.ca/scholar?hl=en&q=pemf+bone
https://scholar.google.ca/scholar?hl=en ... tendinitis
https://scholar.google.ca/scholar?hl=en&q=pemf+headache

I will stop posting testimonial info. This is the wrong forum to discuss, explain, prove or disprove PEMF therapy. Yes I'm building a PEMF device. I'm on the form to get assistance with Audacity and Nyquist plugins. So far the forum members have been a great in helping me generate wave-forms used to drive an electromagnet.

Trebor
Posts: 4513
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows Vista

Re: Audacity PEMF tone generators

Post by Trebor » Sat Mar 18, 2017 5:40 am

dmonty wrote:The placebo effect is know to be so persuasive that in order for medical research to be valid, it must be blind or double-blind. i.e.
* The subjects are divided up and half receive no magnetic pulse ( a placebo ).
* The doctor analyzing the physiological and biochemical changes of the subjects must also not know know if the subject received the magnetic pulse or not. This avoids medical bias.
The field-strength with the commercial PEMF machines is enormous : enough to cause muscles to twitch,
and sparks if metal objects are nearby, (see this scam cancer-clinic in Mexico).
So difficult to come up with a double-blind experiment, as the those getting the "real" treatment will feel it.

It was in your interest (and your family) for me to mention that quack electro-therapy devices exist,
e.g. ... https://youtu.be/gwahOVUYmk4?t=40s

Robert J. H.
Posts: 1816
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Audacity PEMF tone generators

Post by Robert J. H. » Sat Mar 18, 2017 4:49 pm

dmonty wrote:Here is a 1 second of a recorded pemf pulse.
pemf2.flac
Thanks DMonty, very kind.
Robert

dmonty
Posts: 20
Joined: Sat Feb 25, 2017 9:15 pm
Operating System: Linux *buntu

Re: Audacity PEMF tone generators

Post by dmonty » Sat Mar 18, 2017 6:16 pm

I found the echo while recording the magnetic pulse via mic can be fixed in Audacity by:
Unchecking: Edit=>Preferences=>Recording=>Software Playthrough

The magnetic pulses are much cleaner and now closely match the audio out wave form.

Post Reply