sampling

Digital audio formating

天大地大妈咪最大 提交于 2019-12-11 07:59:07
问题 I have a vectorized wav file with values between -1 and 1, 88,200 samples, 44.1 kHz sampling rate to hear the audio within two seconds. I'd like to send the audio through bluetooth to a bluetooth module, arduino, DAC, and 3.5mm breakout board with earbuds. I am getting crackly audio when I receive it at the end. I tried to recreate this is MATLAB and it turns out to be a combination of the scaling (multiplying + shifting the values over 0) and the sampling rate change due to the receivers. Of

How to precisely sample data with frequency of 60Hz?

£可爱£侵袭症+ 提交于 2019-12-11 04:13:35
问题 Actually, I use the InvokeRepeating method to invoke another method every 1/x seconds. The problem is that the precision of the delay between the invoke and the data I got is not good. How I can precisely sample transform.position with a frequency of 60Hz. Here's my code: public class Recorder : MonoBehaviour { public float samplingRate = 60f; // sample rate in Hz public string outputFilePath; private StreamWriter _sw; private List<Data> dataList = new List<Data>(); public void OnEnable() {

Simulate samples from a joint cumulative distribution function?

限于喜欢 提交于 2019-12-11 02:25:59
问题 I have a joint density function for two independent variables X and Y. And I now want to sample new x,y from this distribution. What I believe I have to do is to find the joint cumulative distribution and then somehow sample from it. I kinda know how to do this in 1D, but I find it really hard to understand how to do it in 2D. I also used the matlab function cumtrapz to find the cumulative distribution function for the above pdf. Just to be clear, what i want to do is to sample random values

Need help about sound processing

浪子不回头ぞ 提交于 2019-12-11 01:51:29
问题 How to get the sample data from stereo sound file (.mp3) and push them into the buffer? Is there any specific library with that function? Sorry if the question is really noob, I'm very new to audio programming. Thanks in advance =) 回答1: "The only way you can play an MP3 file via direct Android API is MediaPlayer which is heavyweight, slow and presents only high-level API. If you need to mix or modify audio streams or manage them with low latency, you are on your own." (Via: http:/

What is the fastest method of sampling random values from a Gaussian distribution?

扶醉桌前 提交于 2019-12-10 21:42:24
问题 The Box-Muller transform, is an elegant and reasonably performant method of sampling random values from a Gaussian distribution. I'm looking for a faster method clearly written and in C#. For reference here's an implementation of the Box-Muller Implementation to act as a baseline for performance comparisons... public class GaussianGenerator { FastRandom _rng = new FastRandom(); double? _spareValue = null; /// <summary> /// Get the next sample point from the gaussian distribution. /// <

Stratified sampling on factor

点点圈 提交于 2019-12-10 13:27:55
问题 I have a dataset of 1000 rows with the following structure: device geslacht leeftijd type1 type2 1 mob 0 53 C 3 2 tab 1 64 G 7 3 pc 1 50 G 7 4 tab 0 75 C 3 5 mob 1 54 G 7 6 pc 1 58 H 8 7 pc 1 57 A 1 8 pc 0 68 E 5 9 pc 0 66 G 7 10 mob 0 45 C 3 11 tab 1 77 E 5 12 mob 1 16 A 1 I would like to make a sample of 80 rows, composed of 10 rows with type1 = A, 10 rows with type1 = B, and so on. Is there anyone who can help he? 回答1: Base R solution: do.call(rbind, lapply(split(df, df$type1), function(i)

Randomly sampling unique subsets of an array

浪子不回头ぞ 提交于 2019-12-10 13:23:00
问题 If I have an array: a = [1,2,3] How do I randomly select subsets of the array, such that the elements of each subset are unique? That is, for a the possible subsets would be: [] [1] [2] [3] [1,2] [2,3] [1,2,3] I can't generate all of the possible subsets as the real size of a is very big so there are many, many subsets. At the moment, I am using a 'random walk' idea - for each element of a, I 'flip a coin' and include it if the coin comes up heads - but I am not sure if this actually

Are there any modern Windows PCs that don't have at least one DirectShow capture device in them? [closed]

与世无争的帅哥 提交于 2019-12-10 11:18:59
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I am considering doing something that might seem strange to get a reliable time clock . I have to push buffers to a WiFi connected

Latin hypercube sampling with python

故事扮演 提交于 2019-12-10 04:22:58
问题 I would like to sample a distribution defined by a function in multiple dimensions (2,3,4): f(x, y, ...) = ... The distributions might be ugly, non standard (like a 3D spline on data, sum of gaussians ect.). To this end I would like to uniformly sample the 2..4 dimensional space, and than with an additional random number accept or reject the given point of the space into my sample. Is there a ready to use python lib for this purpose? Is there python lib for generating the points in this 2..4

Random Sample with multiple probabilities in R [duplicate]

陌路散爱 提交于 2019-12-09 23:47:31
问题 This question already has answers here : generate random integers between two values with a given probability using R (2 answers) Closed 6 years ago . I need to get out a sample of subjects from a list to assign them as a Control Group for a study which has to have a similar composition of variables. I am trying to do this in R with the sample function but I don´t know how to specify the differetnt probabilities for each variable. Lets say I have a table with the following headers: ID Name