Fast intensity adaptation enhances the encoding of sound in Drosophila

To faithfully encode complex stimuli, sensory neurons should correct, via adaptation, for stimulus properties that corrupt pattern recognition. Here we investigate sound intensity adaptation in the Drosophila auditory system, which is largely devoted to processing courtship song. Mechanosensory neurons (JONs) in the antenna are sensitive not only to sound-induced antennal vibrations, but also to wind or gravity, which affect the antenna’s mean position. Song pattern recognition, therefore, requires adaptation to antennal position (stimulus mean) in addition to sound intensity (stimulus variance). We discover fast variance adaptation in Drosophila JONs, which corrects for background noise over the behaviorally relevant intensity range. We determine where mean and variance adaptation arises and how they interact. A computational model explains our results using a sequence of subtractive and divisive adaptation modules, interleaved by rectification. These results lay the foundation for identifying the molecular and biophysical implementation of adaptation to the statistics of natural sensory stimuli.


Introduction
We first examined neural responses to band-limited Gaussian white noise stimuli (termed "noise" from 10 here on) of fluctuating intensities. Since recording intracellularly from individual JONs with patch 11 electrodes interferes with the natural movement of the antenna and with mechanotransduction 12 ( Supplementary Fig. 1a), we first probed for variance adaptation by recording population activity 13 extracellularly from the antennal nerve (Fig. 1a). The compound-action potential (CAP) reflects the bulk 14 spiking activity of sound-responsive JONs with sub-millisecond resolution ( Supplementary Fig. 1b) 11,24 , 15 and recordings are stable over hours. We presented a noise stimulus at intensities ranging from 0.25 to 2 16 mm s -1 , with switches in intensity every 100 ms (Fig. 1b). Sound intensity is measured as particle velocity 17 in mm s -1 , since in the near field, bulk air movement, not changes in sound pressure, induce vibrations of 18 the receiver (for Drosophila courtship, communication distance is much less than the wavelength of 19 sound). The chosen intensity range corresponds to that which females naturally hear during courtship 17 . 20 Noise exhibits a richly-patterned fine structure that evokes reproducible, temporally structured responses 21 in the JONs and has been shown to reduce desynchronization in other systems 25 (Supplementary Fig. 22 1b, 2a). 23 24 We found that CAP responses exhibit transients at each switch in noise intensity: decreases in intensity 25 produce negative transients while increases in intensity produce positive transients (Fig. 1c). After a few 26 milliseconds, the responses settle to a steady-state that is relatively independent of sound intensity 27 suggesting the presence of variance adaptation. To quantify these dynamic changes in sensitivity, we 28 compared CAP amplitudes at the onset of an intensity switch and at steady-statewe did this for all 29 intensity steps tested and for different instantiations of the white noise stimulus (see Methods for details). 30 The resulting tuning curves reveal that the CAP amplitude strongly scales with step-size at the time of a 31 switch but is nearly intensity-invariant at steady-state (Fig. 1d). Adaptation is fast, on the order of 5 to 20 32 ms, and its speed depends on the size of the intensity step, with positive steps producing the fastest and 33 negative steps producing the slowest transients (Fig. 1e). Adaptation dynamics are asymmetrical likely 34 because the amplitude of negative transients is limited from below since CAP amplitudes and the firing 35 rates they represent can't decrease to below 0Hz. 6 1 Since our extracellular recordings represent JON population activity, we ran several control experiments 2 to determine that adaptive CAP dynamics specifically reflect adaptation of the firing rate within sound- 3 sensitive JO-AB neurons. First, we recorded the CAP in flies carrying the iav 1 mutation, which disrupts 4 mechanotransduction and spiking in all JONs, and then rescued iav either in all JON, type AB or type B 5 JONs 19,26 (Supplementary Fig. 1d). The adaptation dynamics in these rescues are virtually 6 indistinguishable from those of wild type flies (Fig. 1f, Supplementary 1e), suggesting the recorded CAP 7 is dominated by activity from type AB JONs and that adaptation is a property of this subpopulation. This 8 result is consistent with previous reports that show that the activity of type AB JONs, but not of type CE 9 JONs, is visible in the CAP for the frequency and intensity range of stimuli used in our study 11,21,24 . 10 Second, extracellular signals, such as cortical LFPs, can be sensitive to the synchrony among neurons in 11 the population 27 . The noise stimuli we used should avoid desynchronization 25 , as can be shown using a 12 simple model of a population of leaky integrate and fire (LIF) neurons ( Supplementary Fig. 2). Only 13 adding a positive offset to the stimulus would drive LIF neurons in a way that induces desynchronization, 14 but this alone is not sufficient to produce transient changes in synchrony upon steps in noise intensity 15 ( Supplementary Fig. 3), further supporting the idea that desynchronization does not explain the CAP 16 dynamics. Finally, we recorded calcium signals via GCaMP6f 28 from type A and B JON projections into 17 the AMMC (Supplementary Fig. 4a). Ca responses disappear when blocking JON spiking through bath 18 application of TTX ( Supplementary Fig. 4b), indicating that they represent the spiking activity of JONs. 19 While the temporal resolution of GCaMP6f is impoverished compared with the CAP, calcium signals are 20 not known to be sensitive to fine-scale neuronal synchrony and thus these recordings provide a more 21 direct, albeit slow, readout of JON spiking. The calcium responses of both type A and B JONs for noise 22 stimuli confirm the results obtained from CAP recordings ( Supplementary Fig. 4c, d): responses saturate 23 in the range of intensities tested (see also 16 ) and exhibit both positive and negative transients 24 immediately after steps. While adaptation appears to be weaker than that measured with the CAP likely 25 due to the slow dynamics of the calcium indicator ( Supplementary Fig. 4e), it is present nonetheless. 26 27 We also built simple, proof-of-principle models to demonstrate that alternative explanations of the 28 adaptation dynamics in the CAP based on response heterogeneitydifferences in frequency or intensity 29 tuningwithin type AB JONs are inconsistent with our data, in particular with the negative transients 30 observed for negative steps in intensity (see Supplementary Fig. 5, 6 for details). Nonetheless, in the 31 absence of recordings from individual type AB JONs, these models cannot rule out a contribution of 32 desynchronization, intensity range fractionation, or other forms of response heterogeneity to our 33 observation of variance adaptation. However, our models show that doing so will require auxiliary 34 assumptions, and that changes in firing rate within individual type AB JONs is a more parsimonious 35 explanation of all of our data. 7 1 The above experiments and analyses provide strong evidence that type AB JONs adapt their firing rates 2 to changes in sound intensity (variance), but by what arithmetic operation do they do so? Since sound 3 intensity scales the distribution of antennal displacements, variance adaptation should be divisive, not 4 subtractive, and result in a change of the slope of the intensity tuning curve. We therefore measured JON 5 responses to short, intermittent probe stimuli interleaved within background noise stimuli of a particular 6 intensity (Fig. 2a, bottom). The resulting family of intensity tuning curvesone for each background 7 intensitydescribes how JON sensitivity changes for different adaptation states (Fig. 2a, top). On a 8 linear intensity scale, the slope of the tuning curves decreases with background intensity, indicating that 9 variance adaptation is indeed divisive. A logarithmic intensity scale, which transforms this division to a 10 rightward shift of the tuning curves, reveals a) that tuning curve shape is invariant to intensity (Fig. 2b, c) 11 and b) that the shift is proportional to the background intensity (Fig. 2d). Variance adaptation in JON thus 12 completely corrects for intensity across the dynamic range testedin both male and female flies 13 ( Supplementary Fig. 7). Regardless of the shift, the tuning curve's steepest part is always centered 14 around the background level. Accordingly, stimulus discriminabilityquantified using Fisher information 29

