Simple Code for Editing

Hoping to find a way to make 4 notes of different tempo run in a random program that plays one of the four in sequence with a pause. It’s very simple code in python for numbers but no idea how to do with audacity.

here is what the random looks like with notes

C D A B D A B C D A C B

or

3 4 1 2 4 1 2 3 4 1 3 2 then a pause… then 1 4 3 2 2 1 4 3 1 4 3 2 pause…
the coding would be to do the above.

Suggestions?

Best regards,

I don’t know how to do it… I’ve never programmed in Python or Nyquist.

What do you need Audacity for? Python should be able make sine or square waves, etc., and play the sound or make a WAV file.

Or, I’m sure Nyquist (which works in Audacity) can also do it.

I just haven’t found a good tutorial for it I guess. I’m the type that needs to see the code first to get it. I know a while loop with some randomness would work but it needs to be from a wav file and not generated in the program. Just need to figure that out. I just looked into nyquist. Looks promising.

This sort of thing?
(Run it in the “Nyquist Prompt”)

;type generate

(defun note (pitch)
  (setf dur (/ (random 8) 8.0))  ;Note duration in seconds
  (mult (pwlv 1 dur 0) (osc pitch dur)))

(setf notes (list C4 D4 E4 F4 G4 A4 B4 C5))
(setf pattern (make-random notes))

(setf note-count 32)  ;Number of notes in sequence
(seqrep (i note-count) (note (next pattern)))

More info:

This topic was automatically closed after 30 days. New replies are no longer allowed.