signal-processing

Fast Fourier Transform for non log 2

北城以北 提交于 2019-12-04 21:17:07
I want to implement Fast Fourier Transform in Java for chord recognition, but I don't really get it. It says that the number of samples should be a power of 2, so what should we do for a song that doesn't have number of samples equal to a power of 2? Also I would like to know about the STFT. You normally generate an STFT over a sliding window throughout your file. The size of the window is chosen to give a reasonable time period over which the characteristics of the sound do not change greatly. Typically a window might be around 10 ms, so if your sample rate is 44.1kHz for example, then you

How calculate three phase kilowatt hour from time sampled data [closed]

寵の児 提交于 2019-12-04 20:41:57
My problem is I want to calculate three phase power from time sampled data of current and voltages. My questions: How can I calculate the energy (unit kilowatt hour) from time sampled data? Are any equations available? Is it needed to take the phase shift in account? (How can I calculate the phase shift? How do I link this to calculating the three phase power?) Is some better platform is available for solving my question? I get the instantaneous sample value (not continuous). (I have some sensors that gives the current and voltage - I convert this to digital for processing). Around 50 samples

How to generate pulses at 5khz with 0.01s duration and 0.09s delay?

只谈情不闲聊 提交于 2019-12-04 20:07:30
I want to generate a continous pulse in Matlab. I would like to generate the signal at 5khz with a duration of 0.01s, then nothing for 0.09s and then starting again. It's kind of a rectangular pulse, except it's in 5khz. I have the following code to output a waveform for 0.01s at 5khz, function [ output ] = FreqGen( ) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here fs = 44100; T = 0.01; t = 0:(1/fs):T; f = 5000; a = 0.5; output = a*sin(2*pi*f*t); end but I failed to figure out how to use Matlab function pulsetran to generate 0.09s pulses. Just like the plot below

How can I capture audio input from 2 mics of my android phone real time and simultaneously

我的未来我决定 提交于 2019-12-04 19:37:16
I have a requirement where I need audio from both the mics on my android phone simultaneously in order to do some signal processing using Eclipse. Do you think it is possible to do this? Also can you suggest a method to start recording for both mics realtime simultaneously? For two instances of class AudioRecord, if I pass audio source as MIC and CAMCORDER respectively, will I be able to capture two separate mic inputs simultaneously? I am not sure if the mics will work in parallel, and also do not know how to get them to start recording at the same time. Any input regarding this will be

How to uniformly resample a non-uniform signal using SciPy?

人盡茶涼 提交于 2019-12-04 19:15:54
I have an (x, y) signal with non-uniform sample rate in x . (The sample rate is roughly proportional to 1/x). I attempted to uniformly re-sample it using scipy.signal 's resample function. From what I understand from the documentation, I could pass it the following arguments: scipy.resample(array_of_y_values, number_of_sample_points, array_of_x_values) and it would return the array of [[resampled_y_values],[new_sample_points]] I'd expect it to return an uniformly sampled data with a roughly identical form of the original, with the same minimal and maximal x value. But it doesn't: # nu_data = [

Incorrect peak frequency in JTransform

浪尽此生 提交于 2019-12-04 19:00:52
I've trying to calculate peak frequency from android mic buffer as per this How to get frequency from fft result? . Unfortunatly i'm getting wrong values. Even i played a tone in 18Khz,but i'm not getting correct peak frequency. This is my code, int sampleRate=44100,bufferSize=4096; AudioRecord audioRec=new AudioRecord(AudioSource.MIC,sampleRate,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT,bufferSize); audioRec.startRecording(); audioRec.read(bufferByte, 0,bufferSize); for(int i=0;i<bufferByte.length;i++){ bufferDouble2[i]=(double)bufferByte[i]; } //here window techniq

Objective-C Peak Detection Accelerate Framework

筅森魡賤 提交于 2019-12-04 18:37:55
I am a no math guru here, so I want to ask anyone familiar with Digital Signal Processing, what is the best way of detecting real time peaks. I get about 30 frames/values a second and I've tried to implement the slope algorithm for detecting peaks, it worked OK, about 80% of the cases, but its really not good enough :(. From what I've searched one should use the Fast Fourier Transform, but I have no idea how to get started with it, perhaps I'm missing the general idea of how I should use FFT in this case. In iOS we have this amazing Accelerate framework that should help me do the FFT stuff but

How can I generate a sine wave with different frequencies using matlab?

给你一囗甜甜゛ 提交于 2019-12-04 17:43:14
For my project I need to generate a sine wave using matlab which has 100 000 samples and the frequency changes randomly after every 10 000 samples. The sampling rate and the frequencies can be as per convenience. Is there any function in matlab to generate this? ederwander OK another example: to generate 5 randon frequencies :-) %range of possibles frequencies FrequenciesRandon = [200:1:500]; %number of randon frequencies ?? nf = 5; EndSignal=[]; for j = 1 : nf t = [ 0 : 1 : 10000]; % Time Samples f=randsample(FrequenciesRandon,1); % get the randon frequencie Fs = 44100; % Sampling Frequency

2D circular convolution Vs convolution FFT [Matlab/Octave/Python]

好久不见. 提交于 2019-12-04 14:21:42
问题 I am trying to understand the FTT and convolution (cross-correlation) theory and for that reason I have created the following code to understand it. The code is Matlab/Octave, however I could also do it in Python. In 1D: x = [5 6 8 2 5]; y = [6 -1 3 5 1]; x1 = [x zeros(1,4)]; y1 = [y zeros(1,4)]; c1 = ifft(fft(x1).*fft(y1)); c2 = conv(x,y); c1 = 30 31 57 47 87 47 33 27 5 c2 = 30 31 57 47 87 47 33 27 5 In 2D: X=[1 2 3;4 5 6; 7 8 9] y=[-1 1]; conv1 = conv2(x,y) conv1 = 24 53 89 29 21 96 140 197

How to obtain sound envelope using python?

你说的曾经没有我的故事 提交于 2019-12-04 13:53:43
Hello I new with python and also with sound signal analysis. I am trying to get the envelope of a birth song (zebra finch). It has a very rapid signal fluctuations and I tried with different approach. For instance I tried to plot the signal and get the envelope with the following code base on other examples that I found (I added comments on the code to understand it): #Import the libraries from pylab import * import numpy import scipy.signal.signaltools as sigtool import scipy, pylab from scipy.io import wavfile import wave, struct import scipy.signal as signal #Open the txt file and read the