# Tag Info

41

This is not the full answer but I've solved most of the problems. The hardest one, with sound, remains. Embedded version without music bobthechemist's points Quality is not a problem anymore since here nothing is rasterized. White edges are due to "features" with Texture, I've fixed that using strange VertexTextureCoordinates. I can't handle this song ...

31

A lot depends on your specific data. But if the noise is far from voice in frequency domain there is a simple brute-force trick of cutting off/out "bad" frequencies using wavelets. Let's import some sample recording: voice = ExampleData[{"Sound", "Apollo11ReturnSafely"}] WaveletScalogram is great for visualizing voice versus noise features: cwt = ...

22

Edit: this answer is now structured in two sections. The first deals about creating a candidate RNG from audio data. The second demonstrates some testing I performed on this RNG. Creating the RNG Okay, I'll got at it another way then. I recorded 10 seconds of ambient noise on my MacBook Pro internal speakers. I was possibly in the worst conditions for this:...

21

Here's a possible starting point for a solution. It splits the sample list into chunks and measures the Norm of the sample Differences in each chunk, and then does the FFT on that data. bpmplot[snd_, bpmmax_: 300] := Module[{samples, minfreq, signal, fft}, samples = snd[[1, 1, 1]]; minfreq = snd[[1, 2]]/Length[samples]; signal = (Norm[Differences[#]]) &...

19

When you use a very low sample rate, the signal is represented with very few samples. If you are using a very stupid resampler that creates 48 kHz data by just repeating samples, you get a wave form like the blue one below: A better resampler would create the red wave form. Now, the difference between these two wave forms looks like this: This is ...

18

You want this: data = Import["test.wav", "Data"] This imports the raw data of sample values. For example, on a test file of approximately 10 seconds, stereo at 48000 Hz, data is an array of size 2 × 520192 (from which I can deduce that my recording was actually 10.84 seconds). See the documentation for WAV format import/export, as well as this answer on ...

18

