Adding a waveform

Hello forum, first the bad news…I never coded anything, ever.
I did input some basic into a Commodore vic20 a long time ago. It rarely worked.
And I’m almost completely new to Audacity. I have used Cool Edit Pro quite a bit.

The good news, I dont need a lot. (and I dont have Covid :slight_smile:

I have version 2.3.0

So I click Generate/Tone
Right there I want to add a new waveform.
I want instant attack, minimal duration, and instant decay
On an oscilloscope it would look like this…l…l…l…l
Its an instantaneous impulse
Because I like John Bedini, Nicola Tesla, John Hutchison et al.

Can anyone help please???

A Rhythm track may suit your needs: https://manual.audacityteam.org/man/rhythm_track.html

WC

Topic moved to General Audio Programming board.

I think the expression you are looking for is “impulse train”.

As waxcylinder wrote, the “Rhythm Track” generator will give you something similar, though not “instant” up and down.

There are many different types of impulse trains. They may go up from a base line of zero (silence) and then back down to zero, they may go up and down around zero (2 samples), they may be “band limited” (called a “BLIT”), just to name a few.

Here’s a Nyquist script (Nyquist - Audacity Manual) that can be run in the “Nyquist Prompt” effect (Nyquist Prompt - Audacity Manual) that will create a simple “one sample up” impulse train:

;type generate

(setf hz 100) ;frequency
(setf dur 10) ;duration in seconds

(setf samples (round (/ *sound-srate* hz))) ;length of 1 cycle in samples

;create an array for one cycle of output sound
(setf s-array (make-array samples))

;; Initialize thearray with zeros
(dotimes (i samples)
  (setf (aref s-array i) 0))

;set first sample to 1
(setf (aref s-array 0) 1)

; create a "wavetable"
(setf table (maketable (snd-from-array 0 *sound-srate* s-array)))

; Generate the tone
(osc (hz-to-step hz) dur table)

See also:
https://www.cs.cmu.edu/~rbd/doc/nyquist/part19.html#index1493
https://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index358
https://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index380

Thanks Wax, thats something I considered but not quite what I was after

And Steve, marvelous mate, exactly what I wanted, got it work with a minute or two.

Just got to learn Audacity and I will be well on my way. Thanks again both of you.