# Need advice about a bio-acoustics project using Audacity

**URL:** <https://forum.audacityteam.org/t/need-advice-about-a-bio-acoustics-project-using-audacity/50844>\
**Category:** Adding Features\
**Created:** [November 9, 2018, 11:57am UTC](https://forum.audacityteam.org/t/need-advice-about-a-bio-acoustics-project-using-audacity/50844 "2018-11-09T11:57:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![steve](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://forum.audacityteam.org/u/steve)\
**Post date:** [November 12, 2018, 10:39am UTC](https://forum.audacityteam.org/t/need-advice-about-a-bio-acoustics-project-using-audacity/50844/5 "2018-11-12T10:39:43Z")

</div>

> [@](#):
>
> as i found a python wrapper for it (Vampy)

Ooh, that’s interesting. I presume that you mean this: [VamPy: Vamp Plugins in Python](https://www.vamp-plugins.org/vampy.html)  
I wasn’t aware of that - I’ll have to take a look (when I find time… sigh), then we can share notes 🤓

> [@](#):
>
> My only concern with Nyquist is Lisp, which seem very different from the languages i use

It’s a lovely language once you get used to all of the parentheses (though not as beautiful as Python 😉)

Essential ingredients for Nyquist (LISP) programming:

A text editor that does parentheses matching (preferably one that has some form of LISP syntax highlighting). On Linux I use Scite, and on Windows Notepad++. LISP Syntax highlighting for Nyquist is not 100%, but it is close enough to be useful.

Careful indentation (you should be used to this from using Python). Although LISP does not “require” indentation in the way that Python does, it makes the code MUCH more readable. You should not be relying on counting parentheses to read the code.  
Here’s an example from a plug-in that I wrote recently:

```plaintext
(defun stereo-rms(ar)
  ;;; Stereo RMS is the root mean of all (samples ^ 2) [both channels]
  (let ((left-mean-sq (* (aref ar 0)(aref ar 0)))
        (right-mean-sq (* (aref ar 1)(aref ar 1))))
    (sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))

```

You should be able to see (even without knowing LISP syntax) that:

- This defines a function called “stereo-rms”
- The function takes one argument called “ar” (the name could be more descriptive, but this is my shorthand for an array variable)
- Nyquist is normally written in lower case (Nyquist is NOT case sensitive, but case is preserved in quoted string literals)
- Semicolons (any number) are used for comments
- The LET form in this example has two assignments: “left-mean-sq” and “right-mean-sq”.
- The function returns the result of (sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))

The other thing that you will probably notice is the “s-expressions” (symbolic expression). In this kind of notation, functions are called as:  
**(function-name arguments)**  
so rather than writing **(x + y + z)**, where the function is “ **+** ”, in LISP it is written **(+ x y z)**, and no commas!  
  
  
The example code above “could” have been written as:

```plaintext
(defun stereo-rms(ar)
(let ((left-mean-sq (* (aref ar 0)(aref ar 0)))
(right-mean-sq (* (aref ar 1)(aref ar 1))))
(sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))

```

or (even worse) as

```plaintext
(defun stereo-rms(ar) (let ((left-mean-sq (* (aref ar 0)(aref ar 0))) (right-mean-sq (* (aref ar 1)(aref ar 1)))) (sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))

```

but I hope you agree that the first form is much more readable.

I would highly recommend taking a glance at the links in this post: [Manuals and reference material](https://forum.audacityteam.org/t/manuals-and-reference-material/32817/1)  
Any questions regarding Nyquist may be posted in this forum board: [Nyquist - Audacity Forum](https://forum.audacityteam.org/viewforum.php?f=39)

---

_[View the full topic](https://forum.audacityteam.org/t/need-advice-about-a-bio-acoustics-project-using-audacity/50844)._
