| Summary: | recording audio using audioworklet produces corrupted data | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | jk |
| Component: | Web Audio | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | asi, cdumez, eric.carlson, jer.noble, mkahlau, rychouwei, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Mac (Intel) | ||
| OS: | macOS 12 | ||
|
Description
jk
2022-08-22 08:07:06 PDT
I retested this on: Safari Beta Version 16.1 (17614.2.5, 17614) and Safari Tech Preview Release 154 (Safari 16.0, WebKit 17615.1.6.2) On 16.1 I don't hear the pitch shifting anymore, but the issue with roughly half of the recorded samples being missing is still happening. On Tech Preview both the pitch shift and missing samples are happening. Though I believe the Pitch shift was marked as fixed in TP 153 release notes (https://github.com/WebKit/WebKit/commit/65ae54bdedbb604855de7306576ed9572dd7bfe3) FWIW, another change in these versions is that trying to use an aggregate device created in Audio MIDI Setup fails with "A MediaStreamTrack ended due to a capture failure" while it used to work in previous versions. It also looks like playing something on Spotify desktop client while starting the recording makes it more likely to trigger missing samples issue. I have probably faced the same issue using Safari and Chrome on iOS 15.7.3 on an iPhone 7 Plus. When recording with the built-in microphone using AudioWorklet (and latencyHint "playback") by pushing each sample of each audio block of channel 0 to an array as the audio blocks are coming into the AudioWorkletProcessor.process method, some samples are regularly missing. It's easy to notice if you count numbers, like 1 to 20 (about seconds apart). When playing back the recordings I noticed that every few numbers 1 to 3 numbers are missing or cut off, e.g.: 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, (13), 15, 16, 17, 18, 19 Note: With Safari and Chrome on iOS, the sample rate mentioned in the track settings is 44.100 Hz. However, the sampleRate retrieved from the AudioContext is 48.000 Hz. I wonder why the settings are not the same. The mentioned behavior unfortunately makes AudioWorklet-based recording unusable with Webkit-based browsers. On the other hand, if you record with ScriptProcessorNode, this problem does not occur. Unfortunately, ScriptProcessorNode has been deprecated for some time, and AudioWorklet would be state-of-the-art. On other operating systems like Ubuntu (Chrome, Firefox) and Android (Chrome) I could not reproduce the problem with AudioWorklet. I therefore assume that it is Webkit-specific. Any help highly appreciated. Let me know, if you need more info or another minimal test case. |