15
also shifts dynamically and is always maximal around the background level ( Fig. 2e-g). Thus, 16 adaptation enhances the resolution with which changes from the background level are encoded. More 17 broadly, JONs do not encode absolute stimulus intensity, but intensity relative to the background, as is 18 the case for many other sensory systems 30,31 . 19 20 Variance adaptation for song stimuli 21 We next examined the properties of variance adaptation for naturalistic stimuli. Drosophila courtship 22 song comprises bouts consisting of rapid alternations between two modessine and pulse (Fig. 3a). 23 Sound can be decomposed into two components: fast fluctuations of the raw waveform (the carrier), and 24 an envelope, which corresponds to amplitude changes of the carrier on a slower timescale (Fig. 3b). 25 Sine song and pulse song have different, species-specific, sinusoidal carriers of ~150 and 250-300 Hz, 26 respectively 32,33 . But song modes also differ in their envelope dynamics: pulse song's envelope is highly 27 transient, with a species-specific interval between pulses in a pulse train (inter-pulse interval) of ~36ms 28 for melanogaster. In contrast, the envelope of sine song is only weakly modulated and hence resembles 29 the steady envelope of noise stimuli (Fig. 3b). 30 31 We examined neural responses for song-like stimuli across a range of intensities (0.06-4mm s -1 , Fig. 3c-32 d). Consistent with our expectation, adaptation to sinusoidals resembles that of adaptation to noise 33 (compare with Fig. 1b-c), with onset transients that scale with intensity and weaker, saturating steady- 34 state responses (Fig. 3e, g, compare with Fig. 1d). This adaptation is not confined to the melanogaster 35 sine song frequencies but occurs at all frequencies tested (from 100-900 Hz, Supplementary Fig. 8a, b). 8 Adaptation was much weaker for pulse song (Fig. 3d), and intensity tuning resembled that of sine song 1 onsets throughout the pulse train, with a near-linear relation between intensity and response (Fig. 3f, h). 2 Nonetheless, other features of the responses to pulse trains betrayed a dynamic adjustment of response 3 gain. First, pulse response amplitude weakly decreased across pulses in a train particularly at high 4 intensities ( Supplementary Fig. 8c-e). Second, responses to symmetrical pulses were asymmetrical, with 5 strong responses during pulse onset and shallower responses during pulse offset (Fig. 3i). Asymmetry of 6 responses for on and off ramps is a signature of gain control in other systems, such as the olfactory 7 receptor neurons of Drosophila larvae 34 . Additionally, when we tested stimuli of different inter-pulse 8 intervals, we found that the responses to individual pulses depended on the interval between pulses, with 9 short intervals inducing weaker responses during the pulse train, due to stronger adaptation (Fig. 3j). We 10 also observed a small reduction of responses for the longest IPIs tested, which cannot be explained by 11 adaptation: CAP responses recover from adaptation within ~30 ms and hence adaptation does not affect 12 responses to pulses that are spaced further apart in time (Fig. 1d). Overall, although variance adaptation 13 is too slow to correct for the amplitude of individual pulses at the melanogaster-typical pulse interval, it 14 acts as a high-pass filter for this species-specific song feature (reducing responses to songs with shorter 15 IPIs), and thereby could contribute to song evaluation. 16 17 Since there are no synapses between individual JONs (with the possible exception of gap junctions 18 between JON axons 35 ) nor feedback to the JON from the brain or other sensory structures 36 , variance 19 adaptation is likely to arise within individual JONs, at one of the following levels ( Fig. 4a): i) the 20 movements of the antenna, ii) the subthreshold mechanosensitive generator currents 19,21 , or iii) the 21 generation of spikes. 22 Like cochlear hair cells, the JO neurons are not passive transducers of mechanical stimuli but actively 23 amplify antennal movement for soft sounds and partly reset antennal position after a static deflection 24 through mean adaptation 16,18,21,22,37 . If the variance adaptation reported here was part of the same 25 process underlying amplification and mean adaptation, then it should reduce the gain of antennal 26 movement. This should decrease sound-induced antennal vibrations following a rapid increase in sound 27 intensity and create adaptation transients in antennal position. We measured arista movement using 28 laser Doppler vibrometry and found that the amplitude of antennal vibrations faithfully followed changes 29 in stimulus intensity (Fig. 4b), lacking the adaptation transients seen in the CAP (Fig. 4e). We also tested 30 nompC mutants that lack active amplification 37 . These mutants have diminished sound sensitivity 16 , but 31 nonetheless we found that for stimuli that evoked strong responses (> 1 mm s -1 ), variance adaptation 32 was still present ( Fig. 4h and Supplementary Fig. 9). That is, JON intensity tuning shifted with 33 background intensity in the nompC background, just as for wild type. These results suggest that variance 34 adaptation in the JONs is independent of active antennal mechanics and amplification. 9 1 Following mechanical amplification, sound-induced antennal vibrations open stretch-sensitive ion 2 channels in the JON's dendritic tips and produce a transduction or generator current 19 . This subthreshold 3 current could adapt either directly, as part of the mechanotransduction machinery, or indirectly, on its 4 way to the spike-initiating zone (Fig. 4a). While the generator currents are too small to be recorded 5 extracellularly, a subset of type A JONs form gap junction-only synapses with the giant fiber neuron 6 (GFN) [38][39][40] and recording the GFN in voltage-clamp mode reveals the synaptic currents induced by the 7 spikes of type A JONs 19 . These spike-induced currents in the GFN provide an alternative readout of JON 8 spiking activity and exhibit adaptation similar to that of the CAP, confirming that the CAP is an 9 appropriate readout of JON spiking (Fig. 4d, compare with CAP in Fig. 4e). Bath-application of TTX 10 during these GFN recordings abolishes the spike-driven input current from the JONs and unmasks the 11 generator current 19 , which exhibits transients upon stimulation with noise steps, demonstrating that 12 adaptation is present in the sub-threshold currents (Fig. 4c). 13 14 The adaptation transients recorded from the GFN are slower than those in the CAP (Fig. 4f) and 15 adaptation appears less complete (Fig. 4g). This may be because the generator current travels passively 16 along the axons of type A JONs and through the gap junction to the recording site at the GFN soma; this 17 pathway likely acts as a low-pass filter. Alternatively, subsequent spike-frequency adaptation with JONs 18 could further accelerate and complete variance adaptation. Nonetheless, the existence of transients 19 demonstrates that variance adaptation arises in the generator current and does not require spiking. 20 Because adaptation in many sensory neurons involves the calcium-sensitive molecule Calmodulin 7,41-43 , 21 we also tested adaptation in calmodulin mutants 20 . However, these flies exhibited normal adaptation 22 (Supplementary Fig. 9), suggesting that variance adaptation in JONs either operates via a calcium- 23 independent mechanism or another calcium-sensitive molecule 44 . So far we have shown that 24 physiologically separable, computations in Drosophila auditory receptor neurons appear prior to spiking 25 within individual JONs: active amplification 37 , mean adaptation 18,19,22 and now variance adaptation. This 26 raises the question of how these two forms of adaptation interact, given that sound sensitivity should be 27 independent of the slow antennal offset induced by wind or gravity. 28 29 Interaction between mean and variance adaptation 30 To explore the interaction between mean and variance adaptation, we controlled the antennal offset (or 31 mean position of the antenna) and the magnitude (or variance) of antennal vibrations independently 32 using a piezoelectric actuator. Piezoelectric actuation reproduced previous results regarding mean 33 adaptation studied using electrostatic forces to deflect the antenna 18 (Supplementary Fig. 10). We first Hz, 0.1 to 1.1 mm s -1 , Fig. 5a). We found that intensity tuning remained the same for all offsets, 1 demonstrating that mean adaptation does not affect sensitivity to sound (Fig. 5b, c). On the other hand, 2 when we engaged variance adaptation via sinusoidal modulations (300 Hz, 0.07 to 0.63 mm s -1 ) and 3 subsequently measured responses to superimposed steps (+/-0.01 to 0.78 μm, Fig. 5d), sensitivity to 4 step stimuli decreased (Fig. 5e, f). Thus, the interaction between mean and variance adaptation in JONs 5 is unidirectionalvariance adaptation affects responses to displacement but mean adaptation does not 6 affect responses to sound. This suggests that the majority of variance adaptation occurs downstream of 7 mean adaptation, consistent with the fact that mean adaptation is already visible at the level of antennal 8 movement 18 , but variance adaptation is not (Fig. 4b). The independence of mean and variance 9 adaptation could be achieved through a separation of time scales, but we find that both forms of 10 adaptation are similarly fast 18 (Fig. 1e, Supplementary Fig. 10). To gain insight into the computations 11 underlying the independence of sound sensitivity from mean adaptation, and to test the hypothesis of a 12 serial implementation of first mean and then variance adaptation, we built a phenomenological model of 13 adaptation in the JO. 14

