Newbie asking for a kickstart, please!

Using Nyquist scripts in Audacity.
Post and download new plug-ins.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

Newbie asking for a kickstart, please!

Permanent link to this post Posted by shakeshuck » Tue Apr 18, 2017 12:50 pm

Sorry guys, I just can't get my head around how to start with this.

All I wish to do (to get me pointed in the right direction), is to average the value of each sequential pair in a wave form.

My guess was something like this:

( / ( + (first s) (first (rest s))) 2)

But I'm not sure if that just does the first two samples, and not the rest?
I tried creating a recursive loop (not knowing if it was needed or not), but just kept running into various errors.

Please can someone give me a hint as to what this should really look like if entered at the Nyquist prompt?
shakeshuck
 
Posts: 15
Joined: Tue Apr 18, 2017 12:36 pm
Operating System: Windows 7

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by shakeshuck » Tue Apr 18, 2017 2:34 pm

Just for clarity, in case I'm using the wrong terminology, when I say 'first two samples' I mean the first two points on the waveform.
shakeshuck
 
Posts: 15
Joined: Tue Apr 18, 2017 12:36 pm
Operating System: Windows 7

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by steve » Tue Apr 18, 2017 2:45 pm

Does this do what you want?
(http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index692)
Code: Select all
;version 4
(snd-avg *track* 2 2 op-average)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44997
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by shakeshuck » Tue Apr 18, 2017 6:27 pm

Thanks, Steve - I think that's what I'm after, although it would be 2 1 in my case.

Trying to run it though doesn't seem to affect anything, and the debug prompt gives me this in the output:

error: bad argument type - #(#<Sound: #6920328> #<Sound: #6920568>)
Function: #<Subr-SND-AVG: #93ac2c8>
Arguments:
#(#<Sound: #6920328> #<Sound: #6920568>)
2
1
1

I do have 2 channels loaded, does that make a difference?
Also, does it matter what the original file type was (I assume once it's imported it's all the same to Audacity)?

Thanks.
shakeshuck
 
Posts: 15
Joined: Tue Apr 18, 2017 12:36 pm
Operating System: Windows 7

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by steve » Tue Apr 18, 2017 8:40 pm

shakeshuck wrote:error: bad argument type - #(#<Sound: #6920328> #<Sound: #6920568>)

That shows a stereo sound.
Stereo sounds are handled as an array of two "sounds".
An "array of two sounds" is NOT a "sound", it's an "array" containing two "sounds".

The function SND-AVG requires a "sound" as the first argument (an "argument" just means one of the 'parameters' that is passed to the function).
Try it with a mono track.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44997
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by shakeshuck » Tue Apr 18, 2017 11:42 pm

Thanks Steve.

Due to your hint, I now have it working in stereo, and it does as expected.

Unfortunately I've also just discovered that although I can import DSF files with ffmpeg, I can't export them. *sigh*
shakeshuck
 
Posts: 15
Joined: Tue Apr 18, 2017 12:36 pm
Operating System: Windows 7

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by Trebor » Wed Apr 19, 2017 12:47 am

shakeshuck wrote:All I wish to do (to get me pointed in the right direction), is to average the value of each sequential pair in a wave form.

Median filter ? Robert J. H made a plugin that does that ... viewtopic.php?p=250740#p250740
Trebor
 
Posts: 3937
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows Vista

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by shakeshuck » Wed Apr 19, 2017 7:21 am

Hi Trebor,

Again, I'm not sure of the terminology, but I would say this averaging creates a variable high-pass filter; the higher the frequency, the more it is removed.
shakeshuck
 
Posts: 15
Joined: Tue Apr 18, 2017 12:36 pm
Operating System: Windows 7

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by steve » Wed Apr 19, 2017 8:59 am

(snd-avg sound 2 1 op-average) gives a 'rolling average' of each sample with the previous sample, which acts as a low-pass filter where the corner frequency is 1/4 of the sample rate.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44997
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Newbie asking for a kickstart, please!

Permanent link to this post Posted by steve » Wed Apr 19, 2017 9:06 am

Here's the frequency response for a sample rate of 44100 Hz:

spectrum.png
spectrum.png (60.06 KiB) Viewed 1002 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44997
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Next

Return to Nyquist



Who is online

Users browsing this forum: No registered users and 1 guest