coding entire tracks

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
SledgeNL
Posts: 6
Joined: Mon Sep 19, 2016 8:17 am
Operating System: Windows 10

coding entire tracks

Post by SledgeNL » Mon Sep 19, 2016 8:54 am

Windows 10
Audacity 2.1.0

Hello!

I'm wondering whether it is possible to 'code' an entire track (or multiple tacks), like "from timestamp 0 to timestamp 10 a chirp from 440 Hz to 880 Hz ... " with all additional information needed for a chirp (or other type).
I want to make an audiofile in which the frequencies at specific moments come from a (stochastic) formula (made in excel at the moment) with a chirp in between these points. I tried it manually, very labour intensive, and practically impossible to change as points are very much related. And trying out various sets of data is kind of the core what I want to do.
And example of what I wanted to 'smooth' out (it's now going from semitone to semitone): https://www.youtube.com/watch?v=m2x85LB0ZO8. Every white dot is a 'moment with parameters'.

And if it's possible: how do I do it?

Regards, Henriette

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

Re: coding entire tracks

Post by steve » Mon Sep 19, 2016 10:03 am

You can do it using the built-in "Nyquist" scripting language (see: http://wiki.audacityteam.org/wiki/Nyqui ... _Reference)

For example, this code may be run in the Nyquist Prompt effect (see: http://manual.audacityteam.org/man/nyquist_prompt.html)
The "data" list contains a sequence of frequency and duration pairs, where frequency is in Hz and duration in seconds.

Code: Select all

;type generate

(setf data (list 1000 1 2000 0.5 500 1 500))
(hzosc (pwlvr-list data))
So in this specific case, a sine wave is produced that starts with a frequency of 1000 Hz, which then rises over a period of 1 second to 2000 Hz, then over the next 1/2 second the frequency falls to 500 Hz and stays at 500 Hz for 1 second.
Extrapolation between the data points is linear, as can be seen in the track spectrogram:
firsttrack002.png
firsttrack002.png (43.54 KiB) Viewed 454 times
If you have further questions about programming Nyquist scripts, we have a forum board here: http://forum.audacityteam.org/viewforum.php?f=39
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: coding entire tracks

Post by steve » Mon Sep 19, 2016 10:05 am

SledgeNL wrote:I want to make an audiofile in which the frequencies at specific moments come from a (stochastic) formula (made in excel at the moment) with a chirp in between these points. I tried it manually, very labour intensive, and practically impossible to change as points are very much related. And trying out various sets of data is kind of the core what I want to do.
And example of what I wanted to 'smooth' out (it's now going from semitone to semitone): https://www.youtube.com/watch?v=m2x85LB0ZO8. Every white dot is a 'moment with parameters'.
Feel free to tell us more about your project. It looks very interesting (to me anyway ;))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 9962
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: coding entire tracks

Post by Trebor » Mon Sep 19, 2016 10:48 am

SledgeNL wrote:And example of what I wanted to 'smooth' out (it's now going from semitone to semitone): https://www.youtube.com/watch?v=m2x85LB0ZO8. Every white dot is a 'moment with parameters'.
Temporal blurring of any audio is possible with Audacity's "Paul Stretch" ...
PaulStretch, blur no stretch.png
PaulStretch, blur no stretch.png (5.18 KiB) Viewed 452 times
But I think you maybe looking for glissando : where the frequency glides between notes.
The easiest way to do that is have your program to interpolate between the points.

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

Re: coding entire tracks

Post by steve » Mon Sep 19, 2016 11:54 am

If I've interpreted your equations correctly, this gives the music for one Earth year, compressed into 36.5 seconds.
"basehz" is an arbitrary frequency offset.

Code: Select all

;type generate

(setf r1 149.0)
(setf r2 108.0)
(setf t1 365.0)
(setf t2 (/ (* 8 365.0) 13.0))
(setf dur 36.5)
(setf basehz1 440)
(setf basehz2 440)

(setf xt (sum basehz1
              (mult r1 (lfo (/ 10.0 t1) dur *sine-table* 90))
              (mult r2 (lfo (/ 10.0 t1) dur *sine-table* 90))))

(setf yt (sum basehz2
              (mult r1 (lfo (/ 10.0 t2) dur *sine-table* 0))
              (mult r2 (lfo (/ 10.0 t2) dur *sine-table* 0))))

(mult 0.4 (sim (hzosc xt)(hzosc yt)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

SledgeNL
Posts: 6
Joined: Mon Sep 19, 2016 8:17 am
Operating System: Windows 10

Re: coding entire tracks

Post by SledgeNL » Mon Sep 19, 2016 7:50 pm

Sweet! Thank you, Steve!

I have to take a good look at the second set of code, because the result sounds very different from what I had in mind - maybe because it's quite slow (and then the semitone restriction makes nice dissonants)

But the fact that I can program in Audacity opens a lot of possibilities - kind of a box of Pandora as there are just so many hours in a day.

My first project in audacity was this: https://www.youtube.com/watch?v=U4QsagMRgrE.
And there are more examples on that channel (some worse than others :-) ).

Ultimately I would like to find a way to combine audio and video, where synchronicity is vital. Or maybe something with motion capture where the position of a hand leads to sound. All based on formulas/logic.

Xenakis would have loved this, I think :-) (have you read "Formalized Music", contains Fortran code (that I haven't deciphered yet))

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

Re: coding entire tracks

Post by steve » Mon Sep 19, 2016 11:53 pm

Just playing around with the idea, I quite liked this version:
(the duration 29.2 seconds is one complete cycle which can be looped)

Code: Select all

;type generate

(setf r1 149.0)
(setf r2 108.0)
(setf t1 365.0)
(setf t2 (/ (* 8 365.0) 13.0))
(setf dur 29.2)
(setf basehz1 440)
(setf basehz2 440)

(setf xt (sum basehz1
              (mult r1 (lfo (/ 100.0 t2) dur *sine-table* 0))
              (mult r2 (lfo (/ 100.0 t1) dur *sine-table* 90))))

(setf yt (sum basehz2
              (mult r1 (lfo (/ 100.0 t1) dur *sine-table* 90))
              (mult r2 (lfo (/ 100.0 t2) dur *sine-table* 0))))

(mult 0.4 (sim (hzosc xt)(hzosc yt)))
or if you start with a stereo track (Tracks menu > Add new > Stereo track), you can make "stereo music":

Code: Select all

;type generate

(setf r1 149.0)
(setf r2 108.0)
(setf t1 365.0)
(setf t2 (/ (* 8 365.0) 13.0))
(setf dur 29.2)
(setf basehz1 440)
(setf basehz2 440)

(setf xt (sum basehz1
              (mult r1 (lfo (/ 100.0 t2) dur *sine-table* 0))
              (mult r2 (lfo (/ 100.0 t1) dur *sine-table* 90))))

(setf yt (sum basehz2
              (mult r1 (lfo (/ 100.0 t1) dur *sine-table* 90))
              (mult r2 (lfo (/ 100.0 t2) dur *sine-table* 0))))

(mult 0.8 (vector (hzosc xt)(hzosc yt)))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Trebor
Posts: 9962
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: coding entire tracks

Post by Trebor » Tue Sep 20, 2016 9:00 am

SledgeNL wrote:My first project in audacity was this: https://www.youtube.com/watch?v=U4QsagMRgrE
Reminds me of PhotoSounder .... https://www.youtube.com/watch?v=W8MCAXhEsy4

SledgeNL
Posts: 6
Joined: Mon Sep 19, 2016 8:17 am
Operating System: Windows 10

Re: coding entire tracks

Post by SledgeNL » Tue Sep 20, 2016 7:49 pm

Trebor wrote:
SledgeNL wrote:My first project in audacity was this: https://www.youtube.com/watch?v=U4QsagMRgrE
Reminds me of PhotoSounder .... https://www.youtube.com/watch?v=W8MCAXhEsy4
PhotoSounder was one of the applications I've researched for my wish "to make pictures sound". Audiopaint was the only one that had a free version that you could actually do something with. On my YouTube channel I have a few videos that where done with it ('Star Wars' and 'La Tour Eiffel').
Now I want to go random through a picture, pick up information (color, position) and transform those to musical parameters. And those I might feed into Audacity. Once I get the hang of the Nyquist language :-).

And the actual picture is kind of not in the picture anymore.... (although I want it back at some point)

Trebor
Posts: 9962
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: coding entire tracks

Post by Trebor » Wed Sep 21, 2016 7:20 am

SledgeNL wrote:Now I want to go random through a picture, pick up information (color, position) and transform those to musical parameters. And those I might feed into Audacity.
You can feed raw image-data into Audacity, but it's unlikely to sound musical ...
https://www.youtube.com/watch?v=cXjwJPz4qi0

You may be interested in the earslap projects ...
e.g. otomata ... https://www.youtube.com/watch?v=d2TPCmvxdTc

Post Reply