Jump to content
Sign in to follow this  
Manderigon

Read frequency from song

Recommended Posts

Manderigon

Hello guys!

I would like to read a frequency from song. Second after second and i'd like to convert it to the beep() function.

What i have to do?

Regards, Manderigon.

Share this post


Link to post
Share on other sites
UEZ

I suppose Manderigon wants to convert an audio file to an old style of beep music (old mobiles ringtone style).

Br,

UEZ

  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Manderigon

Exactly, is it possible?

Share this post


Link to post
Share on other sites
UEZ

Everything is possible but I don't know how.

Br,

UEZ

Edited by UEZ
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Melba23

Manderigon,

Take a look at the BASS UDF - I think BASS.DLL can return the frequency of the sound being played, but as I have never used it I cannot be sure. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
jchd

Unless your audio is a monophonic line with notes of "one second" duration (a rare boring case), the output of the FFT will contain much more than one "note". Also identifying a note is harder than you think. An FFT (Fast Fourrier Transform) can provide a near real-time frequency spectrum but when applied to most real-world audio, all you get is a dromedary- or camel- or Nessie- (from Loch Ness) shape with no unique absolute major frequency.

Since beep() is monophonic I don't see a simple computerized way to achieve something pleasant to the ear.

  • Like 1

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Astormooke

@jchd

Do you think possible if he could filter the song down to a certain range of frequencies (higher frequencies in order to remove the droned out bass)... This of course being before the script touches the .mp3 file?

Just an idea

Share this post


Link to post
Share on other sites
TheSaint

Along with jchd, czardas is one of our more musical notaries (nee expert), and he may have a solution for you?

I'll prompt him to have a look at this topic .... just in case he missed it.

Personally, I would just use a program readily available on the net. There is bound to be a freeware one, and it may even include a command-line or otherwise be easy to include in anything you are intending to script ... AutoIt generally being good at automation and interaction with other programs.

EDIT

Another way forward, is the proliferation of Midi files available for just about any tune under the Sun. Possibly you could use something like that, as is, or convert more easily into what you want ... or convert your song to midi and work from that angle.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
jchd
Do you think possible if he could filter the song down to a certain range of frequencies (higher frequencies in order to remove the droned out bass)... This of course being before the script touches the .mp3 file?
I don't believe so in practice. Any voice or instrument has its own complex spectrum for a given pitch, and this spectrum even changes drastically with the pitch. All spectrums from various sources occur concurrently in a song or track and mix together. Listenning to typical track you can by ear differentiate between the singer, the drum, the bass, the other instruments. Separating these by computer is terribly difficult and requires awfully convoluted techniques of signal processing.
 
We can easily make a parallel with identifying 3D objects from a picture or movie. While the human eye-brain has no problem correctly identifying very complex scenes, it takes an incredible computing power to recognize a glass of wine, a bouquet of flowers or a printer in a fixed image or movie sequence.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
TheSaint

@Manderigon - It is indeed quite complex to separate out the layers and thus very difficult to get satisfactory results.

A few years ago, I had a go at converting some of my songs from WAV to MID and I was less than pleased with the results.

I was aiming relatively high though and not for something simple, so that approach may work well enough in your instance?


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
Astormooke

 

I don't believe so in practice. Any voice or instrument has its own complex spectrum for a given pitch, and this spectrum even changes drastically with the pitch. All spectrums from various sources occur concurrently in a song or track and mix together. Listenning to typical track you can by ear differentiate between the singer, the drum, the bass, the other instruments. Separating these by computer is terribly difficult and requires awfully convoluted techniques of signal processing.
 
We can easily make a parallel with identifying 3D objects from a picture or movie. While the human eye-brain has no problem correctly identifying very complex scenes, it takes an incredible computing power to recognize a glass of wine, a bouquet of flowers or a printer in a fixed image or movie sequence.

 

 

Nicely put I realise the ability of the human mind, while at a glance may seem simple, is truely complex in all of its daily functions.

Share this post


Link to post
Share on other sites
czardas

I concur with jchd. Every single note is made up of a multitude of audible frequencies, and separating them is extremely complicated. When two or more instruments are sounding together, the frequencies blend or interfere in a complex pattern. A program like Audacity can take a sample of a set of frequencies and remove them. This technique is used for noise reduction, but it also removes some of the music. You might be able to remove most of the frequencies of a bass drone using it but there will always be some overtone residue left behind (unless the drone is totally synthetic).

With a single line melody it should be possible to analyse the amplitude of certain frequencies and determine the notes played. This will be easier for an instrument like the flute because it produces a clean sound, which is very nearly a sine wave. With an instrument like the saxophone, the sound is made up of a very complex mixture of frequencies. It is still possible to analyse such sounds, but the task becomes more difficult.

Even the best audio analysis tools are unable to accurately separate different instruments from each other. There is no way to determine the difference between frequencies played on one instrument or another. Unless you have the instruments on separate tracks, there is no solution for this (as far as I know). Having said that, all notes produce a unique series of overtones, which should be possible to identify using spectral analysis. Commercial software may exist which can do this - I'm not sure. Analysis of audio spectra has wider application beyond music.

I haven't tried using the BASS UDF function mentioned by Melba23. You may get mixed results. If you have any success at all, you will need to take a sound sample every few miliseconds to get a reasonable degree of accuracy with the rhythm.

Edited by czardas

Share this post


Link to post
Share on other sites
TheSaint

:huh:  @JohnOne - I think you may have responded in the wrong topic.

Your post doesn't make much sense to me :blink: , in the context of the prior ones from almost 18 months ago.

Or maybe a recent post here, that you responded to, has since been deleted. :wacko:

P.S. Unless you are talking Guitar Tab? But even that is stretch for necroposting a vague answer.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
czardas

tab = tablature

Edit : oops didn't read the last line.

Edited by czardas

Share this post


Link to post
Share on other sites
SadBunny

tab = tablature

Edit : oops didn't read the last line.

 

And OP = long gone :)

On-topic: autotune and the like aren't relatively recent inventions and still pretty much only really functional on crystal-clear studio recordings of single instruments for nothing... Anyone looking to do spectrum analysis of these sorts better go learn a whole lot of math and a much, much faster language than AutoIt :) And then earn a lot of money if one actually does find the holy grail of breaking complex musical recordings down into separate instrument tracks. You could get seriously rich off of that :P

Edited by SadBunny
  • Like 1

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
TheSaint

Or it could be the notorious Forum Gremlins. :evil:


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×