Edmhs
Edmhs

Reputation: 3731

Generate tones of specific frequency on mac command line

I need to generate musical notes of a given frequency on the command line

Here is a list of the frequencies of notes http://www.phy.mtu.edu/~suits/notefreqs.html

For example:

$ some-app -frequency 523.25 -timeinseconds 3

It can be native mac, python or ruby tool. The fewer libraries I need to install then better. Maybe i can do something with mac: say or afplay?

This will be used for other project that will send music notes, and I want to hear it while working with it.

Upvotes: 11

Views: 7499

Answers (3)

John Mee
John Mee

Reputation: 52323

$ say "do ray me fa so la te do"

lols.

Upvotes: 5

arbovm
arbovm

Reputation: 424

SoX works really good for this purpose and it's available in brew:

$ brew install sox
$ play -n synth 3 sin 523.25

You can also save the sound to a file:

$ play -n out.wav synth 3 sin 523.25

Upvotes: 18

Rob Cowie
Rob Cowie

Reputation: 22619

It's simple, old and unmaintained but take a look at https://github.com/psycotica0/tone-generator

$ brew install sdl
$ git clone https://github.com/psycotica0/tone-generator.git
$ cd tone-generator && make
$ ./generator 2600 2

Upvotes: 9

Related Questions