2
$\begingroup$

When AudioGenerator is used to generate an Audio object, there may be a discrepancy between the specified (and reported) SampleRate and the actual time difference between the samples. This was observed while using the "Sin" generator, but easier to see using a generator function that returns the time value:

aud = AudioGenerator[Identity, 1/100, SampleRate -> 1000];
1./AudioSampleRate[aud]

(* Quantity[0.001, 1/("Hertz")] *)

First@AudioData@aud

(*  {0., 0.00111111, 0.00222222, 0.00333333, 0.00444444, 
       0.00555556, 0.00666667, 0.00777778, 0.00888889, 0.01} *)

This looks like an off-by-one error, so is probably not noticeable for long Audio objects, but obviously shifts short Audio objects to a lower frequency.

This has been reported to Wolfram support; I will update this post upon reply.

Version 11.2, macOS High Sierra

Update: Problem reproduced by Wolfram support, CASE:3969907.

Update: Fixed in 11.3

$\endgroup$
  • 1
    $\begingroup$ You still need to put a question in there somewhere, since this is a Q&A site... $\endgroup$ – J. M. is away Nov 7 '17 at 21:42
  • $\begingroup$ I prefer to think of is as a site to go to to find an answer to a question, whether or not it is phrased as a question. However, I rephrased the question. $\endgroup$ – Daniel W Nov 7 '17 at 23:01
  • 1
    $\begingroup$ Behavior confirmed by Wolfram support, forwarded to developers. CASE:3969907. Does this mean I can put a "bugs" tag on this? $\endgroup$ – Daniel W Nov 9 '17 at 15:16
  • $\begingroup$ I've put it in for you, but yes, you can do so upon confirmation. You might want to edit your question to mention that case number. $\endgroup$ – J. M. is away Nov 9 '17 at 15:18
1
$\begingroup$

Fixed in 11.3

aud = AudioGenerator[Identity, 1/100, SampleRate -> 1000];
1./AudioSampleRate[aud]

(* Out[ ]= Quantity[0.001, 1/("Hertz")] *)

First@AudioData@aud

(* Out[ ]= {0., 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.