Running Trace[Speak["Hello"]] and Names["*Speak*"] revealed the following possibility: MathLinkCallFrontEnd[CurrentlySpeakingPacket] Using this with a text that is split into a list of shorter strings allows you to interrupt the audio at well-defined points, phrase breaks, say. Here is one way to do it: Clear[interruptibleSpeak]; interruptibleSpeak[...

18

One way to approach this is with "Dynamic Time Warping". First, preprocess your data to get the MFCC coefficients and extract the data from the time series: human = Audio["http://home.ustc.edu.cn/~xiaozh/SE/Audio/human.wav"]; hus = Audio["http://home.ustc.edu.cn/~xiaozh/SE/Audio/hus.wav"]; {humMFCC, husMFCC} = AudioLocalMeasurements[#, "MFCC"] & /@ {...

17

In Mathematica it is easy to turn any time series data into sound. Here are the Boston temperatures for a few decades: data = WeatherData["Boston", "MeanTemperature", {{1970}, {2012}, "Day"}]; DateListLogPlot[data, PlotStyle -> PointSize[0], AspectRatio -> 1/5] To turn it into sound and play it in a Mathematica notebook: ListPlay[data[[All, 2]], ...

16

vid[time_, frame_] := Module[{tag}, Reap[Do[Sow[CurrentImage[], tag]; Pause[frame], {Round[time/frame]}]][[2, 1]]] So, vid[1., 0.001] would return a list of snapshots taken every 0.001 seconds over a second. This opens a dialog that allows you to record sound and returns it as a Sound object SystemDialogInput["RecordSound"];

16

First, import the audio and extract usable data from it: audio = Sound[ SampledSoundList[ Flatten@ImageData@Import["https://i.stack.imgur.com/qHpp6.png"], 22050]] audioDuration = Duration[audio]; audioSampleRate = AudioSampleRate[audio]; data = AudioData[audio][[1]]; Second, use PeakDetect to see which points are peaks (= 1) and which points are ...

15

Here is my quick and dirty attempt based on: Cryptographic Key From Webcam Image. I've used an example image as I don't have a webcam on my desktop but you could simply use CurrentImage to grab the webcam image live if you have one. Update using a webcam image from my laptop image = CurrentImage[]; grayscale = ColorConvert[image, "Grayscale"]; imagedata = ...

15

First let me observe that your coding style makes debugging difficult, I highly recommend breaking giant expressions into manageable pieces. Second, in the code below I have used a different definition for the segments. Your version: $y=(x-x_1)^{curvature}\frac{y_2-y_1}{x_2-x_1}+y_1$ does not give an amplitude of $y_2$ at $x=x_2$ if $curvature\neq1$. I ...

14

What you need is BandpassFilter, which is new in version 9. Assuming your audio is sampled at 22400 Hz, you can do: BandpassFilter[data, {60 π, 180 π}, SampleRate -> 22400] to filter it to between 60-180 Hz.

14

Here is an explicit way to calculate the frequency corresponding to each element of the output of the Fourier command. The frequencies will depend on two values: the sampling interval and the number of points in the data analysis. ssf = RotateRight[Range[-n/2, n/2 - 1]/(n sampInt), n/2]; where n is the number of points analyzed and sampInt is the time ...

14

Just saying SampleRate -> 10000000 does not mean that the hardware is capable of playing samples at that rate. (Most modern devices can do 192 kHz; but it's likely you're running at 48 kHz.) Mathematica or the OS or the sound driver or the hardware will resample the data to something that is supported. Depending on how well the resampling is implemented, ...

14

What (I think) happens is that you use a constant rate of $8000\,\text{Hz}$ on a steady increasing frequency. This leads to interesting effects when the frequency of the function gets bigger than you rate-frequency. This fact can be explored by just using a $\sin$-Function and use a interval which is slightly larger than $\pi$ at example: Show[Plot[Sin[x], ...

13

I'd do something like this. Pause[5]; Speak["Done Pausing for 5 Seconds"]

13

You can see the spectrum of the first note played, (first 40000 points) ListLogLogPlot[ {#, # PeakDetect[#, 5, 10^-2]} &@ Abs@Fourier@music[[1, 1, 1, 1 ;; 40000]] , Joined -> {True, False} , PlotStyle -> {Gray, Red} , Filling -> Axis , PlotRange -> {{100, 1000}, All} , PlotTheme -> "Scientific"] But beware that the scaling is ...

13

Let's first try with a sound sample from MMA examples repository: s = Import["ExampleData/rule30.wav"] A FullForm of s reveals that this object has the structure Sound[SampledSoundList[{listOfSounds},samplesRate]]. From this it looks like to play the sound in reverse we just need to Reverse listOfSounds, which we can do for example like this: s /. ...

13

Import the subject audio: aud = Import["http://home.ustc.edu.cn/~xiaozh/SE/del_silences.wav"] Identify silences: silences = AudioIntervals[aud, #RMSAmplitude < 0.005 &]; Split the Audio object at the identified beginning and ends of the silence: splitAuds = AudioSplit[aud, Flatten[silences]]; Lengthen the silences (by replacing them with silence ...

12

Due to security restrictions some functions such as Import, Uncompress, or OS access functions cannot be used as a part of Demonstrations code, including the Initialization. So a generally great idea by @acl comment about compression will not work on Demonstrations site (but it's really ncie to use otherwise). This is what you get if you try to use ...

12

SystemDialogInput["RecordSound"] will bring up a dialog that let's you record sound. It works both on Windows and Mac in v9, but only on Windows in earlier versions. It doesn't work on Linux. But what if you need to record sound without user interaction, and you want to avoid a modal dialog? The right way is to use some external and documented tool (e.g. ...

12

One can also use Import[] to directly query the *.wav file's sample rate, like so: Import["ExampleData/rule30.wav", "SampleRate"] 44100

11

I feel there may be a few issues here. First, you're using FourierDST, the discrete sine transform. I'm not too familiar with this one, but it looks like you shouldn't confuse it with Fourier. Application of FourierDST as follows: ListLinePlot[ FourierDST[Table[Sin[100 t], {t, 0, 10, 0.02}]][[250 ;; 350]], PlotRange -> All] yields: whereas, with ...

11

You can use CurrentImage and set up a ScheduledTask to capture frames at the desired fps. Something like: frames = {}; fps = 30; task = CreateScheduledTask[frames = {CurrentImage[], frames};, 1/fps]; Then start and stop recording with StartScheduledTask[task]; StopScheduledTask[task]; Note that stopping the task won't turn off the camera on a Mac (don't ...

11

This example in Documentation exactly answers your question. You just need to specify overlapping time intervals. Lets expand your specific case. Below after every second a new instrument will come in and they will all end at the same time. Sound[{SoundNote["C", {0, 4}, "Oboe"], SoundNote["G", {1, 4}, "SynthVoice"], SoundNote["C5", {2, 4}, "...

11

There was a symbol called StartupSound. You could switch it on via the command: SetOptions[$FrontEnd, StartupSound -> True] But according to Wolfram Reference it is no longer available. 11 The following resulted from a lot of spelunking and reading the code of AudioPlay. au = ExampleData[{"Audio", "Bird"}]; AudioInternalsExecute[ AudioInternalsGetAudioManager[ AudioAudioInformation[au, "AudioID"]], "Play" ] AudioPlay does the same thing except it gets the "AudioID" in a different way which appears to fail. There are many other ... 11 An alternative to EvaluationCompletionAction would be to adjust$Post. Try Clear[f]; f[x___] := With[{}, Beep[]; x] $Post=f; Now Beep will also be evaluated once every evaluation. Use$Post=. to stop the beeping.

Only top voted, non community-wiki answers of a minimum length are eligible