Ticket #11545 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

Scratch activity cannot record audio reliably

Reported by: greenfeld Owned by: saadia
Priority: high Milestone: 1.75-software
Component: scratch-activity Version: Development build as of this date
Keywords: Cc:
Action Needed: no action Verified: no
Deployments affected: Blocked By:
Blocking:

Description

The Scratch activity cannot record audio in 11.3.1 os19. Trying to do so from the Sounds tab results in a failure dialog appearing stating a "Block cannot return".

Scratch can play audio; it just cannot record.

Change History

follow-up: ↓ 3   Changed 3 years ago by saadia

  • next_action changed from diagnose to test in build

I have just checked this on os27, and I am able to record under the Sounds tab in Scratch.

  Changed 3 years ago by greenfeld

  • next_action changed from test in build to diagnose

This used to be a complete failure, but now seems to be a more limited (but still annoying) failure:

Steps to reproduce:

  1. Start Scratch.
  2. Switch to the Sounds tab.
  3. Press the Play button to hear a Meow.
  4. Click the Record button to see a "Block cannot return" message from the Squeak runtime.

in reply to: ↑ 1   Changed 3 years ago by saadia

Replying to saadia:

I have just checked this on os27, and I am able to record under the Sounds tab in Scratch.

My previous comment should be ammended to say that you can record if that it is the first thing you do, without playing a sound first. The bug is manifesting itself under these conditions: Play a sound, then record a sound: the "Block cannot return" message appears.

follow-up: ↓ 5   Changed 3 years ago by saadia

I now have a fix for this problem - so the "Block cannot return" message does not appear. The pcm channel for capture was not opening when the pcm playback channel was already open due to enforcement of rate symmetry. Since the playback had been at the rate of 22050, the system wanted to open the capture channel at this same rate and was not able to. My temporary fix removes the .symmetry = 1 field from the snd_soc_dai_drvr structure in mmp2_i2s.c. I have seen a patch to soc_core.c in the linux 3.0 tree that deals with flawed logic in enforcing symmetric rates. In 3.1 and 3.2 arm trees, the soc_core.c file has totally changed, and symmetric rates don't seem to be enforced.

in reply to: ↑ 4   Changed 3 years ago by saadia

The related commit is b03398a on arm-3.0-wip

  Changed 3 years ago by saadia

  • next_action changed from diagnose to test in build

With this fix in place, I see some difference in recording in Scratch just after starting the activity vs. after playing a sound first, then recording. If the recording is done right after the Activity starts, the mic light goes on after the red record button is pressed on the Recording block under the Sounds tab. If the recording is done after a sound has previously been played, the mic light goes on as soon as the "Record" button next to New Sound in the Sounds tab is pressed (without initiating actual recording with the red record button)

I believe this problem needs to be addressed on the Scratch or Squeak library end, or the specific ALSA controls being used need to be sorted out in this sequence of events.

  Changed 3 years ago by saadia

  • owner set to saadia

  Changed 3 years ago by greenfeld

I built a wip monolithic kernel at 072ad0e to test this fix.

After recording, if I use the playback button in the recorder (and possibly other cases) I do not hear anything. If this problem occurs, playback of the sample sounds in Scratch then fails as well.

When exiting Scratch after this error condition has occurred, the Mic LED may or may not be left on.

It is possible to exit the recorder in a manner in which its recorded sound can be played back, but for me this seems to require not using the playback button in the recorder popup and a bit of luck.

  Changed 2 years ago by greenfeld

  • next_action changed from test in build to diagnose
  • summary changed from Scratch activity cannot record audio to Scratch activity cannot record audio reliably

  Changed 2 years ago by Quozl

Seen in a deployment production build. #11685.

  Changed 2 years ago by saadia

  • next_action changed from diagnose to test in build

Please try commit 594a67b together with 943cd42 and 922f260 for a fix to this problem. You should now be able to play after recording, and the mic light should behave.

  Changed 2 years ago by martin.langhoff

OS30 has the goods.

  Changed 2 years ago by greenfeld

  • status changed from new to closed
  • next_action changed from test in build to no action
  • resolution set to fixed

Audio recording and playback ssems to work properly in Scratch in 11.3.1 os30 on XO-1.75.

Note: See TracTickets for help on using tickets.