signal-processing

Audio input through headphone jack in Android?

烂漫一生 提交于 2019-12-04 10:55:40
问题 I am trying to get audio input through the headphone jack for my final year project. It would be a great help if someone can share some code on how to capture the data. I have been trying but as I am fairly new to android, I couldn't find any API for headphone jack in MediaRecorder.AudioSource... There are only these sources available: http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html 回答1: If you choose e.g. DEFAULT or MIC from MediaRecorder.AudioSource as

How to mix PCM audio sources (Java)?

半世苍凉 提交于 2019-12-04 10:24:26
Here's what I'm working with right now: for (int i = 0, numSamples = soundBytes.length / 2; i < numSamples; i += 2) { // Get the samples. int sample1 = ((soundBytes[i] & 0xFF) << 8) | (soundBytes[i + 1] & 0xFF); // Automatically converts to unsigned int 0...65535 int sample2 = ((outputBytes[i] & 0xFF) << 8) | (outputBytes[i + 1] & 0xFF); // Automatically converts to unsigned int 0...65535 // Normalize for simplicity. float normalizedSample1 = sample1 / 65535.0f; float normalizedSample2 = sample2 / 65535.0f; float normalizedMixedSample = 0.0f; // Apply the algorithm. if (normalizedSample1 < 0

An implementation of the fast Fourier transform (FFT) in C# [closed]

自作多情 提交于 2019-12-04 10:19:00
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Where can I find a free, very quick, and reliable implementation of FFT in C#? That can be used in a product? Or are there any restrictions? torial AForge.net is a free (open-source) library with Fast Fourier Transform support. (See Sources/Imaging/ ComplexImage.cs for usage, Sources/Math/ FourierTransform.cs for implemenation) The guy that did AForge did a fairly good job but it's not commercial

Calculating the blur kernel between 2 images

让人想犯罪 __ 提交于 2019-12-04 10:01:20
问题 Unlike the standard (and more challenging) de-blurring and super resolution scenarios, I have access to both the original (sharp) image G and it's blurred version B . I'm simply looking for the blur kernel h . So because B is taken using a real camera the relation is: B=G*h+N (where * denotes convolution and N is some additive noise) Naturally, this is an over-constrained problem since h is small in size compared to G and B and so every few pixels in the pair of images generate an equation on

Using scipy.signal.spectral.lombscargle for period discovery

孤人 提交于 2019-12-04 09:59:37
The new Scipy v0.11 offers a package for spectral analysis. Unfortunately the documentation is sparse and there aren't many available examples. As a baby example, I'm trying to do period discovery of a sine wave. Unfortunately it predicts a period of 1 instead of the expected 2pi . Any ideas? # imports the numerical array and scientific computing packages import numpy as np import scipy as sp from scipy.signal import spectral # generates 100 evenly spaced points between 1 and 1000 time = np.linspace(1, 1000, 100) # computes the sine value of each of those points mags = np.sin(time) # scales

Why does FFT accelerate the calculation involved in convolution?

坚强是说给别人听的谎言 提交于 2019-12-04 09:56:15
I am seeing a lot of literature in which they say that by using the fft one can reach a faster convolution. I know that one needs to get fft and and then ifft from the results, but I really do not understand why using the fft can make the convolution faster? FFT speeds up convolution for large enough filters, because convolution requires N multiplications (and N-1) additions for each output sample and conversely (2)N^2 operations for a block of N samples. Taking account, that one has to double the block size for FFT processing by adding zeroes, each block requires (2)*(2N)*log(2N) operations

NAudio Algorithm to play a sinewave whose frequency can be changed smoothly in real time [closed]

夙愿已清 提交于 2019-12-04 09:46:28
问题 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 months ago . So far, I have implemented the algorithm found on this blog post with limited success. The concept of my program is to initialize the sinewave, then change the frequency according to the position of the mouse on screen - move the mouse up and the sine wave gets higher and vice versa (essentially a theremin

Compiling FFTW3 for IOS 5.1 on OSX 10.7

若如初见. 提交于 2019-12-04 09:27:11
A similar version of this question has been asked before ( how to compile fftw3 on iOS ) about previous versions of IOS and/or OSX, but I am unable to get fftw3 working on a actual IOS device. (Though it works fine in the simulator using the MacPorts "universal" distribution). If anyone has had any success using fftw3 please let me know how you were able to get it working! I am using OSX 10.7 and am trying specifically to run fftw on an iPad3 with IOS 5.1 installed. Thanks. 来源: https://stackoverflow.com/questions/10695053/compiling-fftw3-for-ios-5-1-on-osx-10-7

Remove unknown DC Offset from a non-periodic discrete time signal

不打扰是莪最后的温柔 提交于 2019-12-04 08:16:28
问题 Is there some process that can determine / remove an unknown DC offset from a non-periodic discrete time signal? The signal in in question has a sample rate of 25Hz and has harmonics of interest between 0.25 and 3 Hz. I have tried using highpass filters mixed results, first I used a 10th order guassian with Fc = 0Hz, this did a good job of removing the offset but it severly attenuated the AC aswell although it did leave the signal shape intact, next I used a 168th order equilripple with a

Programming a Spectrogram using C [closed]

爷,独闯天下 提交于 2019-12-04 08:04:58
I am trying to make an audio spectrogram in C and am thinking about using the BASS library: http://www.un4seen.com . I searched over Google and here, but majority of examples are in C++. If any of you have any experience or resource regarding this, please help; it would be much appreciated. So this is what I want to do: Read from mic input. Sample the data. Apply Short time Fourier transform. Then take the magnitude and plot it at the certain frequency. Something like this: http://upload.wikimedia.org/wikipedia/commons/c/c5/Spectrogram-19thC.png If you can help it would be great. 来源: https:/