# Tag Info

19

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 = ...

19

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 ...

17

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[#]]) ...

16

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]; ...

15

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 ...

13

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 = ...

13

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"];

13

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]], ...

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 ...

11

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 WAF format import/export, as well as this answer on ...

11

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, ...

10

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.

10

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 ...

9

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 ...

7

Here is another possibility based on mouse movements, updated with live histogram, further updated by hashing a combination of the mouse position and AbsoluteTime: DynamicModule[{}, positionlist = {}; list = {}; EventHandler[{Dynamic[ Framed@Graphics[{Red, Line@positionlist, Point@positionlist}, PlotRange -> 2]], ...

7

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 ...

7

The first step is to convert the sounds to one of the supported formats. I recommend WAV or FLAC. Then you can Import it. You'll get an expression of the form Sound[SampledSoundList[{leftChannel, rightChannel}, sampleRate]] where rightChannel and leftChannel are numerical lists of amplitudes. Generally, if you want to hear the sound from just the left ...

6

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}, ...

6

You can simply put the results in a list and apply Sound to the list. An example taken from the docs: Sound[{Play[Sin[1000 t (1 + t^2)], {t, 0, .2}], Play[Sin[500 t (1 + t^3)], {t, 0, .5}]}] You can then export this Sound object.

6

This function is still present in version 8, but it is part of the Audio package. For example, <<Audio` ListWaveform[{{1, 1}, {2, 0.5}}, 440, 1] You can find this information by typing ListWaveform into the documentation browser.

6

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

6

Here's mine: -first create a scale by dividing an octave to some intervals (12 gives you the usual good temperament): microscale[divisions_Integer, baseFreq_: 260.741] := Module[{interval}, interval = 2 π /divisions; Play[#, {t, 0, .4}] & /@ Table[Sin[(2 π + i) baseFreq t], {i, 0, 2 π, interval}] ]; which you can use like so: ...

6

Read in the wave file (use Import). Then use the Fourier[]function. This breaks it into a sum of complex exponentials. You can turn this into a trigonometric series using Euler's formula. Here's a bit more detail. Reading in the .wav file is easy: q = Import[fullFileName]; Now q has two parts: the data in q[[All,1]] and the sampling rate in q[[1,2]] ...

6

It shouldn't be too hard to do some simple sound processing. Take an example file: data = ExampleData[{"Sound" , "Apollo13Problem"}] Get a short sequence of sample values from near the end of the file: soundsamples = data[[1, 1]][[All, 110000 ;; -2000]]; It looks OK: ListLinePlot[{soundsamples[[1]]}] Play it without modifications: ...

6

Here's one way to explore aliasing in audio using a "chirp" signal (thus avoiding the problems of real-time sound generation). A chirp is a sinusoid-like signal with frequency that constantly increases. Using the formula from the Wikipedia page, the chirp can be generated using chirp[t_] := Sin[2 Pi (f0 t + (k/2) t^2)]; which is a sinusoid-like signal ...

6

In Mathematica, you can read in .wav files using Import. Since the data is then a discrete data sequence, you can't take a real calculus-style derivative, but you can take the derivative numerically, for instance, using functions like Differences and DerivativeFilter (thanks Jens). In fact, the derivative operation is a kind of high-pass filter, which will ...

5

Let's take an example of WAV sound data: data=Import[ "ExampleData/rule30.wav"] You can see sampling rate 44100 Hz and duration 1.8 s of your sample. This function extracts data for a specific time duration: TakeSound[d_, s_, e_] := {d[[1, 1, 1, Round[44100 s] ;; Round[44100 e]]]} And this app allows you to cut and play sub-samples of your data: ...

5

This is one way to control the sound emission. Import a short .WAV file: sound = Import[ "ExampleData/rule30.wav" ] Now make sound only when your animation control reaches some value - k=0 or k=1 in this case: Animate[If[k == 0 || k == 1, EmitSound[sound]]; Plot[k*x^2, {x, -2, 2}, PlotRange -> {{-2, 2}, {-10, 10}}], {k, -2, 2, 0.1, AnimationRate ...

5

Here is a letter I got regarding this question from premier service technical support: Thank you for taking the time to send this in. Unfortunately, I do not believe this functionality currently exists in Mathematica and I have forwarded the suggestion that it be included in a future release of Mathematica to the developers in charge of this area. ...

5

Is this satisfactory? EventHandler[ Framed@"Play flute", {"MouseEntered" :> EmitSound[Sound@SoundNote["C", 10*^10, "Flute"]], "MouseExited" :> EmitSound[Sound@SoundNote[SoundVolume -> 0]] }]

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