Answers.Body: <p>There are two types of answers, technically or physically.</p>
  <p>technically, there is nothing wrong with positive and negative dB values, all depends on dBref; you can use any dBref you find interesting and data do depend indeed on recorder settings (ADC, gain, reference voltage, sensitivity).</p>
  <p>physically, you may wanted to have your data in, say //1\uPa, then your dBref should be &quot;dBref=1e-6&quot; (not dBref=1*10e-6, <a href="https://www.rdocumentation.org/packages/seewave/versions/2.2.0/topics/spectro" rel="nofollow noreferrer">the documentation here for 20uPa</a> is IMO wrong), your data should be provided by recorder in Pa (or converted by user using calibration values); and you will always have positive values (lowest ambient noise in ocean is always &gt; 1 uPa^2/Hz).</p>
  <p>Obviously, you can take the raw ADC values(e.g. 16 bit) then with dBref=1 you get dB//LSB (relative Least Significant Bit) that are always positive, and with dBref=2^15 you get dB//MSB (relative Most Significant Bit) that are always negative.</p>
  <p>Why your spectrograms has positive and negative dB values, cannot be explained without details on recorder and settings.
  To gain insight, I would simply test data with different dBref settings (especially with  dBref=1)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-09T09:22:07.620Z
Answers.Text: Thank you for your detailed answer ! I was also thinking that the lowest values were a bit unrealistic for ocean ambient noise... I will follow you advice and try out different references to choose the one best suited to the context and application.
Answers.UserDisplayName: Morgane
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-08T07:08:23.953Z
Answers.LastActivityDate: 2023-01-08T07:08:23.953Z
Answers.UserDisplayName: WMXZ
Body: <p>I am using the &quot;seewave&quot; R package to plot spectrograms in R.
  Since my recordings were taken underwater, I specified as reference value 1 μPa.</p>
  <p>Here is my code:</p>
  <pre><code>Gplot &lt;- ggspectro(Glider, ovlp = 50, f=576000, flim = c(0,50), zp=T, dBref= 1*10e-6)
  Gplot + geom_tile(aes(fill = amplitude)) + scale_fill_gradientn(colours=grad_pal_dark(100))
  </code></pre>
  <p>The resulting spectrogram has both negative and positive dB values. I understand dB are relative units, so negatives values would simply indicate SPLs lower than the reference.</p>
  <p><a href="https://i.sstatic.net/OOqtH.png" rel="noreferrer"><img src="https://i.sstatic.net/OOqtH.png" alt="Spectrogam" /></a></p>
  <p>Yet so far most of the spectrograms I have come across (those which display the amplitude scale) are either all positive or all negatives...</p>
  <p>So here are my questions:</p>
  <ul>
  <li>Is it usual or at least sensible to have values both above and below the reference? Or should it be source of concern ?</li>
  <li>Did I mis-use the <code>dBref</code> argument ?</li>
  <li>Could it be linked to recorder specificities I would need to consider (e.g. calibration values) ?</li>
  </ul>
  
Tags: <r><spl><spectrogram><decibels>
Title: Is it common to have a negative-positive dB range in underwater spectrograms?
ThreadText: # Is it common to have a negative-positive dB range in underwater spectrograms?
  
  (Asked by: username_0 on 2023-01-07)
  
  I am using the "seewave" R package to plot spectrograms in R.
  Since my recordings were taken underwater, I specified as reference value 1 μPa.
  Here is my code:
  Gplot <- ggspectro(Glider, ovlp = 50, f=576000, flim = c(0,50), zp=T, dBref= 1*10e-6)
  Gplot + geom_tile(aes(fill = amplitude)) + scale_fill_gradientn(colours=grad_pal_dark(100))
  
  The resulting spectrogram has both negative and positive dB values. I understand dB are relative units, so negatives values would simply indicate SPLs lower than the reference.
  
  Yet so far most of the spectrograms I have come across (those which display the amplitude scale) are either all positive or all negatives...
  So here are my questions:
  
  Is it usual or at least sensible to have values both above and below the reference? Or should it be source of concern ?
  Did I mis-use the dBref argument ?
  Could it be linked to recorder specificities I would need to consider (e.g. calibration values) ?
  
  **Tags:** r, spl, spectrogram, decibels
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-08. Score: 3 | Accepted answer
  
  There are two types of answers, technically or physically.
  
  technically, there is nothing wrong with positive and negative dB values, all depends on dBref; you can use any dBref you find interesting and data do depend indeed on recorder settings (ADC, gain, reference voltage, sensitivity).
  
  physically, you may wanted to have your data in, say //1\uPa, then your dBref should be "dBref=1e-6" (not dBref=1\*10e-6, [the documentation here for 20uPa](https://www.rdocumentation.org/packages/seewave/versions/2.2.0/topics/spectro) is IMO wrong), your data should be provided by recorder in Pa (or converted by user using calibration values); and you will always have positive values (lowest ambient noise in ocean is always > 1 uPa^2/Hz).
  
  Obviously, you can take the raw ADC values(e.g. 16 bit) then with dBref=1 you get dB//LSB (relative Least Significant Bit) that are always positive, and with dBref=2^15 you get dB//MSB (relative Most Significant Bit) that are always negative.
  
  Why your spectrograms has positive and negative dB values, cannot be explained without details on recorder and settings.
  To gain insight, I would simply test data with different dBref settings (especially with dBref=1)
  
  > **Comments:**
  > **username_0**: Thank you for your detailed answer ! I was also thinking that the lowest values were a bit unrealistic for ocean ambient noise... I will follow you advice and try out different references to choose the one best suited to the context and application.  
  
  ---
  
  