15
A sequential network motif for mean and variance adaptation 16 We started by defining a set of elementary computations we deemed necessary for reproducing our 17 experimental findings. Mean and variance adaptation in our model are implemented using incoherent 18 feed-forward loops 34,45 : The loop's input is low-pass filtered to an adaptation signal, which is either 19 subtracted from the input (subtractive adaptation) or used to divide the input (divisive adaptation). We 20 also included a rectifying nonlinearity in our model, since rectification is known to be necessary for 21 variance adaptation 46 . 22 23 To explore the constraints underlying the organization of the two types of adaptation we consider here, 24 we tested all possible sequential or parallel arrangements of these three elementary computations in our 25 model ( Supplementary Fig. 11a). Consistent with our hypothesis, only a sequential arrangement of 1) 26 subtractive adaptation, 2) rectification and 3) divisive adaptation reproduced our experimental 27 observations (Fig. 6a). This sequence corresponds to the solution engineers would choose if they 28 wanted to correct a signal for its mean and variance: first subtract the mean, estimate the signal's 29 intensity through rectification and then divide by the intensity. The model's qualitative behavior was 30 robust to changes in model parameters (e.g., adaptation time constants or adaptation strength, 31 Supplementary Fig. 11b, c). In particular, the independence of sound sensitivity from mean adaptation 32 does not require a separation of time scalesit persists even when mean adaptation is faster than 33 variance adaptation ( Supplementary Fig. 11b). The resulting pattern of adaptation is thus a general 34 property of this arrangement of computations, not of the specific parameters chosen. The first stage of the network motif involves low-pass filtering the stimulus to produce an adaptation signal that represents 1 the slowly-varying stimulus mean, which is then subtracted from the stimulus (Fig. 6b, c). For step 2 stimuli, this adaptation signal corresponds to a smoothed version of the stimulus (Fig. 6b). For sound 3 stimuli, however, with their symmetrical and fast fluctuations, this signal is nearly flat, since the positive 4 and negative deflections cancel each other during the low-pass filtering (Fig. 6c). This first stage thus 5 only adapts to quasi-static stimulus components (Fig. 6f, compare Supplementary Fig. 10) but does not 6 alter responses to the sound (Fig. 6c). This is why mean adaptation does not affect sound sensitivity in 7 the model (compare Fig. 6g with Fig. 5b). 8 9 The output of the mean adaptation stage is then rectified (Fig. 6d, e), either through half-wave 10 rectification (setting the negative parts of the signal to zero) or full-wave rectification (inverting the sign of 11 negative signal parts) ( Supplementary Fig. 12, left). Rectification transforms the standard deviation of the 12 input (sound intensity) to the mean of the rectified output ( Supplementary Fig. 12, right). This enables 13 encoding ofand subsequently adaptation tosignal intensity by simple low pass filtering. Two features 14 of the CAP responses suggest that JONs implement full-wave rectification: i) responses to step 15 deflections are identical for positive and negative steps ( Supplementary Fig. 10) and ii) responses to 16 sinusoidals display frequency doubling (Fig. 3c, inset, compare Supplementary Fig. 12, bottom left). 17 However, the specific form of rectification does not crucially affect adaptation in the model. 18 19 In the divisive adaptation stage (Fig. 6d, 24 25 The model thus explains the unidirectional interaction between mean and variance adaptation in JONs: 26 Mean adaptation does not affect sound responses (Fig. 6g), since the first, subtractive adaptation stage 27 is basically blind to sound (Fig. 6c). By contrast, variance adaptation does affect step responses (Fig. 6i), 28 since the adaptation signal in the second, divisive adaptation stage is non-zero for sounds and for steps 29 ( Fig. 6b, d). Overall, starting from our experimental findings on the interaction between mean and 30 variance adaptation in the JO, our model proposes how efficient sensory adaptation to both mean and 31 variance can be implemented. 32 33

