An implantable closed-loop neuromodulation device, comprising: one or more curved members (302, 304, 306, 308, 310) extending from a body, the curved members configured to at least partially circumscribe a nerve, wherein the curved members comprise one or more electrode pads; the body comprising: an ultrasonic transducer configured to receive ultrasonic waves and convert energy from the ultrasonic waves into an electrical energy; a non-transitory memory that stores one or more template detection signals or one or more template pulses; and a computational circuit electrically connected to the one or more electrode pads, configured to: receive a detection signal based on a detected electrophysiological signal, generate a stimulation signal based on the detection signal, characterised in that generating the stimulation signal based on the detection signal comprises analyzing the detection signal, retrieving a template pulse from the non-transitory memory based on the analyzed detection signal, wherein deviation from a baseline detection signal or comparison to a template detection signal determines which template pulse is retrieved, and generating the stimulation signal based on the retrieved template pulse; and operate the one or more electrode pads of the one or more curved members (302, 304, 306, 308, 310) to emit an electrical pulse to the nerve based on the stimulation signal. one or more curved members (302, 304, 306, 308, 310) extending from a body, the curved members configured to at least partially circumscribe a nerve, wherein the curved members comprise one or more electrode pads; the body comprising: an ultrasonic transducer configured to receive ultrasonic waves and convert energy from the ultrasonic waves into an electrical energy; a non-transitory memory that stores one or more template detection signals or one or more template pulses; and a computational circuit electrically connected to the one or more electrode pads, configured to: receive a detection signal based on a detected electrophysiological signal, generate a stimulation signal based on the detection signal, characterised in that generating the stimulation signal based on the detection signal comprises analyzing the detection signal, retrieving a template pulse from the non-transitory memory based on the analyzed detection signal, wherein deviation from a baseline detection signal or comparison to a template detection signal determines which template pulse is retrieved, and generating the stimulation signal based on the retrieved template pulse; and operate the one or more electrode pads of the one or more curved members (302, 304, 306, 308, 310) to emit an electrical pulse to the nerve based on the stimulation signal. an ultrasonic transducer configured to receive ultrasonic waves and convert energy from the ultrasonic waves into an electrical energy; a non-transitory memory that stores one or more template detection signals or one or more template pulses; and a computational circuit electrically connected to the one or more electrode pads, configured to: receive a detection signal based on a detected electrophysiological signal, generate a stimulation signal based on the detection signal, characterised in that generating the stimulation signal based on the detection signal comprises analyzing the detection signal, retrieving a template pulse from the non-transitory memory based on the analyzed detection signal, wherein deviation from a baseline detection signal or comparison to a template detection signal determines which template pulse is retrieved, and generating the stimulation signal based on the retrieved template pulse; and operate the one or more electrode pads of the one or more curved members (302, 304, 306, 308, 310) to emit an electrical pulse to the nerve based on the stimulation signal. receive a detection signal based on a detected electrophysiological signal, generate a stimulation signal based on the detection signal, characterised in that generating the stimulation signal based on the detection signal comprises analyzing the detection signal, retrieving a template pulse from the non-transitory memory based on the analyzed detection signal, wherein deviation from a baseline detection signal or comparison to a template detection signal determines which template pulse is retrieved, and generating the stimulation signal based on the retrieved template pulse; and operate the one or more electrode pads of the one or more curved members (302, 304, 306, 308, 310) to emit an electrical pulse to the nerve based on the stimulation signal.