## Discuss Scratch

daffy1234
Scratcher
100+ posts

### More powerful microphone blocks

I've suggested this several months ago with some support. Here's a link to the original post. I'm suggesting it again because 1) further research into how it would work has clarified a few things and 2) with Scratch 3.0 right on the horizon, it might be an excellent addition.

What is it

So, long story short, here's the two blocks I propose.

`// Outputs a number between 0 and 1 depending on the loudness of a particular frequency// 440 hz is a standard A note, it would make a nice default(loudness of frequency (440) hz :: sensing)// Outputs a number between 20 and 20000 indicating which frequency is the loudest(loudest frequency :: sensing)`

And potentially these as well

`// Outputs true or false depending on if the frequency is loud enough<hearing (440) hz :: sensing>// All of the following ones are similar to the above, but they are compatible with the "play note ()" block(loudest note :: sensing)(loudness of note () :: sensing)<hearing note () :: sensing>`

The last 4 are doable with just the first two.

Is it possible?

Definitely yes! There's a thing called the fast fourier transform (FFT) that takes in a bunch of audio samples and outputs a list of frequencies. I'm oversimplifying, but it's not much more complicated than that.

I'd be happy to help implement it!

The last post mentioned privacy concerns?

After further consideration, those privacy concerns are negligible! In practice, you couldn't possibly run it fast enough to get anything recognizable. And even if you could, the original FFT also gives you information about the phase of the frequencies. That information is vital to reconstruct the original audio, and it would be thrown out.

Its perfectly safe!

Ok cool, but is it actually useful?

Yes!! And not in an obscure way! Check the original post for a few reasonable examples. One of the examples was controlling a character with your voice. Here's how you could do it!

`when green flag clickedforeverset y to (((((loudest frequency :: sensing) - (200)) / (800)) * (360)) - (180))end`

Simple enough! The math there is to convert the 200hz to 1000hz range into -180 to 180 range. You could then have obstacles come from the side of the screen flappy bird style that you have to avoid by singing!

I'd love to see this added to scratch and I'm sure many people would too.

Last edited by daffy1234 (July 10, 2018 02:10:05)

Scratcher
1000+ posts

### More powerful microphone blocks

20,000 hz? Lower that to like 750 please. Wouldn't something like 20,000 make us deaf forever or even. die of it?
“Outputs a number between 20 and 20000 indicating which frequency is the loudest”

I would be perfectly fine listing all the featured creators going to Vidcon 2019
leapinleopardstar
Scratcher
500+ posts

### More powerful microphone blocks

20,000 hz? Lower that to like 750 please. Wouldn't something like 20,000 make us deaf forever or even. die of it?
“Outputs a number between 20 and 20000 indicating which frequency is the loudest”
These blocks don't output sound.

Anyways, support.

Hiya! I've moved accounts to -Reshiram-.

BEPIS

`<=^•ω•^= :: variables> // This is Boolnyan. She protects my siggy and eats all the evil kumquats.`
ScratchDiogoh
Scratcher
1000+ posts

### More powerful microphone blocks

20,000 hz? Lower that to like 750 please. Wouldn't something like 20,000 make us deaf forever or even. die of it?
“Outputs a number between 20 and 20000 indicating which frequency is the loudest”
Not exactly, if there was this Condition there was a Block Like this:
`set volume to (...) hz :: sound`
But it would be very dangerous
they want a Block that Detects the Volume of a
Human Voice from 20 to 20,000
_________________________________________________________________________________
In addition to this Neutral Support, because the Majority is American and does not know much about it

chexbox
Scratcher
100+ posts

### More powerful microphone blocks

ScratchDiogoh wrote:

20,000 hz? Lower that to like 750 please. Wouldn't something like 20,000 make us deaf forever or even. die of it?
“Outputs a number between 20 and 20000 indicating which frequency is the loudest”
Not exactly, if there was this Condition there was a Block Like this:
`set volume to (...) hz :: sound`
But it would be very dangerous
they want a Block that Detects the Volume of a
Human Voice from 20 to 20,000
Not quite - you cannot set a volume to a frequency. 20 hz is a very low pitch, below what you can hear, and 20,000 hz is at or above the top of what you can hear.
____________________________________________

Support.

Scratcher
1000+ posts

### More powerful microphone blocks

chexbox wrote:

ScratchDiogoh wrote:

20,000 hz? Lower that to like 750 please. Wouldn't something like 20,000 make us deaf forever or even. die of it?
“Outputs a number between 20 and 20000 indicating which frequency is the loudest”
Not exactly, if there was this Condition there was a Block Like this:
`set volume to (...) hz :: sound`
But it would be very dangerous
they want a Block that Detects the Volume of a
Human Voice from 20 to 20,000
Not quite - you cannot set a volume to a frequency. 20 hz is a very low pitch, below what you can hear, and 20,000 hz is at or above the top of what you can hear.
____________________________________________

Support.
Oh sorry, not that type of Hz.

dosits wrote:

People can hear sounds at frequencies from about 20 Hz to 20,000 Hz, though we hear sounds best from 1,000 Hz to 5,000 Hz, where human speech is centered.

I would be perfectly fine listing all the featured creators going to Vidcon 2019
aidenawesome
Scratcher
18 posts

### More powerful microphone blocks

semi support
currently tho only microphone-related block is
`(loudness)`
and it isn't very useful
having
`(loudest note::sensing)(loudness of note ()::sensing)(average loudness::sensing)(quietest note::sensing)(note loudnesses::list)`
is better
I DON'T support frequency-based blocks, because
they would be complicated,
and you could detect if someone is out of tune