Discussion
Our analysis of adaptation in the Drosophila auditory system reveals that the receptor neurons subtract 1 away changes in the physical stimulus mean, which corresponds to the baseline displacement of the 2 sound receiver, and normalize for the variance of the stimulus, which corresponds to the sound intensity 3 ( Fig. 1-3). Both forms of adaptation first arise in JON subthreshold currents, before spiking (Fig. 4). Even 4 though these two computations are implemented within a single neuron, they are partly independent: 5 mean adaptation does not affect intensity tuning, but variance adaptation reduces responses to static 6 receiver displacements (Fig. 5). A computational model suggests that this compartmentalization of mean 7 and variance adaptation in JONs can be achieved by first subtracting the raw physical stimulus, then 8 rectifying the mean-subtracted stimulus, and finally dividing by the rectified signal to correct for intensity 9 ( Fig. 6). 10 11 The two forms of adaptation studied here underlie an efficient representation of courtship song. As the 12 female moves, her antenna is deflected by wind or gravity, while rapid changes in her position relative to 13 the male singer induce fluctuations in song intensity at her ear. Mean adaptation has been shown to be 14 subtractive and to render the auditory JONs largely insensitive to static or slow deflections 18,19 . Here, we 15 show that variance adaptation is divisive and induces intensity-invariant responses after ~40ms. This 16 contrasts with variance adaptation in the vertebrate ear, where the tuning curves of individual auditory 17 nerve fibers do not shift sufficiently to correct for background intensity 47,48 . 18 19 Variance adaptation in the auditory receptor neurons, while fast enough to correct for the weakly 20 amplitude modulated sine song, does not correct for the intensity of individual pulses within the pulse 21 song (Fig. 3d, f, h). However, it still improves the representation of pulses, as it corrects for background 22 sound levels ( Fig. 2). In addition, variance adaptation underlies a high-pass filter for the inter-pulse 23 interval ( Fig. 3j), indicating that tuning for conspecific song features begins to arise at the level of the 24 receptor neurons. Behavioral tuning for inter-pulse interval is a band-pass centered around values found 25 in the conspecific song (35-40ms) [49][50][51] and auditory neurons in the fly brain (AMMC-B neurons) already 26 exhibit weak bandpass tuning for inter-pulse interval. Our results suggest that this tuning may in part be 27 inherited from the JON inputs 52 . The incomplete adaptation to pulse trains containing melanogaster- 28 specific inter-pulse intervals may be useful for encoding absolute pulse intensity, and this may facilitate 29 orientation behaviors 53 . In addition, first-order auditory neurons in the fly brain (AMMC neurons) show 30 adaptation across pulses in a train 9 , thereby further correcting for pulse intensity variation. 31 32 Information about antennal position in the sound-responsive type AB JONs is ambiguous since onset 33 responses for step deflections depend on the intensity of the superimposed sound (Fig. 5e). However, 34 type CE JONs do not adapt to antennal offsets and hence encode absolute antennal position 11,12,23 . 35 Thus, just like in the mammalian somatosensory system, where different neurons adapt differentially to encode different aspects of touch 54 , distinct sensory channels in the Drosophila antenna differ in their 1 adaptation properties to encode distinct aspects of antennal displacement. 2 3 Our data strongly suggest that adaptation is not a population-level phenomenon, but arises within 4 individual type AB JONs. We recorded CAP signals from only type AB or B JONs (Fig. 1f), and recorded 5 spiking and subthreshold activity from a subpopulation of type A JONs (Fig. 4d) for both experiments 6 we observed adaptation transients. We also recorded calcium signals from type A or B JONs 7 ( Supplementary Fig. 4) -unlike the CAP signal, calcium signals recorded via GCaMP6f are a measure of 8 population firing rate not sensitive to spike timing; the existence of adaptation transients in the calcium 9 signals further indicates that changes in JON sensitivitynot in population synchronyunderlie 10 adaptation. Finally, simple models revealed that explanations for adaptation based on response 11 inhomogeneity within the type AB JONs are unlikely to explain the observed adaptive CAP dynamics 12 ( Supplementary Fig. 3, 5, 6). These experiments and models do not rule out alternative explanations of 13 adaptation in the CAPhowever, they demonstrate that adaptation within individual type AB JON is the 14 most parsimonious explanation of all of our data combined. 15 16 While the molecular bases for mean and variance adaptation in the JONs are still unknown, our data and 17 model constrain hypotheses about their biophysical implementations. Mean and variance adaptation in 18 JONs interact unidirectionallymean adaptation does not affect sensitivity to stimulus variance but 19 variance adaptation does affect responses to offsets (Fig. 5). Our model suggests that this can be 20 implemented by a serial arrangement of two adaptation stages with an interleaved rectification step. The 21 first adaptation stage subtracts the stimulus mean. After an interleaved rectification step, the second 22 adaptation stage is divisive and corrects for intensity (Fig. 6). The partial compartmentalization of the two 23 adaptation forms within JONs can be achieved by implementing mean adaptation at the 24 mechanotransduction step. This is supported by mean adaptation affecting the mechanical sensitivity of 25 the antenna and thus being visible in the antennal movement 18,21 . Mean adaptation is thought to occur 26 via a stiffening of the gating springs that transform the antennal movement into opening and closing of 27 mechanosensitive channels in JONs 18,54 . For mean adaptation to not affect sound sensitivity, the 28 underlying adaptation signal must not be rectified, but must be a linear representation of the symmetrical 29 antennal vibrations (Supplementary Fig. 11a). 30 31 Since variance adaptation is not visible in the antennal movement it likely arises downstream of the 32 gating of mechanotransduction channels. We find that rectification compartmentalizes mean and 33 variance adaptation in JONs, not a separation of timescales, since mean or variance adaptation are 34 equally fast 18 (Fig. 1e, Supplementary Fig. 10). Rather, the separation arises because i) the mean of the 35 raw stimulusprior to rectificationis independent of the variance and ii) rectification after mean subtraction transforms the stimulus variance to the mean of the rectified signal ( Supplementary Fig. 12). 1 Thus, simply dividing by the rectified, mean-subtracted stimulus implements variance adaptation 46 . The 2 same principle holds for retinal adaptation to visual contrast 55 and for intensity adaptation in hair cells 56 . 3 Rectification may be implemented in JON dendrites via voltage-sensitive channels whose activation 4 curve exhibits a hard or soft threshold 20,57,58 . Intriguingly, the frequency doubling in the CAPa 300 Hz 5 tone induces 600Hz CAP oscillations (Fig. 3c) could be the result of full-wave rectification that 6 transforms a sinusoidal's negative lobes into positive ones ( Supplementary Fig. 12). However, in the 7 absence of single-neuron recordings of JONs, it is unclear whether this frequency doubling arises within 8 single neurons or whether it is the outcome of recording from a population of neurons that respond at 9 different phases of the sinusoidal 19 . Nevertheless, it is tempting to speculate that the frequency doubling 10 in the CAP is a correlate of rectification for variance adaptation in single JONs. 11 12 Which molecules mediate variance adaptation? One possibility includes low threshold, voltage-sensitive 13 potassium channels that open in response to subthreshold depolarizations with a delay and can thus 14 dynamically reduce the amplitude of the generator currents (e.g. 59 ). Adaptation channels can operate in a 15 calcium-dependent manner, but we found that variance adaptation in calmodulin mutants appeared 16 normal ( Supplementary Fig. 9). Alternatively, the TRP channels nompC, nanchung and inactive have 17 been shown to adjust the gain of mechanotransduction in the JO 37 . They could hence also play a role in 18 variance adaptation which corresponds to a dynamical gain adjustment. However, we also found that 19 nompC mutants display normal variance adaptation within their dynamic range (Fig. 4h, Supplementary 20 Fig. 9). This is consistent with the observation that NompC mainly affects antennal gain and thus 21 presumably acts upstream of variance adaptation 37 (Fig. 4b). One major difficulty in discovering the 22 molecules that mediate variance adaptation is that these molecules may also be involved in establishing 23 the generator currents themselves (for example, nanchung and inactive mutants abolish the generator 24 current 19 ) -disentangling the two requires a way to measure adaptation and mechanotransduction 25 independently. 26 27 How different forms of adaptation are organized in sensory receptor neurons fundamentally depends on 28 the properties of the physical quantity they process. For the visual system, the mean and variance of a 29 luminance pattern are both scaled by changes in illumination and hence can be corrected for in a single 30 divisive step within photoreceptors 46,60 . Receptor neurons processing physical quantities that obey a 31 similar scaling law between mean and variancefor instance those that correspond to a count or a rate 32 should organize adaptation in this way. The olfactory sensory neurons process the molecule count or 33 odorant concentration, the mean and variance of which are similarly scaled by diffusion. Accordingly, 34 olfactory receptor neurons have been shown to implement divisive -not subtractiveadaptation to concentration [61][62][63][64] . This also applies to adaptation in higher-order neurons, e.g. adaptation to visual or 1 acoustic contrast 30,46,65 . 2 3 By contrast, the mean and variance of the physical quantity processed by auditory receptor neurons do 4 not obey the same scaling law since they are typically affected by independent processes: the additive 5 mean corresponds to a baseline displacement of the mechanical receiver, while the multiplicative 6 variance corresponds to fluctuations in intensity of the actual sound stimulus, which is superimposed on 7 the time-varying baseline. Adaptation in cochlear hair cells and now in JO neurons is organized 8 accordingly, first subtracting the mean and then dividing by the variance 7,47 . All receptor neurons that 9 process physical quantities with an additive mean and a multiplicative variancee.g. quantities that can 10 have both positive and negative valuesshould follow this pattern. While the existence of adaptation 11 has been reported for virtually all sensory systems, the computations and interactions of various forms of 12 adaptation are rarely studied. For instance, mechanosensory bristles in Drosophila implement subtractive 13 adaptation to step deflections 66 but to the best of our knowledge neither variance adaptation nor its 14 interaction with mean adaptation have been studied. Likewise, primary sensory afferents of the whisker 15 system adapt to different degrees of whisker deflection, but the computations underlying adaptation are were performed in flies expressing eGFP in C17-GAL4. Since the generator currents were stronger in 1 younger flies 19 , we recorded at days 1-2 post eclosion. All flies were raised on a 12:12 dark-light cycle. 2 UAS-HM-iav was provided by R. Wilson. All other stocks were provided by the Bloomington stock center . 3 4 Detailed genotypes used: 5 Fig. 1b-e, 2, 3, 5, Supplementary Figures 1b-c, 7, 8 18 Stimuli were generated at a sampling frequency of 10 kHz. Band-limited Gaussian noise (from now on 19 termed "noise") was produced from a sequence of normally distributed random values by band-pass 20 filtering using a linear-phase FIR filter with a pass band between 80 Hz and 1000 Hz. For probing 21 adaptation, we switched the intensity of the noise every 100 ms (or 1000 ms for Ca ++ imaging) in a 22 sequence that contained all transitions between ¼, ½, 1 and 2 mm s -1 (Fig. 1b). The effect of adaptation 23 on intensity tuning was assessed using a noise stimulus at intensities ¼, ½, 1, 2, 4 mm s -1 (adaptation 24 background) whose intensity was switched every 120 ms for 20 ms to a probe intensity of 1/16, 1/8, ¼, ½, 25 1, 2, 4, 8 mm s -1 (e.g. Fig. 1F). To minimize artifacts from abrupt changes in sound intensity, each 26 intensity switch had a duration of 1 ms during which the intensity was linearly interpolated to the new 27 value. 28 29 Artificial pulse song (Fig. 3d) was generated as a train of Gabor wavelets: sin(x*2πfc+ϕ) exp(-(x/σ) 2 with 30 carrier frequency fc of 250 Hz, phase ϕ of 0π, standard deviation σ of 4.6 ms and an inter-pulse interval 31 of 36 ms. These parameters were chosen to mimic the shape of song pulses produced by Drosophila 32 melanogaster males during natural courtship 33 . For Fig. 3j, the inter-pulse interval was varied between 8 33 and 72 ms. 34 Sound 1 The sound delivery system consisted of i) analog output of a DAQ card (PCI-5251, National Instruments), 2 ii) a 2-channel amplifier (Crown D-75A), iii) a headphone speaker (KOSS, 16 Ohm impedance; sensitivity, 3 112 dB SPL/1 mW), and iv) a coupling tube (12 cm, diameter 1 mm). 4 The stimulus presentation setup was calibrated as in 9 . Briefly, the amplitude of pure tones of all 5 frequencies used (100-1000 Hz) was set using a frequency-specific attenuation value measured with a 6 calibrated pressure gradient microphone (NR23159, Knowles Electronics Inc., Itasca, IL, USA). To 7 ensure that the temporal pattern of the noise stimuli was reproduced faithfully, we corrected the 8 presented noise patterns by the inverse of the system's transfer function, measured using a pressure 9 microphone (4190-L-001, Brüel & Kjaer). During experiments, the sound tube was positioned at a 10 distance of 2 mm and an angle or 90 to the right (extracellular recordings and laser Doppler vibrometry) 11 or left (Calcium imaging) arista coming from behind the fly. 12 13 Piezoelectric actuation 14 Piezoelectric actuation was performed using a single channel piezo driver (MDT694, Thorlabs) and 15 actuator (A186). The piezo actuation was calibrated using laser Doppler vibrometry (see below) by 16 measuring displacement and velocity of the piezo tip for all driving voltages used in the experiments 17 (steps and 300 Hz sinusoidals).

