FAQ Database Discussion Community


Splitting an audio file in Matlab

matlab,audio,frequency,sampling
I'm trying to split an audio file into 30 millisecond disjoint intervals using Matlab. I have the following code at the moment: clear all close all % load the audio file and get its sampling rate [y, fs] = audioread('JFK_ES156.wav'); for m = 1 : 6000 [t(m), fs] = audioread('JFK_ES156.wav',...

Sampling on factor in R

r,data.frame,sampling
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...

How to Sample Adobe Analytics (Omniture) Data

adobe,sampling,adobe-analytics
I can't find anything on the web about how to sample Adobe Analytics data? I need to integrate Adobe Analytics into a new website with a ton of traffic so the stakeholders want to sample the data to avoid exorbitant server calls. I'm using DTM but not sure if that...

Matching vector values by records in a data frame in R

r,sampling
I have a vector of values r as follows: r<-c(1,3,4,6,7) and a data frame df with 20 records and two columns: id<-c(1,2,3,4,5,6,7,8,9,10,11,12,13,1,4,15,16,17,18,19,20) freq<-c(1,3,2,4,5,6,6,7,8,3,3,1,6,9,9,1,1,4,3,7,7) df<-data.frame(id,freq) Using the r vector I need to extract a sample of records (in the form of a new data frame) from df in a way that...

Using camera shutter to trigger MPU6050 on raspberry pi

raspberry-pi,sampling,i2c,gpio,inertial-navigation
I've connected DSLR to RPi by GPIO; and MPU6050 to RPi using I2C. I'm trying to record the gyro and accelerometer data in a small time window (typically less than 50ms) when I press camera shutter button. My desired sampling rate is somewhere in between 500Hz to 1000Hz. And I...

Sampling distribution using R

r,sampling
I really need helps to figure out: Suppose we are testing H0: µ = 5 against H1: µ < 5 for a normal population with σ = 1. A random sample of size n = 9 is available from this population. The z test is used with α = 0.05....

Ignoring samples in Gibbs sampling

python,sampling,mcmc
import random,math def gibbs(N=50000,thin=1000): x=0 y=0 print "Iter x y" for i in range(N): for j in range(thin): x=random.gammavariate(3,1.0/(y*y+4)) y=random.gauss(1.0/(x+1),1.0/math.sqrt(2*x+2)) print i,x,y gibbs() The above python code is the Gibbs Sampling and the following line confuses me. for j in range(thin): What is the significance of that additional inner loop?...

Sample a random number following a distribution between two values

matlab,random,distribution,gaussian,sampling
I would like to create a gaussian curve between two values (which is the end point of two different calculations). I am aware that i require a bit more background info, but i wish to play with the result. So let us assume what is not known, the values in...

Randomly generate a subset data based on probabilities

r,probability,sampling
This is about the resampling questions. I want to generate a species list fro a random sample of n individuals based on the species probabilities. For example: there are 3 species c("sp.1", "sp.2", "sp.3"),and their abundance is c(1,2,3). I want to how the species list if i randomly pick up...

Matlab audioread doubles instead of singles

matlab,audio,reshape,sampling
I have the following code at the moment: [y,fs] = audioread('some_audio_file.wav'); y is a <8131546 x 2 double>. Why is that? How come the samples are not a 1 x 8131546? Also when I reshape y to get columns of 30 milliseconds I get a <1324 x 6146 double>? Can...

Estimating change of a cyclic boolean variable

time-series,sampling,measurement,probability-theory
We have a boolean variable X which is either true or false and alternates at each time step with a probability p. I.e. if p is 0.2, X would alternate once every 5 time steps on average. We also have a time line and observations of the value of this...

Binomial Sample Size with r [closed]

r,sampling
I would like to know if there is any package and how to use it about sample size calculation for binomial distribution. I have to sample fruits in three fields and I have to count the number of defects. I would like to know how many fruits i have to...

Selection without replacement - by mutating the list

python,algorithm,sampling
I am looking for the efficient function in Python that does sample selection without replacement, but by actually mutating the original list. That is, alternative to this: random.sample(population, k) that removes the elements from the original list as the sample is selected. List can be millions items large, and there...

Matlab Distribution Sampling

matlab,distribution,sampling,random-sample
How can I create a vector x in Matlab that has values between 0.8 and 1.2, randomly sampled from a: 1. Uniform 2. Normal distribution? There are a lot of functions dealing with distributions, but I'm having trouble using them properly....

Android: startRecording() called on an uninitialized AudioRecord when SAMPLERATE set to 44100

java,android,sampling,audiorecord
I get an error, when I set the sampling rate to 44100 for the AudioRecord object. When it's 22050 it works fine. 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/AudioRecord﹕ frameCount 1024 < minFrameCount 1792 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/AudioRecord-JNI﹕ Error creating AudioRecord instance: initialization check failed. 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/android.media.AudioRecord﹕ Error code -20 when...

matplotlib argrelmax doesn't find all maxes

python,scipy,sampling
I have a project where I'm sampling analog data and attempting to analyze with matplotlib. Currently, my analog data source is a potentiometer hooked up to a microcontroller, but that's not really relevant to the issue. Here's my code arrayFront = RunningMean(array(dataFront), 15) arrayRear = RunningMean(array(dataRear), 15) x = linspace(0,...