How to make sounds in grasshopper?

Hey everyone! I was wondering is it possible to insert some sounds in grasshopper? I’ve made a kettle that has on a lid some pipes that have a determined hight and each height corresponds to a note. How can I make the sound of notes each time I select a certain pipe?

D0= A = 12
RE= B= 6
MI= C= 4

I think Firefly has a simple tone generator component.
You can also use the System.Media.SoundPlayer class to play .wav files.

Here’s a C# component with an internal dictionary of tones. It uses Console.Beep which is a terrible sound generator, but it should work everywhere. (8.6 KB)

1 Like

Thank you Daniel for your help. I’ve installed the plugin but I can’t use it very well. How can I insert the correct sound? The only thing that I founded that can make some sounds is this button but the thing is that it collects the sound from the ambient where I’m in. As example if I am in a room full of people he hears all the sounds.

Thank you David for your help! I was wondering how you decided that E is 250 or D is 250 then it changes in 500. How can i find these values?

These are some of the values you insert near each note
A= ?
B= ?
C= 250
D= 250
F= ?

This is an international standard, I didn’t decide it, I merely copied it. I could have computed the frequencies from first principles (they’re just logarithms after all), but I wasn’t feeling too cerebral and decided to just copy paste some values instead.

Console.Beep only allows for integer frequencies, so I had to round the values. I think the A notes are set to specific integral frequencies, with each octave being an exact doubling of the previous. Then all the other notes in between are logarithmically scaled (at least they have been since Bach’s Wohltemperierte-Klavier, look up \sqrt[12]{2} if you want to know more). Of course some tones have different names while being the same (sharps and flats of notes on either side of the pentatonic intervals).

Hi @DavidRutten
I’d love to use this to notify me when a long script has completed, but how do I use your component?