Stimulus design and presentation
Step stimuli for piezo-electric actuation were low-pass filtered using a 18 1ms Gaussian window to stay within the operating limits of the piezo driver. 19 20 Electrophysiology 21 Extracellular recordings were performed using glass electrodes (1.5OD/2.12ID, WPI) pulled with a 22 micropipette puller (Model P-100, Sutter Instruments). The fly's wings and legs were removed under cold 23 anesthesia and the abdomen was subsequently fixed using low-temperature melting wax. The head was 24 fixed by extending and waxing the proboscis' tip. The preparation was further stabilized by applying wax 25 or small drops of UV-curable glue to the neck and the proboscis. The recording electrode was placed in 26 the joint between the second and third antennal segment and the reference electrode was placed in the 27 eye. Both electrodes were filled with external saline 70 . 28 29 The recorded signal was amplified and band-pass filtered between 5 and 5000 Hz to reduce high 30 frequency noise and slow baseline fluctuations induced by spontaneous movement of the antenna 31 (Model 440 Instrumentation Amplifier, Brownlee Precision). We ensured that the band-pass filter did not 32 distort the recorded signal, e.g. introduce artefactual response transients. We subsequently digitized at 33 10 kHz with the same DAQ card used for stimulus presentation (PCI-5251, National Instruments). 34 Patch clamp recordings from the giant fiber neuron were performed as described in 9,70 . After obtaining 1 access to the membrane voltage (input resistance between 70 and 400 MΩ), we recorded in voltage 2 clamp mode the spike-induced current, orafter bath application of TTX (Tocris, UK) to 6 μM final 3 concentrationthe generator current. 4 5 Calcium imaging 6 Calcium signals were recorded from flies expressing GCaMP6f 28 under the control of JO15-Gal4, which 7 expresses in the majority of JON-AB 69 . Flies were anesthetized on ice and gently waxed into the hole of 8 a perfusion chamber with the proboscis facing upwards such that both antennae were free to move on 9 the underside of the chamber. The antennal nerves and the AMMC were exposed by removing the 10 proboscis and surrounding tissue. Sound stimuli were presented using sound delivery tubes as described 11 above. 12 13 Two-photon imaging was performed using a custom microscope controlled by Scanimage software 14 (Vidrio Technologies). The calcium indicator was excited at 940 nm using a TiSa Laser (Coherent). 15 GCaMP emission were detected using a resonant scanner at a frame rate of ~60 Hz. ROIs were drawn 16 manually around the projections of type A and type B JONs in AMMC 69 (Supplementary Fig. 4a). 17 Calcium responses from both JON populations were similar (Supplementary Fig. 4c) and we pooled data 18 from both populations for each fly for all analyses (Supplementary Figures 4d,e). ΔF\F values were 19 obtained by subtracting the average fluorescence in the second immediately prior to sound stimulus 20 onset. 21 Laser-Doppler vibrometry 23 Arista movement was measured using laser-doppler vibrometry (Polytec OFV534 laser unit, OFV-5000 24 vibrometer controller, Physik Instrumente, low-pass 5 kHz). 25 26 Data analysis: 27 Pre-processing 28 CAP/LVM instantaneous amplitude was estimated as the magnitude of the Hilbert transform. This 29 method is preferable over "root mean square" like algorithms 71 since it allows estimating the amplitude 30 without imposing a time scale through the duration of the smoothing time window. 31 32 Adaptation time scale and strength 33 The adaptation time scale was estimated by fitting an exponential function r(t)=r0 + rmax exp(-t/τ) to the 34 falling/rising phases of positive/negative transients (Fig. 1c, 3f). Adaptation strength (Fig. 3g) was 35 estimated based on the slopes son and sss of the onset and steady state intensity tuning curves (e.g. Fig.  1d), e.g. son=<Δron(x)/Δx>x where <.>x denotes the average over intensities. 1-son/sss is a measure of 1 adaptation strength that is independent of response magnitude: It's 0 for no adaptation (son=sss), 2 approaches 1 for complete adaptation (sss≪son), and can exceed either of these values in the presence 3 of noise. 4 5 Sigmoidal fits of the tuning curves 6 Onset and steady responses for the intensity-step stimuli (Figures 1b-d) and for the background-7 adaptation stimulus (Fig. 1f, onset only) were obtained by averaging the CAP amplitude over the first 8 8ms and last 10ms of a step/probe, respectively. The tuning curve shapes did not depend crucially on 9 the specific method chosenresults were similar when using different averaging time windows or when 10 taking the CAP amplitude extrema instead. 11 Sigmoidal fits to the resulting curves were obtained using the least squares method. We extracted the 12 slope α and offset or shift β of the tuning curves from these fits: r(x)= r0 +rmax/(1+e xp( -α(x-β) ), where x 13 is the sound intensity on a logarithmic scale and r(x) is the CAP amplitude. Fits were excellent 14 throughout (r 2 >0.9). 15 16 Fisher information 17 Fisher information (Ifisher) is a local measure of stimulus (intensity) discriminability that can be estimated 18 from the tuning curves. Ifisher increases with the magnitude of the local slope of tuning curve (Δr\Δx) 2 -19 steeper slopes produce larger response changes for a given stimulus change and hence facilitate 20 stimulus discrimination. Ifisher decreases with the local variance of tuning curve σ 2 (x) since variability adds 21 uncertainty to stimulus induced response differences 29 . Tuning curve slope as a function of intensity was 22 estimated by taking the derivative of sigmoidal fits to the experimental tuning curves (see above). Since 23 in our data, the response variance is proportional to mean (r 2 =0.98), Fisher information is proportional to 24 Ifisher(x) ∝(Δr(x)/Δx) 2 /r(x) 72 . 25 26 Statistical methods 27 In all figures, error bars depict mean ± std over animals. For the statistical tests in Figures 3f and g we 28 chose a nonparametric test (sign test for paired, rank sum for unpaired data) since data points were not 29 normally distributed (based on a Jarque-Bera test for normality). Z-scores for the tests are 2.27, 0.65 in  Figures 1f and 2g, h were estimated as two times the standard error of the 1 mean over trials or animals, respectively. 2 3 Proof-of-principle models 4 To explore different explanations for the adaptive dynamics in the CAP, we employed regular and 5 adaptive leaky integrate and fire (LIF) model neurons 73 . 6 The subthreshold dynamics of the membrane voltage (Vm) in a LIF is given by: τVd/dt Vm(t) = Iin(t) -Ileak(t) 7 -Iadapt(t), with input current Iin = σstimIstim(t) + σnoiseInoise(t) and additive noise Inoise. The leak current Ileak with 8 membrane resistance Rm follows Ileak(t) = Vm(t) -Vrest. The dynamics of the adaptation current Iadapt 9 evolve according to τadapt d/dt Iadapt(t) = Iadapt(t). A spike is elicited when Vm reaches the threshold Vthres 10 after which it is reset to Vres. Iadapt increments by ΔA upon each spike and is 0 for a regular LIF. For all 11 simulations τV = 4 ms, Vthres = 1 mV, and Vrest = -65 mV, except for Supplementary Fig. 3c, for which the tv 12 was chosen randomly from the interval 2 and 8 ms. The time constant of the adaptation current τadapt is 13 25 ms for Supplementary Figures 2d, 3d and 100 ms for Supplementary Fig. 5e-f. The latter time 14 constant is much longer than observed in the CAP. This value was chosen to be able to observe an 15 effect of adaptation for this stimulation paradigm by enabling adaptation to carry across subsequent 16 steps in intensity. For the regular LIF models (Supplementary Figures 2b-c, 3b-c, 5c-d), the adaptation 17 strength ΔA is 0 mV. For adaptive LIF models, ΔA is 1 mV for Supplementary Figures 2d and 5e-f, and 18 1.5 mV for Supplementary Fig. 3d. 19 20 Stimuli were defined in terms of sound intensity (mm s -1 ) and then scaled to an input current Istim to obtain 21 firing rates that were comparable across conditions (regular vs. adaptive LIF models) and physiologically 22 plausible. Noise stimuli were low pass filtered white noise (cutoff 1000 Hz) with step changes in intensity 23 (standard deviation of the white noise) as describe in the figure legends. For Supplementary Fig. 3, the 24 noise had a mean of 2 mm s -1 to induce constant depolarization and to promote spike time jitter to 25 accumulate over time. For Supplementary Fig. 2b, the noise stimulus was identical for all neurons and 26 independent white noise was added for each neuron to introduce spike-time jitter. For all other 27 simulations, the stimulus was a different realization of the noise since we were interested in observing 28 changes in spike timing and firing rate associated with the steps in intensity, not with the temporal pattern 29 of the white noise. For the range fractionation model ( Supplementary Fig. 5), the low-intensity population 30 (blue) was fed the noise stimulus only while the noise was at low intensity (1 mm s -1 ) and the high- 31 intensity population (orange) only received input during the high-intensity period (2 mm s -1 ). LIF models 32 were numerically simulated using Euler's method with a step size dt=1/20 ms.

