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

20

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"] & /@ {...

16

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

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

16

Yes. The documentation mentions here that it can import ID3v1, ID3v2 and APE tags. The metadata is returned in a nested association. Now to try it on whatever mp3's I have lying around: mymp3 = Import["Mick Maguire.mp3", "MetaInformation"] Keys[mymp3] (* result: {"ID3v2", "ID3v1"} *) This file happens to have both v1 ...

16

Perhaps have a look at DiscreteMarkovProcess using an appropriate transition matrix embedding your constraints? Here's a simple example, implementing 1-5 above, to get you started: transitionMatrix = { {0, 0, 1/2, 0, 1/2, 0, 0}, {6/10, 0, 4/10, 0, 0, 0, 0}, {1/2, 0, 0, 0, 1/2, 0, 0}, {0, 0, 1, 0, 0, 0, 0}, {1/2, 0, 1/2, 0, 0, 0, 0}, {0, 0, ...

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

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

About a year ago,I saw a demo in Labview that can detect the voice of killer whale in a setting of the sound of seawater. I want to try the similar thing in Mathematica. Based upon Vitaliy Kaurov's approach: voice = ExampleData[{"Sound", "Apollo11ReturnSafely"}]; data = voice[[1, 1, 1]]; r = voice[[1, 2]]; cwt = ContinuousWaveletTransform[data, ...

12

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

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.

10

Here's how to "dial" the digits of $\pi$ on a touch tone phone (code adapted and modernized from an old Mathematica demo, but see this as well): touchToneList = Tuples[{{697, 770, 852, 941}, {1209, 1336, 1477}}]; playTouchTone[phonenumber : {__Integer}] := Play[Evaluate[Piecewise[ MapIndexed[{Total[Sin[2 π touchToneList[[#1]] t]], First[#...

10

You can also use SoundAudioToSound[] to convert the Audio[] object to a Sound[] object that can then be passed to EmitSound[]: ExampleData[{"Audio", "Bird"}] // SoundAudioToSound // EmitSound Of course, this is only recommended for modestly-sized Audio[] objects.

10

I believe I'm a heavy user of the neural network framework and the Wolfram Neural Network Repository(WNNR) and these are how I see the WNNR from a user's perspective. Hope it will be helpful. First of all, I think the developers are doing a great job putting together the neural network framework and the WNNR. The framework is well designed and easy to use. ...

10

You can use Manipulate with an IntervalSlider to look at the different harmonics. Clear["Global*"] $Version (* "12.3.1 for Mac OS X x86 (64-bit) (June 19, 2021)" *) EDIT: Some embellishments to the original answer. Manipulate[ Module[{ notes = {"C", "C♯", "D", "D♯", "E", "F&... 9 How about solving the harmonic oscillator equation with a time-varying frequency? w[t_] := 2 Pi (440 + 5 Sin[10 * 2 Pi t]) func = NDSolveValue[{y''[t] + w[t]^2 y[t] == 0, y[0] == 1, y'[0] == 0}, y, {t, 0, 4}]; Play[func[t], {t, 0, 4}] 9 I let Mathematica parse the input into a speakable string, but then I send it to the operating system as if going through the command terminal. This allows me to set the voice flag for my installed voices. mySpeak[input_, voice_String:"Allison", options:OptionsPattern[Speak]]:= CompoundExpression[ Run["say -v " <> voice<>" " <> ... 9 solo = Import[ "ExampleData/rule30.wav" ] Cases[solo, (SampledSoundFunction | SampledSoundList)[__, r_] :> r, Infinity][[1]] 44100 9 You can use Cepstrum,Wiki says It was originally invented for characterizing the seismic echoes resulting from earthquakes and bomb explosions. It has also been used to determine the fundamental frequency of human speech and to analyze radar signal returns. In CepstrumArray: 9 Using Fourier Discrete Transform. Let's start by observing the Fourier content of the beginning of the signal: data = Flatten@ImageData@Import["https://i.stack.imgur.com/qHpp6.png"]; fs = 22050; (* sampling frequency *) data1 = data[[;;20000]]; fourierAbs = Abs[Fourier[data1 - Mean[data1]]]; ListLinePlot[fourierAbs, PlotRange -> {{0, 200}, Full}] ... 8 You can define a periodic function by this simple idiom T = 1; g[x_ /; 0 <= x <= T] := x^2; g[x_] := g[Mod[x, T]] Here, T is the length of the period. What happens is that you restrict your function g to a certain interval and when your argument x falls outside this interval, you just shift it back (using Mod here). With this, you can use g anywhere ... 8 As an alternative, let's let the derivative of the phase vary with time. A fixed tone will have$d \phi / d t = 2 \pi \cdot 440$. A vibrato that you want should have$d \phi / d t = 2 \pi (440 + \sin (2\pi\cdot5\cdot t))$. Integrating: Integrate[440*2 π + 2 π Sin[5*2 π x], {x, 0, t}] (* 880 π t + 2/5 Sin[5 π t]^2 *) Playing: Play[Sin[880 π t + 2/5 Sin[5 ... 8 Important Note: Clyp seems to have changed its API-related policies recently in a way that breaks the routine given below. I do not know how to fix this. I can only guarantee that it was working well at the time it was written. It took a while, but using ideas from Zach's answer here, I was able to cobble something together: ClypExport[snd : (_Sound | ... 8 Here is an answer using Audio and AudioData. dirName = "~/some/dir/name/"; Export[dirName <> "sequence.mid", Sound[SoundNote[#, 1.75, "Trumpet"] & /@ {0, 7, 12}]]; Export[dirName <> "perc.mid", Sound[SoundNote["RideCymbal", #] & /@ {0.26, 0.1, 0.26, 0.1, 2}]]; mid1 = Import[dirName <> "perc.mid"]; mid2 = Import[dirName <... 8 It's not too hard to make your own Beep[] and change the definition. You may have to let Mathematica download the Marimba sound the first time you use it, or whatever sound you'd like to use instead, unless it's already present on your system. mybeep[] := EmitSound[ Sound[{SoundNote["G", .3, "Marimba"], SoundNote["C", .... 7 In general, when you want to share a notebook and a data file, it is easier if you use reference the file from a well defined location that is either: An absolute path that depends on the OS/user such as$HomeDirectory or \$TemporaryDirectory. A directory relative to the directory that the notebook is in (you can move up/down the tree starting from ...

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