I have two sound samples (.WAV) and I want to find the difference between them. I've read about this subject and I know that I should use FFT to do such a thing.
Unfortunately, I can't find a way to do the actual calculation. I am searching for a PHP library or directions on how to make this calculation with PHP.
I tried googling this question and no related solutions came up.
PHP lib to handle audio files: ffmpeg-php
PHP lib for computing Fast Fourier Transform (FFT): fft
The subject you are looking for might be sound fingerprinting, sometimes done by 2D pattern matching of sets of MFCC vectors computed from the audio data of interest.
There are so many things you have to care of when finding the differences between audio files that writing an own libary for php is hard.
Why don't you use Audacity for audio analysis?
Related
Here, I want to search am image from MySQL by upload an image.
I have tried with hash and rgb and also with hex. But I am not getting the perfect picutres as google.
For e.g. If you find Koala.jpg, then you can see only those photos related to Koala.jpg. But I am getting other photos too with above try.
Is there any suggestions that I can search image from the database by image upload.
Thanks in advance.
Introduction
As I understand your question, how can I search for similar image while I am uploading the image?
Before I dig more in details, I would roughly give a little introduction to the topic.
To be able to search or analysis images in computer, we need to go through some processes and convert the image to a numbers representation. This make it possible to do almost every thing.
There are different similarity search Algorithms, and it is a very heat topic a lot researchers working to improve the techniques and developing better ways.
Depending on your requirement, there are a lot of things involved in it, like how big file is, how fast you expecting the results, is it while the person is upload, how many images should be processed at the time etc.
Google has a lot powerful servers and a lot of machine learning that makes it very smooth to compare images almost with no delays.
IMO you need gather some theoretical information that will help you a lot understanding the process around it.
Some links with information regarding my explanation:
https://en.wikipedia.org/wiki/Reverse_image_search
https://en.wikipedia.org/wiki/Google_Images#Search_by_image
scientific paper http://ai.stanford.edu/~gal/Research/OASIS/
I am pretty sure with a bit more google search you can find a lot of theoretical resources.
Now back to your question,
The following lib/class IMO will solve your problem.
Libpuzzle is a PHP library to find similar picture
(https://www.pureftpd.org/project/libpuzzle)
PHP Compare Images Similarity is also a PHP class
(http://www.phpclasses.org/package/8255-PHP-Compare-two-images-to-find-if-they-are-similar.html)
I will leave some link that might enlighten you as well, that said you have few steps to reach your goal:
Start test one of these libraries and see which one fits you best
Then try to test by uploading and comparing image
Few more links:
Image similarity comparison
Image comparison - fast algorithm
Good way to identify similar images?
Find similar images in (pure) PHP / MySQL
http://nekkidphpprogrammer.blogspot.dk/2014/01/not-all-bits-are-created-equal.html
Algorithm for finding visually similar photos from a database?
Image comparison - fast algorithm
I developed a system that contains many MP3 files that users can listen to them online/stream, since most of my users are Iranians and Iran internet speed is sucks, I came up with an idea, but I can’t find the right/best way to do that.
I have alots of different berates: 128kps, 192kps, 320kps, etc… I would like to know what’s the best way to remotely convert these files to 32/64kps qualitie, and of course, temporarily.
I mean, after the new file 32kbps generated. After period of time the generated file automatically delete.
I did lots of search before I ask this question, but none of the results answered my question.
BTW, I find the LAME library.
Is there a way to do that with pure PHP?
Is there a way to do that with pure PHP?
Nope. Not at all. PHP is a server-side scripting language that depends on add-ons & external functions. That said, there is a SWFMovie::streamMP3 function, but as the page says, “This function is EXPERIMENTAL.”
You are much better off learning about MP3 streaming software like Mopidity which is a Python-based music server. Might also look into Andromeda which appears to be PHP-based. And such. Reinventing the wheel will not be fun at all. You are better off researching how to use Open Source MP3 streaming software as best as possible & adapt it for your needs.
Is there any possibility that I can get the beat rate (beats per minute or beats per second) of an audio file placed on my server, through PHP.
The main scenario is I have some audio file(mp3, wav etc) in some location on my server and I've to categorize them according to their beat rate.
I got this:
http://pear.php.net/reference/MP3_IDv2-0.1.4/__filesource/fsource_MP3_IDv2__MP3_IDv2-0.1.4IDv2FrameTBPM.php.html
Can anyone please explaing how to use the function getBPM()
I wrote a simple php class for BPM detection in audio files. It uses soundtouch and ffmpeg to get the BPM. You can get it here - php-bpm-detect
You could try calling the SoundTouch audio processing library from php after installing it on the server.
The FAQ states that it can detect BPM. I do not know if it can handle mp3 files, but then you could use ffmpeg to convert them to wav and then run the bpm detection.
Please Check the link for more info.
SoundStretch audio processing utility
Beat rate (BPM) can be calculated in many ways. First of all you need to find how to detect beats which are nothing but local peaks of sound energy. Supposing you want to analyse WAV file it would be best to search whole file sample-by-sample and find high differences between consecutive samples. How big differences? It is hard to tell, you will have to try with different values (different detection threshold). MP3 detection is harder because it is also compressed.
Here are some other ideas:
How to detect the BPM of a song in php
BTW: Are you sure you want to use PHP for BPM detection? If you have server you can probably use also other langages, like C/C++ launched as cgi script. It would be much more memory- and cpu-effective.
Good luck with your project!
EDIT: Try to use Google to find different projects, but covering the same topic (wav analysis), e.x. http://www.ixwebhosting.mobi/2011/09/20/3445.html - project that draws oscillogram from WAV file and saves it to PNG. If it draws waveform you are one step ahead-now you have to implement algorithm to not draw sample values but analyse them to find beats.
I am trying to generate simple bar charts to be displayed on a website. I am looking at PHPGraphLib and JpGraph. They seem fairly comparable and with proper configuration they can probably produce nearly identical charts. Is there a reason to choose one over the other? Are there are any real differences between the two? Are there alternatives I may be overlooking?
PHPGraphLib looks to be more light wieght, and not quite as capable as JpGraph. If you just look at the examples and the documentation, you can see how much more JpGraph does. If your goal is to be lightweight and you don't need the extras JpGraph offers, then go with PHPGraphLib. If you want to have a lot of flexibility in the graphs you can generate, go with JpGraph. I have used JpGraph for a ton of things, and its very versatile, and you can figure out how to do anything using the huge number of examples they include with the source.
jpGraph has far more capabilities than PHPGraphLib. On the other hand, PHPGraphLib is a lot easier to install and very fast. In fact, it is the only one that I was able to get to work immediately. It consists of only three files. I am still struggling with jpGraph and some truetype fonts that it cannot find. If PHPGraphLib has enough features for you, by all means, run with it. I wish I could.
Both of them are free for personal use, and a few hundred dollars for unlimited servers. Pretty good deal, and I think the developers deserve getting paid what they charge.
I am looking to generate transport maps in a style similar to the iconic London underground [tube] map.
These maps will change from time to time and many will be required so instead of drawing them up manually in inkscape [or similar] I am hoping to have them generated dynamically from a db or dataset.
Does anyone know if there is any library apis etc. out there that would help with this task, or any suggestions in general of how [or how not] to go about this ?
I am thinking svg's would be the best way to go with this, plus there may be need for basic interactivity down the line.
I am working in php so otherwise it's GDlib, ImageMagick ?
Thanks in advance.
.k
Well, the answer really isnt in how to use GD or ImageMagick, there are manuals for that. As for helper libraries, most libraries focus on graphing, anything else you will have to write yourself. Your best bet as a solution would be to have your admin interface generate the images when data in the backend changes and cache the images, since there's no reason to build the image every time someone accesses it.
For generating maps, i think your best bet would be defining stations with one or many 'lines' which determine some sort of indicator of relationship to the stations around, and an x,y. You'd probably only need to determine a 'parent' station since you're just drawing lines from a-b. That way you can position them in the same manner as they're typically rendered on the actual trains, use the lines and surrounding stations to draw mappings.
Doesn't sound like too difficult a problem. 3 tables:
stations [stationid,name,x,y,meta1,meta2],
placements [placementid,stationid,lineid,parentstationid],
lines [lineid,name,meta1,meta2,colour,etc].
SVG would be pretty good at this sort of thing, and you would avoid the whole image building and caching process, but be wary of browser support issues.
Sounds like a pretty interesting project though, good luck :)
One strategy I use when I need to generate graphs from data in a db is to extract the data in some kind of XML way (e.g. Oracle SQLX or Cocoon XSP/ESQL or eXist-db XQuery) and process it through an XSLT to generate SVG. Good old Cocoon is fine for this kind of job if you don't want to write any code (except the XSL of course ;-).
The SVG itself can be loaded in some graphic tools to reprocess.
These maps will change from time to
time and many will be required so
instead of drawing them up manually in
inkscape [or similar] I am hoping to
have them generated dynamically from a
db or dataset.
If I were in your shoes, the very first thing I'd do is try to prove that the Google Maps API won't work for your application. Then, maybe, prove that ArcGIS won't work. (Even if they don't work, they're widely used, and you get to add lines to your CV.)