Model of JON adaptation
Subtractive and divisive adaptation were modeled as an incoherent feedforward loop 45 which consists of 1 two steps: First, leaky integration low-pass filters the signal to an adaptation signal xada = ∫ xin exp(-t/τ)dt. 2 The integration time constant τ controls how fast the adaptation signal is updated and hence determines 3 the effective speed of adaptation. Second, the adaptation signal then either subtracts or divides the input: 4 xout = xin -xada or xout = xin/(1/σdiv + xada). 1/σdiv is added to the adaptation signal in the divisive case to 5 avoid division by zero in the absence of stimulation and to control completeness of adaptation. 6 7 Generally, xada ≈ 0 for stimulus symmetrical fluctuations much faster than τ. Hence there is no adaptation 8 for rapidly fluctuating and symmetrical stimulus components, i.e. sound-induced vibrations, and 9 adaptation acts as a high-pass filter. Note that this model can in principle also account for power law 10 dynamics in adaptation 74,75 , by replacing the exponential integration kernel with a power law kernel 76 . 11 This does not affect the qualitative model behavior we were interested in here. Rectification in the model 12 was implemented as either full-wave rectification y=|x| or half-wave rectification y=Θ(x), where Θ(x)=0 for 13 x<0 and Θ(x)=x for x≥0 ( Supplementary Fig. 12). 14 15 We systematically explored the adaptation properties of all serial and parallel arrangements of the three 16 elementary computations: subtractive adaptation (S), divisive adaptation (D), rectification (R). To that end 17 we generated computational networks using the following rules: For serial networks, the root node could 18 have either R or Ø ("Ø" stands for an empty computational node) followed by an adaptation node 19 containing S or D or Ø, followed by R or Ø, followed by another adaptation node containing S or D or Ø, 20 followed by R or Ø. More compactly: R/Ø→S/D/Ø→R/Ø→S/D/Ø→R/Ø ("/" stands for "or"). These rules 21 yielded 22 unique serial networks. Parallel networks contained two branches (rules for each branch: 22 →R/Ø→S/D/Ø→R/Ø→) and an input and an output node (rules for each: →R/Ø→). This resulted in 100 23 parallel networks. The parameters for testing all 122 computational network motifs were: τsub=30 ms, 24 τdiv=50 ms, σdiv=10 -4 . 25 26 We tested for robustness of the qualitative model behavior to changes in model parameters by running 27 the selected network motif (Fig. 6a, subtractive adaptation→rectification→divisive adaptation) for 28 combinations of τsub and τdiv on a grid (10≤τ≤100, 20x20 values, linearly spaced, σdiv=10 -4 , Supplementary 29 Fig. 11b) and different values of σdiv (10 -8 ≤σdiv≤ 10 0 , 20 values, logarithmic spacing, τsub=30 ms, τdiv=50 30 ms, Supplementary Fig. 11c). The resulting tuning curves (compare Figures 6f-i) were fitted to sigmoidal 31 functions (see above) to extract the change in slope and position with adaptation (top and bottom panels, 32 respectively, in Supplementary Figures 11b-c). We then used the coefficient of variation (CV) across 33 adaptation stimuli of the tuning curves' shift and slope to quantify adaptation for each parameter 34 combination and for the four adaptation paradigms employed in the paper. A model qualitatively matching our data should have the following properties: Due to mean and variance adaptation, steps and 1 intensity are encoded relative to an adaptation step/intensity. For mean adaptation, tuning curve offset 2 and slope are identical for different offsets if plotted in a x-scale relative to the adaptation step 3 ( Supplementary Fig. 10c). Hence, the CV across adaptation parameters should be close to zero. The 4 same holds for intensity adaptationtuning curves are virtually identical on a log intensity scale relative 5 to the adaptation intensity (Fig. 2c). Accordingly, CV of tuning curve offset and slope should be small. For 6 the impact of intensity adaptation on step responses, we assessed tuning curve parameters on an 7 absolute probe scalein our data, only the slope, but not the offset of the curves changes with different 8 adaptation intensities (Fig. 5e) and hence the CV of offsets should be small and that of slope should be 9 high. For the impact of mean adaptation in intensity tuning, we observed no change in intensity tuning for 10 different adaptation step sizes (Fig. 5b) accordingly, CV of tuning curve offset and slope should be near 11 zero for a model that matches our data. The chosen network motif (Fig. 6a) matches these expectations 12 (Figures 6f-i). Moreover, model behavior is robust to changes in all three parameters (see 13 Supplementary Figures 11b,c), except for small σdiv, simply because this parameter controls adaptation 14 strength and when adaptation is weak, tuning curves don't change much. 15 Data and code availability 17 All data and source code are available from the authors upon request.   b Intensity tuning curves (dots) and sigmoidal fits (lines) for different levels of mean adaptation (color coded, see legend).
c Tuning curve shifts with offset extracted from the sigmoidal fits (see b) for N=4 flies. No significant correlation with the adaptation step was observed for any fly (p>0.14).  Supplementary Fig. 10). The model qualitatively reproduces subtractive mean adaptation, which corrects for antennal baseline.
g Intensity tuning curves of the model for different noise backgrounds (adaptation intensities, color coded, see legend) on an absolute intensity scale (left panel) and relative to the background intensity (right panel) (compare with data in Fig. 2b, c). Variance adaptation is divisive and compensates for sound intensity.
h Intensity tuning of the model for different antennal baseline positions (color coded, see legend in d) corresponding to different levels of mean adaptation (compare with data in Fig. 5b). Intensity tuning is independent of mean adaptation. i Step responses of the model for different noise backgrounds (color coded, see legend in e) corresponding to different levels of variance adaptation (compare with data in Fig. 5e). Responses to steps are reduced with variance adaptation.
The curves for different background noises or steps in d (right panel), e (right panel), and f are nearidentical and hence appear as single curves.

