LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-05-2016, 02:49 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Question Need some background information on programming sound/music.


I'm curious, is it possible to use some library or command line tool to get beats per minute, pick out instruments, vocal tracks etc in a song? I listen to a lot of upbeat music and I've noticed certain kinds seem to appeal to me in different ways and I'd like to know how those songs are similar.

Surely some command line tool or scriptable software exists to do this kind of thing?
 
Old 07-05-2016, 08:55 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
In sound studio multiple recorded tracks are mixed together, usually into stereo sound. You want a tool to "unmix" it? I have an exercise for you. Take two cans of different paint. Mix them. Done? Now unmix ...
Well, there is software to filter out sounds of interest from a recording, but this will not unmix the original mix.
 
1 members found this post helpful.
Old 07-05-2016, 09:54 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by Emerson View Post
In sound studio multiple recorded tracks are mixed together, usually into stereo sound. You want a tool to "unmix" it? I have an exercise for you. Take two cans of different paint. Mix them. Done? Now unmix ...
Well, there is software to filter out sounds of interest from a recording, but this will not unmix the original mix.
Not necessarily unmix them, but the filtering thing sounds accurate. Like I'd love to know how it gets bassy in the song, beats per minute, how many different patterns are in the song etc. Could that be done by analyzing the EQ output?
 
Old 07-06-2016, 09:28 AM   #4
crazy-yiuf
Member
 
Registered: Nov 2015
Distribution: Debian Sid
Posts: 119

Rep: Reputation: 51
Google says the BPM think already exists:
https://superuser.com/questions/1290...ware-for-linux

As for detecting the different instruments, well, that's similar to making a computer solve a captcha, when you think about it. Look at files you make in LMMS in audacity, even with computer generated instruments they mix like paint, as Emerson said.
Edit: there actually are claims of software that can do this online as well, but I wouldn't get my hopes up for one that works well, even if you pay for it.

Way back in college I had a homework assignment to make a python program that would generate midi songs from a text file that listed the chords, and then plot it in a graph. That was pretty fun, and easy, so if you're interested in that sort of thing I recommend looking at the source code for some of these projects:
https://wiki.python.org/moin/PythonInMusic

Last edited by crazy-yiuf; 07-06-2016 at 09:34 AM.
 
1 members found this post helpful.
Old 07-07-2016, 02:55 PM   #5
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by crazy-yiuf View Post
Google says the BPM think already exists:
https://superuser.com/questions/1290...ware-for-linux

As for detecting the different instruments, well, that's similar to making a computer solve a captcha, when you think about it. Look at files you make in LMMS in audacity, even with computer generated instruments they mix like paint, as Emerson said.
Edit: there actually are claims of software that can do this online as well, but I wouldn't get my hopes up for one that works well, even if you pay for it.

Way back in college I had a homework assignment to make a python program that would generate midi songs from a text file that listed the chords, and then plot it in a graph. That was pretty fun, and easy, so if you're interested in that sort of thing I recommend looking at the source code for some of these projects:
https://wiki.python.org/moin/PythonInMusic
Wicked! Thank you. Great tips!
 
Old 07-10-2016, 09:16 AM   #6
davezap
LQ Newbie
 
Registered: Apr 2015
Posts: 27

Rep: Reputation: Disabled
Why not pass it through an FFT?

Most of the drum sounds are short and at specific frequencies. Although you would probably have to tune it for each song telling it 'this is a kick drum' then calculate the BPM from that.

This seems to fit what your looking for.
http://stackoverflow.com/questions/6...-a-song-in-php
 
1 members found this post helpful.
Old 07-10-2016, 03:29 PM   #7
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by davezap View Post
Why not pass it through an FFT?

Most of the drum sounds are short and at specific frequencies. Although you would probably have to tune it for each song telling it 'this is a kick drum' then calculate the BPM from that.

This seems to fit what your looking for.
http://stackoverflow.com/questions/6...-a-song-in-php
What is an FFT? Good link. Thanks, I'll add it to my collection.
 
Old 07-10-2016, 03:31 PM   #8
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
FFT = fast fourier transform
 
1 members found this post helpful.
Old 07-10-2016, 03:33 PM   #9
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by notKlaatu View Post
FFT = fast fourier transform
Is that some kind of sound function or filter found in a piece of hardware?
 
Old 07-10-2016, 03:47 PM   #10
davezap
LQ Newbie
 
Registered: Apr 2015
Posts: 27

Rep: Reputation: Disabled
Add to what? Your collection of links?

