How to play frequencies in a row

Help for all users of Audacity 2.x on Windows.

This forum is for Audacity 2.x on Windows.
For all help enquiries, please state which version of Windows you are using and whether you installed Audacity from the .exe installer or obtained the zip.

Users of Audacity 1.3.x are encouraged to update by downloading the latest version from here.
The old forum for Audacity 1.3.x on Windows is HERE.

How to play frequencies in a row

Permanent link to this post Posted by PhilN » Sat Apr 06, 2013 8:19 pm

Hello,

I can play single frequency using Tone generator, but
I would like to play different frequencies in a raw, for instance :
262Hz during 1s
then silence during 200ms
then 460Hz during 1.5s
then silence during 300ms...

It could be useful to make my students understand the link between frequencies and musical notes.

Thanks for answer !
PhilN
 
Posts: 3
Joined: Sat Apr 06, 2013 8:04 pm

Re: How to play frequencies in a row

Permanent link to this post Posted by Damienb » Sat Apr 06, 2013 11:33 pm

I haven't finished my cup of tea for the morning and we've had a time change.... but do you mean something like the picture below?

tones.jpg
tones.jpg (145.25 KiB) Viewed 90 times


Each time you generate a new tone, it puts it on a new track. So I used the time shift tool to drag it next to the end of the previous tone...

Or am I missing something?

Damien
Damienb
 
Posts: 63
Joined: Sat Mar 30, 2013 7:00 am

Re: How to play frequencies in a row

Permanent link to this post Posted by Robert J. H. » Sun Apr 07, 2013 12:30 am

For the Nyquist Prompt, it could look like this
Code: Select all
(defun gather (score)
  (cond ((null score) (s-rest 0))
        (t (seq (abs-env (seq (osc (hz-to-step (car score))
                              (cadr score))
                         (s-rest (caddr score))))
                (gather (nthcdr 3 score))))))
; Format: <freq (Hz)> <duration (s)> <silence (s)>
(setf score
 '(440 0.5 0.2
   660 1 0.3
   253 0.2 0.1
   487 1 0.125))
(multichan-expand 'gather score)

You can enter the notes in the score list (Format as shown in the example)
It's a Little difficult to implement this in a plug-in, because many values Change and their number is theoretically not limited.
The best way may be a single TextBox where the triple pair can be entered - or three of them with Frequency, Duration and Gap.
Tell us what you Need - or let your students Experiment further...
Robert J. H.
 
Posts: 434
Joined: Thu May 31, 2012 8:33 am

Re: How to play frequencies in a row

Permanent link to this post Posted by PhilN » Sun Apr 07, 2013 1:23 pm

Both of your anwers are very helpful to me! Thank you!

-> Damien: Your method could be interesting but when I generate a new tone, howcome it doesn't appear in a new track but overrides the old one?!

->Robert J. H., your solution looks like THE good solution!
But as it is the first time I hear about Nyquist files, I'm not sure to use it properly:
I copied the code below in a file named freqs.ny located in plug-ins folder. Then, I tried to open it with File/Import/Raw data... but it doesn't seem to be the right method... :?
Code: Select all
(defun gather (score)
  (cond ((null score) (s-rest 0))
        (t (seq (abs-env (seq (osc (hz-to-step (car score))
                              (cadr score))
                         (s-rest (caddr score))))
                (gather (nthcdr 3 score))))))
; Format: <freq (Hz)> <duration (s)> <silence (s)>
(setf score
 '(440 0.5 0.2
   660 1 0.3
   253 0.2 0.1
   487 1 0.125))
(multichan-expand 'gather score)

Thanks for your help!
PhilN
 
Posts: 3
Joined: Sat Apr 06, 2013 8:04 pm

Re: How to play frequencies in a row

Permanent link to this post Posted by steve » Sun Apr 07, 2013 2:42 pm

PhilN wrote:-> Damien: Your method could be interesting but when I generate a new tone, howcome it doesn't appear in a new track but overrides the old one?

If there is a track selection, the generated tone will overwrite the selection.
If there is no selection, "Generate > Tone" will create a new track.

For just doing a one-off with a few tones, the easiest way is to make a selection where you want the new tone to be and generate the tone:

firsttrack000.png
Selection in empty part of the track
firsttrack000.png (6.65 KiB) Viewed 72 times


firsttrack001.png
Tone generated into the selection
firsttrack001.png (6.76 KiB) Viewed 72 times



PhilN wrote:->Robert J. H., your solution looks like THE good solution!
But as it is the first time I hear about Nyquist files, I'm not sure to use it properly:

Select an empty track then call up the "Nyquist Prompt" effect (Effect menu) and copy and paste Robert's code into the Nyquist Prompt effect.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Senior Forum Staff
 
Posts: 28591
Joined: Sat Dec 01, 2007 11:43 am

Re: How to play frequencies in a row

Permanent link to this post Posted by Robert J. H. » Sun Apr 07, 2013 3:17 pm

Sorry, I Forget sometimes that not all users are familiar with the Nyquist prompt.
It is a simple Interpreter for the LISP Derivate language Nyquist.
It is fairly easy and can handle almost every Audio Problem, although it is rather intended for Sound Synthesis.
The prompt is the test Portal for code that is eventually realised as a plug-in.
I have hundreds of such snippets which I've collected and placed in a normal Excel worksheet to reuse them in case of Need.
That the snippets are nowhere saved is the greatest drawback of the Nyquist prompt. Therefore it is good that you have saved the code in a text file.
To use it, just copy the text into the Nyquist Prompt (in the effect menu) and press ok.
The text will be still available in the next call (where you can Change the values for example).
However, the code is not saved over sessions.
For this reason, I've proposed to put it inside a formal plug-in.
Robert J. H.
 
Posts: 434
Joined: Thu May 31, 2012 8:33 am

Re: How to play frequencies in a row

Permanent link to this post Posted by PhilN » Sun Apr 07, 2013 8:23 pm

Thank you so much for your quick answers and explanations!
At last, I succeded to play frequencies in a row with both Damien's and Robert's methods!

I will first let my students calculate in a spreadsheet the frequencies of every single note using the formula fn=fo*2^(n/12).
Then I will ask them to play an easy melody using Audacity with one of the methods I just learned :)
PhilN
 
Posts: 3
Joined: Sat Apr 06, 2013 8:04 pm

Re: How to play frequencies in a row

Permanent link to this post Posted by Damienb » Mon Apr 08, 2013 7:10 am

Then report back with a demo!

:geek:

Damien
Damienb
 
Posts: 63
Joined: Sat Mar 30, 2013 7:00 am


Return to Windows



Who is online

Users browsing this forum: Edward Hoge, PhilN, waxcylinder and 6 guests