Supplementary Figure 2: De-synchronization or response heterogeneity in JONs does not explain adaptation dynamics
We modelled a population of integrate and fire neurons with membrane noise to explore the effects of desynchronization (b-c) and of an adaptation current (d) on firing rate dynamics. For all panels, the neurons in each population had identical parameters and stimulus inputs and only differed in their membrane noise. See Methods for more details on the simulations. a Noise stimuli used in our study prevent strong de-synchronization in a population of leaky integrate and fire (LIF) neurons. Noise stimulus with zero mean and step-like changes in intensity (switches between 2 and 4mm s -1 ) as used in the CAP recordings and Ca imaging experiments. b Responses to the stimulus in a of a population of 500 LIF neurons, each with independent intrinsic noise. Spike raster plot (top, only a subset of 50 neurons shown for clarity) and population firing rate (bottom) do not exhibit de-synchronization at stimulus onset and no transients in synchrony or firing rate for changes in stimulus intensity following stimulus onset. Note that synchrony does change with stimulus intensity through an increase in the signal-tonoise ratio: louder stimuli produce stronger inputs relative to intrinsic noise sources and hence weaker desynchronization. However, this effect is not transient and hence does not explain adaptation. c Population average firing rate of LIF neurons for 500 independent realizations of the noise stimulus in a. There are no transients in firing rate. d Same as c but using LIF neurons with an adaptation current. Negative and positive transients arise upon changes in noise intensity just as in our CAP recordings.

