Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to write some code that will a. take in sound from my computer's microphone and b. output what frequency (ie. pitch) the sound is. It does not have to be very precise, but has to work. I have spent many hours perusing various fora on this subject and have found that they all ought to be very useful except and would be too if I had more knowledge on the subject. However, I am not a particularly experienced coder and most of the answers I've seen go over my head. I understand that I may have bitten off more than I can chew, considering my novice, but if anyone could give a really down-to-earth easy to understand walkthrough of how I should go about implementing this, I would be verrry appreciative. Please forgive my basic question :).
I was looking to write it in Java but have experience in python and swift as well.
There's a lot of solutions for your problem. If you're good at math, you can look at the definition of a FFT and implement the formula.
However, that job has already be done by other programmers and there are a lot of different libraries that implement the FFT function.
In python, you can use numpy. Or, if you prefer java, you can use that snippet:
http://introcs.cs.princeton.edu/java/97data/FFT.java.html
To read from the microphone, you can use:
https://docs.oracle.com/javase/tutorial/sound/capturing.html
(there's a sample for acquiring audio from microphone here:
Java Sound API - capturing microphone)
So, you just need to use the second code, read the data as 16bits PCM big endian and forward it to the FFT function.
I've been using Processing for a while now and it has a couple of nice audio libraries with FFT support. By default Processing is a java library, so you might want to give it a shot (you can use it in eclipse/netbeans/etc. if the default minimal IDE isn't suitable).
You don't have to use Processing with these libraries though, they are java libraries after all.
Minim has a FFT class with forward() and logAverages()
Beads also has a FFT class and there's a book available that does into more detail on analysis.
Both libraries also offer support for sound input.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a question for you concerning Java. I am basically a Java user and did most of my work with it. However, in the machine learning classes I took in college, we used mostly python with the scikit-learn and numpy packages.
Now I want to do a project where I crawl data from the web, store it in SQL databases, and then do machine learning on this data. Maybe some of you have experience with those things and share some of it? I mean, of course it is possible to do these things with java, but maybe you have had some particular experiences on why I should use something else or what to consider?
I am happy for all your thoughts :-)
Have a great weekend!
It turns out that programming language and database implementation are secondary problems. Think first about the machine learning you want to do. Review the existing packages (in any language) and pick one according to how well it fits the needs of the business problem you are trying to solve. Then work with whatever language is most convenient for that package. You will probably find that no single language is suitable for all parts of the problem; you will end up gluing together Java, Python, R, shell scripts, etc, to make a complete solution, and there's nothing wrong with that. Consider that your job is problem solving instead of programming in a specific language and go from there.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am currently working on a project that involves the use of EEG signals on an android mobile phone.
I am deciding if I should make my own signal processing library for android or not because I can't seem to find any online.
Does anybody know of a library that I can use or would it be easier and faster to make my own?
Thanks
I'm working on a similar project. I am using the NeuroSky MindSet EEG headset and Processing IDE with the Ketai library. I could not get the NeuroSky Android API to work with either of my Android 2.3.4 or 4.0.1 phones. When digging into why it didn't work, I got lost in their API's library and decided it would probably just be easier to read the data myself. I modified the Ketai bluetooth program to read in the raw data, but did it in sort of a haphazard way (no checksum was performed). It's quite a rough hack, but I got the data to draw on the screen and have not worked on it for a couple of weeks. After I comment the code some more, I could put my code up on github - it'd be nice to get some collaboration.
By the way, if you did not intend for this to be for the Processing IDE of processing.org, you're quite lucky. As Arcymag pointed out, the keyword "processing" might trigger a response from people like myself who receive emails for processing.org. In any case, the Processing IDE has an Android mode that allows you to program Android under its IDE. If you want to develop your program in say, the Eclipse IDE, you can export your project and take all of the power of Processing with you as a library. After exporting, your code will be full Java. There are only some minor differences between Java "proper" and how Processing presents Java anyhow (some aesthetic changes). I prefer to work with the power of Processing because I am not actually a "proper" programmer, as my background is in physics, and Processing makes programming a joy. (There are several questions regarding the differences between Java proper and Processing on stackoverflow.)
This is my first post on stackoverflow. I have been looking for a way to give back since this site has saved me countless hours on this project alone. If you feel I deserve an upvote, you'd make one noob very happy. I can do things such as: post more than two hyperlinks and upvote answers.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have some experience in working with java, but many are telling MATLAB will be a better option for doing projects in Artificial Neural Networks. Can anybody give proper suggestions to choose a language, so that i won't struggle in the middle.
I am expecting answers about the merits and demerits of the both MATLAB and java , in terms of my project and the learning curve of both the languages
You won't struggle in the middle wether you choose MATLAB or java to implement a neural network (a perceptron to begin with I guess), but I suggest you do it with the language you have most experienced in (I hope my sentence is grammatically correct, I'm not english native speaker).
With java, you'll have to implement simple matrix computations, but with MATLAB, you'll have to learn a new syntax for everything...
If you have MATLAB available then use that. MATLAB is quite easy to learn and for a neural network you will mostly use matrix operations and perhaps a few control structures like for and if.
I would very much think learning the MATLAB syntax for this is a lot easier than implementing (good) matrix operations in Java.
The hard part about neural networks is getting the math correct, not the implementation.
As a rule of thumb, choose the language you're most proficient with unless you can find a good reason to do otherwise.
Good luck and welcome to Stackoverflow. :)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've used LingPipe, Stanford's NER, RiTa and various sentence similarity libraries for my previous Java projects that focused on text (pre)processing (indexing, xml tagging, topic detection, etc.) of large amounts of English text (around 10,000 documents summing to > 1gb of text). Maybe I'm a bad Java programmer, but I find myself typing a lot of code and using a lot of libraries when I switch to a different corpus. Overall, I feel like there might be a better tool for the job.
I guess my question is, will I benefit from switching to Python and NLTK for information retrieval / language processing? Or are there enough pros and cons to make it very subjective? Is NLTK intuitive enough to be learned quickly?
I'd get my hands dirty, but I won't have access to a personal machine for the next few days.
NLTK is good for natural language processing. I've used it for my data-mining project. You can train your own analyzer. The learning curve is not steep.
NLTK got huge corpus for training of your analyzer. You can also provide your own set of data, for example, a journal which a part-of-speech tagged.
Because python is very good for text processing, you may to give it a try. Plus, it got a online tutorial
Please don't forget to use python 2.x version. Try python 2.6.
NLTK may not be good with python 3.x
If you already understand the basics of NLP, I think NLTK should be pretty easy to pick up. It's got a bunch of documentation, 2 books, and I've written a number of articles & tutorials on streamhacker.com. And if there's anything from the Java packages you don't want to lose, you could theoretically combine it with NLTK using Jython (and perhaps execnet).
You also may want to take a look at the Pattern library.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I would like to implement an interactive evolutionary algorithm for generating music (probably just simple melodies to start with).
I'd like to use JFugue for this. Its website claims that it is well-suited to evolutionary music, but I can't find any evolutionary examples.
I already have a framework to provide the evolutonary machinery. What I am looking for is some simple, working code that demonstrates viable approaches for the musical part (e.g. suitable encodings and evolutionary operators for the evolved tunes).
I have some ideas how it might be achieved, but I'm not particularly knowledgeable about music theory, so to start with I'd like to just reimplement something that is known to work.
So does anybody have, or know of, any freely available code (any language is fine) that demonstrates one or more approaches to evolutionary music?
EDIT: I'm specifically looking for evolutionary code rather than other techniques that could be used for music synthesis.
You probably want to look into Markov Chains - They're probably of more use to you than an evolutionary algorithm to start with, as judging the quality of the output in order to breed the best is going to be a nightmare (subjective and time-consuming), and they're ideal for combining with evolutionary programming.
There's a good introduction to them on Coding Horror. The article explains the concept and demonstrates the remarkable results, the comments mention music a lot more (I was lost for hours in the comments and the sites they linked to). There's some more specific details and further reading on Wikipedia.
Markov chains have an element of probability to them, so this is where you can combine them with evolutionary programming - by evolving a method of choosing alternatives other than the roll of a dice.
So far I've found only this, which is a genetic programming example in C.
Update (January 2010): And this online system, which doesn't have source code but is an example of what can be achieved. I also found Grammidity, which allows for sequences of MIDI events to be evolved from grammars.
Update (July 2011): I've just found some relevant Python code on the MIT Open Courseware site.
There is some research going into using Cellular Automata for generating music. As with all other music generation, it is really a question of mapping rather than generation. You could use pretty much anything as input as long as you define your mapping so that it sound "good" (well I guess interesting is a better word).
Googling "cellular automata music" gives quite a few hits. Another good source for information is the Computer Music Journal if you can get access to their archives.