# How to detect if Sample Recorder is recording?

**URL:** <https://forum.renoise.com/t/how-to-detect-if-sample-recorder-is-recording/60120>\
**Category:** Beginners Lua API Sandbox\
**Created:** [April 2, 2020, 9:02am UTC](https://forum.renoise.com/t/how-to-detect-if-sample-recorder-is-recording/60120 "2020-04-02T09:02:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![esaruoho](https://forum.renoise.com/user_avatar/forum.renoise.com/esaruoho/32/795_2.png) [@esaruoho](https://forum.renoise.com/u/esaruoho)\
**Post date:** [April 2, 2020, 9:02am UTC](https://forum.renoise.com/t/how-to-detect-if-sample-recorder-is-recording/60120/1 "2020-04-02T09:02:31Z")

</div>

Hi, is there some way of detecting if the Sample Recorder is recording or not?

I use Esc for edit mode on/off, but Esc also cancels (!) and hides the sample recorder.

How would I go about detecting that if the Sample Recorder is recording, then either stop recording, or at least don’t hide the sample recorder dialog.

EDIT: what i’m seeing is / are:

```auto

-- Dialog for recording new samples, floating above the main window.
renoise.app().window.sample_record_dialog_is_visible
  -> [boolean]

-- Start a new sample recording when the sample dialog is visible,
-- otherwise stop and finish it.
renoise.song().transport:start_stop_sample_recording()
-- Cancel a currently running sample recording when the sample dialog
-- is visible, otherwise do nothing.
renoise.song().transport:cancel_sample_recording()

```

and that’s it.

> [@How to stop Sample Recorder Dialog from closing on Esc?](https://forum.renoise.com/t/how-to-stop-sample-recorder-dialog-from-closing-on-esc/48661):
>
> Hi, how do I stop Sample Recorder Dialog closing when I press Esc? I can’t seem to find a shortcut in settings that can be changed or something.

> [@API-solution? How to stop Esc from closing Sample Record Dialog?](https://forum.renoise.com/t/api-solution-how-to-stop-esc-from-closing-sample-record-dialog/48660):
>
> Hi, I’m wondering, how could I absolutely, and once and for all, stop Esc from closing the Sample Record Dialog? Do I need to have some sort of GUI window open that relays Esc only to the pattern editor or…?