Supplementary Figure 3: A stimulus regime that promotes de-synchronization or response heterogeneity in JONs does not explain adaptation dynamics
We modelled a population of integrate and fire neurons with membrane noise to explore the effects of desynchronization (b), response heterogeneity (c), and of an adaptation current (d) on firing rate dynamics. In contrast to the simulations shown in Supplementary Figure 2, we used noise with a constant offset as a stimulus to promote desynchronizations. For all panels except for panel g, the neurons in each population had identical parameters and stimulus inputs and only differed in their membrane noise. For panel g, we explicitly tested the effect of response heterogeneity by choosing the membrane time constant for each neuron in the population at random. See Methods for more details on the simulations. a Noise stimulus with step-like changes in intensity (switches between 0.5 and 1 mm s -1 ) with an added 2mm s -1 offset that induces a constant depolarization of the model neurons and promotes de-synchronization. b Responses of a population of LIF neurons for 500 independent realizations of the noise stimulus. Spike raster plot (top, only a subset of 50 neurons shown for clarity) and population firing rate (bottom) lack transients in firing. c Same as b but for a population of regular LIF neurons with heterogeneous adaptation and integration properties (membrane time constants in each neuron was scaled by a random factor between ½ and 2). The heterogeneity does not produce the strong transient changes in firing rate upon step changes in intensity see on the data. d Same as b but for LIF neurons with an adaptation current. Adaptation induces transient changes in firing rate -but not in synchrony -upon step changes in intensity. Overall this suggests that neither desynchronization nor population heterogeneity are not sufficient to explain the adaptation dynamics in the CAP and that adaptation is necessary to do so. c Representative calcium responses (ΔF/F) to the largest positive step in noise intensity measured in the projections of type A JONs (middle) or type B JONs (bottom) shown in panel a (40 trials per step). The stimulus is similar to that used for the CAP recordings ( Fig. 1b) but with an interval between steps of 1000ms to account for the slow dynamics of calcium signals. Both Type A and B JON projections produce transient changes in fluorescence upon step changes in noise intensity, indicating that both subpopulations adapt to sound intensity. These calcium transients are weaker and slower than those seen in the CAP (see Fig. 1), likely due to filtering by the calcium sensor. d Steps in noise intensity (top) used to probe adaptation in calcium signals. Responses are pooled across type A and B JONs in one fly (bottom).
Step size is color-coded (see legend). The calcium signals (bottom) display weak but clear positive and negative transients locked to the time of the intensity step (traces from one fly, averaged over 20 trials per step). This is most evident for the responses to the two most positive and the two most negative steps in noise intensity (thick lines). To highlight the transients, the inset shows responses to the greatest steps in intensity, with baseline subtraction. Changes in fluorescence only weakly depend on absolute noise intensity, consistent with our observation of intensity invariance in the CAP. b Two populations of neurons that respond exclusively at noise intensities of either 1 (blue) or 2 (orange) mm s -1 . c, d Spike raster plots (c) and population firing rates (d) of the low-intensity (blue) and highintensity (orange) population of leaky integrate and fire (LIF) neurons. This model only produces transient increases in firing rate upon increases as well as decreases in intensity. By contrast, JONs produce positive transients for intensity increases, and negative transients for intensity decreases (Fig. 1c). e, f Same as c, d but with adaptive LIF model neurons. Adaptation attenuates the positive transients for the two last steps in noise intensity if the adaptation time constant exceeds the step duration. However, adaptation fails to reproduce the pattern of positive and negative transients in the population firing rate observed in the CAP. Intensity range fractionation -or more generally heterogeneity in intensity tuning among JONs -is thus unlikely to underlie the adaptive dynamics of the CAP. See Methods for details on the parameters of the simulations. Figure 6: Frequency range fractionation does not explain adaptation dynamics While our noise stimulus exhibits a relatively constant frequency spectrum, steps in noise intensity (a) can introduce transient increases in high frequency power (b, schematic) and produce transients in the CAP (c, schematic) by briefly recruiting JON that are tuned for higher frequencies. Known tuning profiles of JON are not narrow enough to produce the strong transient that we see in the CAP 2 . Moreover, the resulting pattern of transients is not consistent with the data (see Fig. 1c), since transients would always positive independent of the direction of the intensity step. We conclude that heterogeneity in frequency tuning cannot explain the CAP dynamics.

Supplementary Figure 7:
Intensity adaptation is not sex-specific a Intensity adaptation is similar in females (left) and males (right). Representative intensity tuning curves for a single fly (averaged over 20 trials) on an intensity scale relative the background intensity (female data reproduced from Fig. 2) b, c The tuning curve shift (b and slope (c) extracted from sigmoidal fits to the set of tuning curves for different backgrounds for all male and female flies (N=5 females (black), N=3 males (red)). Changes in tuning curve parameters with adaptation are similar for males and females, indicating that adaptation is not sex-specific.

Supplementary Figure 8:
Intensity adaptation for song a Pure tones of different frequencies all elicit adaptation in the CAP (data shown for one fly, averaged over 20 trials, sound intensity of 2 mm s -1 ). b Onset (black) and steady-state (blue) responses relative to stimulus frequency (thick lines with error bars are mean±std for N=5 flies, 20 trials; thin lines show tuning for individual flies). The onset and steady-state tuning curve for each fly was normalized such that the maximal onset response was 1.0. Onset responses are given by the average CAP amplitude over the first 10 ms of the stimulus. Steady state responses correspond to the CAP amplitude averaged over 100 ms starting 300 ms after stimulus onset. c CAP amplitude for pulse trains (interval 36 ms) at different intensities (color coded, see legend) for one fly (20 trials). d Responses to pulses 1 -20 in a train delivered at 4 mm s -1 (same data as in c). Pulse number in train is color coded (see legend). e CAP amplitude as a function of pulse number for different pulse intensities (color coded, see legend in c). Colored dots correspond to the pulses shown in d. Figure 10: Piezoelectric actuation reproduces offset adaptation. a Stimuli for probing offset (mean) adaptation -a piezoelectric actuator was used to step-deflect the antenna to induce offset adaptation (top). Sensitivity to subsequent steps was estimated by measuring the CAP amplitude (bottom; color coded -see legend insert in b). b

Supplementary
Step tuning curves for different levels of mean adaptation (color coded, see legend). Tuning curve values correspond to the CAP amplitude of the first response peak after the probe step (a) c Same curves as in b, with the adaptation background subtracted from the displacement values. All curves overlap, suggesting that JONs encode displacement relative to an additive offset (mean). All plots show responses for one representative fly, averaged over 40 trials. Figure 12: Half-wave and full-wave rectification encode stimulus intensity a A sinusoidal signal of different intensities (left, blue), and the outcome of half-wave rectification (red) or full-wave rectification (orange). The graph shows the mean of the three signals. The mean of the original sinusoidal is zero due to the symmetry of the signal. Full-wave or half-wave rectification lead to the signal mean encoding input magnitude (sound intensity), which is a pre-requisite for variance adaptation in the model.