frequency

Mathematical analysis of a sound sample (as an array of numbers)

I need to find the frequency of a sample, stored (in vb) as an array of byte. Sample is a sine wave, known frequency, so I can check), but the numbers are a bit odd, and my maths-foo is weak. Full range of values 0-255. 99% of numbers are in range 235 to 245, but there are some outliers down to 0 and 1, and up to 255 in the remaining 1%...

The Most Efficient Way To Find Top K Frequent Words In A Big Word Sequence

The question can be described as: Input: A positive integer K and a big text. The text can actually be viewed as word sequence. So we don't have to worry about how to break down it into word sequence. Output: The most frequent K words in the text. My thinking is like this. 1) use a Hash table to record all words' frequency while trave...

What is the best way to calculate word frequency in VB.NET?

There are some good examples on how to calculate word frequencies in C#, but none of them are comprehensive and I really need one in VB.NET. My current approach is limited to one word per frequency count. What is the best way to change this so that I can get a completely accurate word frequency listing? wordFreq = New Hashtable() Dim ...

Calculate mode (or frequency) distribution of a value over time in SQL Server

Given the following table, how does one calculate the hourly mode, or value with the highest frequency by hour? CREATE TABLE Values ( ValueID int NOT NULL, Value int NOT NULL, LogTime datetime NOT NULL ) So far, I've come up with the following query. SELECT count(*) AS Frequency, DatePart(yy, LogTime) as [Year], DatePart...

How to extract frequency information from an input audio stream (using PortAudio)?

I want to record sound (voice) using PortAudio (PyAudio) and output the corresponding sound wave on the screen. Hopeless as I am, I am unable to extract the frequency information from the audio stream so that I can draw it in Hz/time form. Here's an example code snippet that records and plays recorded audio for five seconds, in case i...

Determining Word Frequency of Specific Terms

Hi, I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine changes and trends. While I have figured out how to determine word frequencies for a given text file, I am dealing with a (relatively, for...

Find frequency of values in an Array or XML (C#)

I have an XML feed (which I don't control) and I am trying to figure out how to detect the volume of certain attribute values within the document. I am also parsing the XML and separating attributes into Arrays (for other functionality) Here is a sample of my XML <items> <item att1="ABC123" att2="uID" /> <item att1="ABC345" att2="uID...

C# Why are timer frequencies extremely off?

Both System.Timers.Timer and System.Threading.Timer fire at intervals that are considerable different from the requested ones. For example: new System.Timers.Timer(1000d / 20); yields a timer that fires 16 times per second, not 20. To be sure that there are no side-effects from too long event handlers, I wrote this little test progra...

Detecting the fundamental frequency

There's this tech-festival in IIT-Bombay, India, where they're having an event called "Artbots" where we're supposed to design artbots with artistic abilities. I had an idea about a musical robot which takes a song as input, detects the notes in the song and plays it back on a piano. I need some method which will help me compute the pitc...

Anti-aliasing: Preferred ways of determing maximum frequency?

I've been reading up a bit on anti-aliasing and it seems to make sense, but there is one thing I'm not too sure of. How exactly do you find the maximum frequency of a signal (in the context of graphics). I realize there's more than one case so I assume there is more than one answer. But first let me state a simple algorithm that I think...

How to generate simple 2D graphics in real time?

For my internship on Brain-Computer Interfacing I need to generate some very fast flickering squares on a CRT monitor (flickering = alternating between two colors). The monitor's refresh rate is 85Hz and we would like this to be the bottleneck, which means that repainting all squares can take at most 1000/85 = 11ms. My language of prefe...

VB.net live frequency detection

Hello, I am looking to be able to do life frequency detection in VB.net. I must say I don't really know where to begin here. I have looked into BASS.net, but that seems to only work with pre-recorded audio. I need to be able to detect the frequency of audio coming in over the line in or mic input in near real-time. Thanks in advance. ...

Requests limit per hour

How to limit requests per hour from one IP like it is in Twitter? For example, I want to provide 100 requests per hour. Is there any solution? Apache modules? Thanks. ...

How to find high frequency words in a book in an environment low on memory?

Recently in a technical interview, I was asked to write a program to find the high frequency words(Words which appear maximum number of times) in a text book. The program should be designed in such a way that, it processes the entire text book with minimum memory. Performance is not a concern. I was able to program to find the frequency ...

Looking for a .txt word frequency list to test a program.

I'd like a file of the 200-1000 or so most frequently used words in the English language. I've been able to find ridiculous lists of 200,000 words or whatever, but nothing with a smaller set of the more frequently used words. Preferably the words would be one per line but if it's not then I can format it. THANKS! ...

Sql server function for displaying word frequency in a column

I have a table that lists a freet text input from a survey where enterents were allowed to enter their responses (regarding colours they would like to have in their wedding) I would like to write a sql function that gathers all the information from this column, and orders counts the frequency of each word, ordering the result set by thi...

item frequency count in python

Hi, I'm a python newbie, so maybe my question is very noob. Assume I have a list of words, and I want to find the number of times each word appears in that list. Obvious way to do this is: words = "apple banana apple strawberry banana lemon" uniques = set(words.split()) freqs = [(item, words.split.count(item)) for item in uniques] print...

Amortizing the calculation of distribution (and percentile), applicable on App Engine?

This is applicable to Google App Engine, but not necessarily constrained for it. On Google App Engine, the database isn't relational, so no aggregate functions (such as sum, average etc) can be implemented. Each row is independent of each other. To calculate sum and average, the app simply has to amortize its calculation by recalculatin...

Python library for playing fixed-frequency sound

Hi, I have a mosquito problem in my house. This wouldn't usually concern a programmers' community; However, I've seen some devices that claim to deter these nasty creatures by playing a 17Khz tone. I would like to do this using my laptop. One method would be creating an MP3 with a a single, fixed-frequency tone (This can easily done by...

Algorithm to determine the effective "phase difference" between two signals with different frequencies?

The quick version: What algorithm could I use to determine the "phase difference" between two square wave signals with different frequencies, if the only information that I have is the time at which each rising edge occurs? The detailed version: I'm working on an embedded software project, and I have run across an interesting proble...