Time domain frequency analysis with discreet Fourier transform, but mainly the computationally efficient Fast Fourier Transform. They'll beat you over the head with this in second year electronics engineering math, not sure if it's taught in CS courses that are mainly focused on why GOTO is evil, and going insane with threads, and ....

Anyway plenty of C FFT implementations are googleable.
 
1 members found this post helpful.
Old 07-10-2016, 04:13 PM   #11
davezap
LQ Newbie
 
Registered: Apr 2015
Posts: 27

Rep: Reputation: Disabled
Hi wh33t, Sorry if my last post was a little facetious.

As I've been told many times by others - if you want good (relevant) answers then a little background regarding your level of ability would be adventitious to us trying to help. Because we do want to help.

For example I might recommend this text...
https://www.amazon.com/Concrete-Math.../dp/0201558025
... but would have no idea if it's appropriate for you.


The stack exchange link I provided seems to (and I'm no expert in the field) provide some really good tools and libraries.

At any rate (assuming your not wanting to do this in real time) it seems that getting the BPM from a track is par for the course by today's standards. The sound card itself is not going to do much for you as it is generally designed to output audio, I've never seen very good (or any) DSP on the input side. So this means you'll be doing your processing on the CPU.

Complicated time signature changes (that 99% of 'popular' music does not use) are going to be harder to get. If it's a standard 4/4 signature running through the song then it should be simple. But there are many nuances in music that make this hard for a computer.... consider a song that goes from 60 bpm in the verse to 120 bpm in the chorus, how does the computer know what element to look for.. RE: Nyquist sampling theorem

Take this song for example.
https://www.youtube.com/watch?v=bWXazVhlyxQ

Where and what is the chorus? Many of the rhythmic changes are in the guitars rather then the drums... It's all over the place

Last edited by davezap; 07-10-2016 at 04:15 PM.
 
1 members found this post helpful.
Old 07-10-2016, 04:35 PM   #12
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by davezap View Post
Hi wh33t, Sorry if my last post was a little facetious.

As I've been told many times by others - if you want good (relevant) answers then a little background regarding your level of ability would be adventitious to us trying to help. Because we do want to help.

For example I might recommend this text...
https://www.amazon.com/Concrete-Math.../dp/0201558025
... but would have no idea if it's appropriate for you.


The stack exchange link I provided seems to (and I'm no expert in the field) provide some really good tools and libraries.

At any rate (assuming your not wanting to do this in real time) it seems that getting the BPM from a track is par for the course by today's standards. The sound card itself is not going to do much for you as it is generally designed to output audio, I've never seen very good (or any) DSP on the input side. So this means you'll be doing your processing on the CPU.

Complicated time signature changes (that 99% of 'popular' music does not use) are going to be harder to get. If it's a standard 4/4 signature running through the song then it should be simple. But there are many nuances in music that make this hard for a computer.... consider a song that goes from 60 bpm in the verse to 120 bpm in the chorus, how does the computer know what element to look for.. RE: Nyquist sampling theorem

Take this song for example.
https://www.youtube.com/watch?v=bWXazVhlyxQ

Where and what is the chorus? Many of the rhythmic changes are in the guitars rather then the drums... It's all over the place
That's such a dope song. Love me some Rage.

Mostly this music is just what I use to work out to (I break dance and nunchuk for fitness, used to be a teacher of it, now I'm old and just want to stay in shape and enjoy the passion) while my nerd career takes off. Most of the dancey music I'm listening to is the typical "rock'n'roll" 4/4 timing. My preferred style of dance tends to benefit from highly repetitive rhythms in order to make it predictable. I feel like because this kind of music is so simple (perhaps I'm being ignorant here) it should be fairly straight forward to create some kind of random groovy beat generator. I've got a few music friends who studied music in university and they seem to think if I had a bunch of sound files (specifically drum sounds) this shouldn't be too difficult.

My knowledge of Math stopped somewhere in high school shortly after learning about Quadratics. I'm not a Math pro at all, but I have written many thousands of lines of C-syntax like scripts. So I'm thinking Python might be a good place to start.

Edit: Here's an example of the kind of music that inspires me to groove, https://www.youtube.com/watch?v=OLQchhvnIgo

Last edited by wh33t; 07-10-2016 at 04:38 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
background music in web nawal1991 Programming 6 07-07-2013 05:18 AM
[SOLVED] how to listen to music background hgdcjq Slackware 11 09-04-2012 08:22 PM
anybody know the background music? edenCC General 3 05-15-2007 08:11 PM
Background information on install methods Maarten_Holland Linux - Newbie 3 02-26-2005 04:34 AM
No website Background music using Konqueror bongski55 Slackware 0 07-19-2003 06:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration