signal-processing

Resampling WasapiLoopbackCapture

非 Y 不嫁゛ 提交于 2021-01-28 19:27:22
问题 I'm trying to resample the WasapiLoopbackCapture's output from my soundcards 44100Hz, 16bit, 2 channel waveformat to a 16000Hz, 16bit, 1 channel format for later use in a System.Net.Sockets.NetworkStream (I want to write the converted bytes to the network stream) But I have no idea how to start even! I'm really new to signal processing and I've tried searching for tutorials but I just can't wrap my head around how to do this. Here's what I got so far: void StartRecording() { capture = new

DTMF detection from a wav file

孤人 提交于 2021-01-28 05:40:39
问题 I'm an engineering student and I have to solve an academic problem regarding signal processing. Basically, given an DTMF signal in wav format, I have to identify the number sequence it has encoded. I must do so using discrete fourier transform analysis in Matlab environment, to build a script that reads the wav file and through the process identifies the numbers in the dial tone. I'm having trouble in the sense that I'm not really confortable with the Matlab environment and the whole discrete

Calculating SNR using PSD of captured signal and noise

天大地大妈咪最大 提交于 2021-01-28 01:53:46
问题 I have captured both a transmitted signal and when there is no transmission (i.e. noise only). I would like to calculate the SNR of the signal. I would like to make sure the following GNURadio flowgraph is not wrong: In summary, after the PSD of each is calculated, the "Integrate with Decimate over 2048" block sums up the power over the 2048 FFT bins. Then, the noise FFT sum is subtracted from the signal FFT sum. This is divided by the noise FFT sum and converted to dB. This is the output of

Mixing two16-bit encoded stereo PCM samples causing noise and distortion in the resulting audio

别等时光非礼了梦想. 提交于 2021-01-27 21:35:59
问题 I get two different audio samples from two sources. For microphone sound: audioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, 44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, (AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT)*5)); For Internal sound: audioRecord = new AudioRecord.Builder() .setAudioPlaybackCaptureConfig(config) .setAudioFormat(new AudioFormat.Builder() .setEncoding(AudioFormat.ENCODING_PCM

Which interpolation method to use for resampling speech signal?

与世无争的帅哥 提交于 2021-01-27 14:20:42
问题 I want to do audio signal resampling (converting a signal with fs = 8 kHz to 16 kHz) using MATLAB. There are 3 interpolation methods available : linear, pchip and spline https://in.mathworks.com/help/signal/ref/resample.html#bungoxs Which of them is most suitable for a speech signal and why? 回答1: You probably don't want to use any of these, but rather interpft , which does the upsampling by zero-padding in the frequency domain. This assumes that all the higher frequency signals (above 4 kHz)

Getting the frequencies associated with STFT in Librosa

青春壹個敷衍的年華 提交于 2021-01-27 12:52:14
问题 When using librosa.stft() to calculate a spectrogram, how does one get back the associated frequency values? I am not interested in generating an image as in librosa.display.specshow , but rather I want to have those values in hand. y, sr = librosa.load('../recordings/high_pitch.m4a') stft = librosa.stft(y, n_fft=256, window=sig.windows.hamming) spec = np.abs(stft) spec gives me the 'amplitude' or 'power' of each frequency, but not the frequencies bins themselves. I have seen that there is a

Match length of two Python lists

五迷三道 提交于 2021-01-27 07:27:31
问题 I have two Python lists of different length. One may assume that one of the lists is multiple times larger than the other one. Both lists contain the same physical data but captured with different sample rates. My goal is to downsample the larger signal such that it has exactly as much data points as the smaller one. I came up with the following code which basically does the job but is neither very Pythonic nor capable of handling very large lists in a performant way: import math a = [1,2,3,4

Match length of two Python lists

泄露秘密 提交于 2021-01-27 07:25:39
问题 I have two Python lists of different length. One may assume that one of the lists is multiple times larger than the other one. Both lists contain the same physical data but captured with different sample rates. My goal is to downsample the larger signal such that it has exactly as much data points as the smaller one. I came up with the following code which basically does the job but is neither very Pythonic nor capable of handling very large lists in a performant way: import math a = [1,2,3,4

PyAudio callback function called only once

久未见 提交于 2021-01-07 03:04:56
问题 I'm trying to use PyAudio to simply reproduce a wav file using the non-blocking IO code available here: PyAudio documentation. Differently from the documentation, I'm trying to use numpy input data instead of bytes, so i'm using librosa to load my .wav file instead of wave as shown in the documentation. My code is the following one, it's self contained and reproducible, you just have to change the filename with the one of a wave audio you want to reproduce: import pyaudio import wave import

Sampling rate issue with Librosa

一曲冷凌霜 提交于 2021-01-02 05:58:21
问题 When doing a STFT, and then an inverse STFT (iSTFT) on a 16 bits 44.1 khz audio file with the library Librosa : import librosa y, sr = librosa.load('test.wav', mono=False) y1 = y[0,] S = librosa.core.stft(y1) z1 = librosa.core.istft(S, dtype=y1.dtype) librosa.output.write_wav('test2.wav', z1, sr) the output is only a 22 khz audio file. Why? Where is there the sampling rate change in librosa ? 回答1: The librosa.load() function enables target sampling, wherein the audio file you import can be re