<phyphox version="1.7" locale="en">
  <title>Spectrum Amplitude</title>
  <category>Acoustics</category>
  <description>Plots the amplitude of sine waves against their frequencies.</description>

  <translations>
<translation locale="de">
            <title>Lautsprecher-Charakterisierung</title>
            <category>Akustik</category>
            <description>
Dieses Experiment nutzt das Mikrofon, um den Frequenzgang eines Lautsprechers aufzunehmen, das Abstrahlverhalten zu charakterisieren und einen Klirrfaktor zu bestimmen.
</description>
            <string original="NOT calibrated">NICHT kalibriert</string>
            <string original="calibrated">kalibriert</string>
            <string original="Sound pressure level">Schalldruckpegel</string>
            <string original="History">Verlauf</string>
            <string original="Time">Zeit</string>
            <string original="Clear history">Verlauf löschen</string>
            <string original="Please see the calibration tab to get proper results.">Sieh dir bitte die Seite 'Kalibration' an, um vernünftige Ergebnisse zu erhalten.</string>
            <string original="Calibration">Kalibration</string>
            <string original="This experiment uses a rather naive approach to determine the sound pressure level (SPL). You will need a reference sound with a known amplitude in dB. For example, you could setup a constant noise source and measure its sound pressure level with an external device. Enter the measured level as the reference SPL and push 'calibrate' while the experiment is running.">Dieses Experiment nutzt eine recht simple Methode um den Schalldruckpegel zu bestimmen. Du musst ein Referenz-Geräusch mit bekannter Amplitude in dB erzeugen. Beispielsweise könntest du eine konstante Geräuschquelle benutzen und den Schalldruckpegel mit einem externen Gerät in gleichem Abstand messen. Den Pegel kannst du dann als Referenz eingeben und bei laufendem Experiment auf 'Kalibrieren' drücken.</string>
            <string original="Reference SPL">Referenz-Pegel</string>
            <string original="Calibrate">Kalibrieren</string>
            <string original="Calibration offset">Kalibrations-Offset</string>
            <string original="If you have done this before or on an identical device you may just enter the calibration offset from your previous calibration directly and press 'set offset'.">Wenn du dieses oder ein identisches Smartphone schon vorher kalibriert hast, kannst du auch einfach den Offset der vorherigen Kalibration unten eingeben und auf 'Offset setzen' drücken.</string>
            <string original="Custom offset">Eigener Offset</string>
            <string original="Set offset">Offset setzen</string>
            <string original="How accurate are these results?">Wie genau sind die Ergebnisse?</string>
            <string original="For teaching and exploring? Probably good enough. For serious studies? Probably not, but other apps might perform better (see below). For scientific or health-related applications? Certainly not, get a dedicated device for this.">Für den Unterricht und einfaches Ausprobieren? Wahrscheinlich gut genug. Für ernstere Studien? Wahrscheinlich nicht so gut, aber andere Apps könnten besser sein (siehe unten). Für Wissenschaft oder Arbeitsschutz? Sicherlich nicht gut genug, dafür braucht man spezielle Geräte.</string>
            <string original="Why isn't this already calibrated?">Warum ist das Experiment nicht schon kalibriert?</string>
            <string original="phyphox is available on more than 10000 devices. Most of them have different microphones, different electronics and different software - all affecting their response to sound. We cannot calibrate them all, but in some cases there are apps which only target a limited number of devices (like apps specific to iPhones) which can calibrate these few devices. If you are interested in better results without calibration, you should check out specific apps for your device.">phyphox ist auf mehr als 10000 Geräten verfügbar. Die meisten haben verschiedene Mikrofone, verschiedene Elektronik und verschiedene Software - das alles beeinflusst die Messung. Wir können diese Geräte nicht alle kalibrieren, aber manche Apps bedienen eine kleinere Geräte-Auswahl (beispielsweise iPhone-Apps) und können diese Auswahl auch kalibrieren. Wenn du Interesse an genaueren Messungen hast, solltest du solche spezielleren Apps ausprobieren.</string>
            <string original="Why can't we get a better calibration?">Warum ist keine genauere Kalibration möglich?</string>
            <string original="We wanted a simple procedure to allow students to get comparable data across different devices. With decent equipment you could calibrate the frequency dependency of your microphone as well and maybe even compensate for non-linear responses. If you have such equipment and want to try it, please let us know - we already have phyphox-experiments that allow for more advanced calibration techniques.">Wir wollen eine einfache Kalibration für Schülerinnen und Schüler sowie Studierende anbieten, so dass vergleichbare Daten für verschiedene Geräte möglich sind. Mit guten Messgeräten könnte man auch den Frequenzgang des Mikrofons und vielleicht sogar nicht-lineares Verhalten kompensieren. Wenn du über solche Geräte verfügst und es ausprobieren möchtest, lass es uns wissen - wir haben bereits phyphox-Experimente, die komplexere Kalibrationstechniken ermöglichen.</string>
            <string original="The following graph shows the spectral amplitude of the Loudspeaker.">Der nachfolgende Graph zeigt den Frequenzgang des Lautsprechers</string>
            <string original="For getting the THD, use the magnification function by pressing on the graph. You can use the Choose Dots feature to now drag a line between the two points you want to measure. PhyPhox now shows the magnitude and frequency difference between these two points.">Um den Klirrfaktor zu bestimmen, drücke auf den Graph und wähle Punkte auswählen. Ziehe dann mit dem Finger von einem Punkt zum anderen, um die Magnituden- und Frequenzdifferenz zu erhalten.</string>
            <string original="Result">Ergebnis</string>
            <string original="Amplitude and Frequency">Amplitude und Frequenz</string>
            <string original="Recording">Aufnahme</string>  
            <string original="Frequency">Frequenz</string> 
            <string original="Below you can set the number of samples used for the Fourier transform. More samples means slower updates, but higher spectral resolution.">Hier kannst du die Anzahl der Messwerte einstellen, die für die Fourier-Transformation genutzt werden. Mehr Messwerte bedeuten langsamere Aktualisierung, aber auch ein Spektrum mit höherer Auflösung.</string>
            <string original="Peak-Frequency">Spitzenfrequenz</string>
            <string original="THD">Klirrfaktor</string>
            <string original="Fourier Transform">Fouriertransformierte</string>
            <string original="Raw data">Rohdaten</string>
            <string original="For measuring the radiation, use 3 different frequencies and measure the SPL at different angles and distances in front and to the sides of the loudspeaker. Carefully write down the measured SPL at the specific angles to create a graph.">Um das Abstrahlverhalten zu bestimmen, miss die Amplitude an verschiedenen Orten vor dem Lautsprecher. Schreibe die Amplituden und Abstände auf, um daraus einen Graphen zu erstellen.</string>
    </translation>
  </translations>
  
  <data-containers>
    <container size="32768">recording</container>
    <container>rate</container>
    <container>rate/2</container>
    <container size="32768">recording_subrange</container>
    <container>recording_length</container>
    <container init="2048">samples</container>
    <container>actual_samples/2</container>
    <container>actual_samples/2+1</container>
    <container>actual_samples+1</container>
    <container>actual_samples</container>
    <container>subrange_start</container>
    <container>period</container>
    <container size="32768">time</container>
    <container size="32769">frequency</container>
    <container size="32768">fftX</container>
    <container size="32768">fftY</container>
    <container size="16384">halfFrequency</container>
    <container size="16384">halfFFTtempX</container>
    <container size="16384">halfFFTtempY</container>
    <container size="16384">fft</container>
    <container size="1">f0</container>
    <container size="1">t</container>


    <container size="32768">recordingSquared</container>
    <container>sum</container>
    <container>mean</container>
    <container>dbUncal</container>
    <container>lnMean</container>
    <container>userCalibration</container>
    <container static="true">ln10</container>
    <container size="1">dB</container>
    <container init="0">calibration</container>
    <container init="60">target dB</container>
    <container>newCal</container>

    <container size="0">tout</container>
    <container size="0">fout</container>
    <container size="0">dBout</container>
    
    <container size="1" static="false">now</container>
    <container size="1" init="0" static="false">resetTime</container>
    <container size="1" init="0" static="false">t0</container>
            
  </data-containers>
  <input>
    <audio>
      <output>recording</output>
      <output component="rate">rate</output>
    </audio>
  </input>
  <views>
    <view label="Amplitude and Frequency">
      <value label="Status">
        <input>calibration</input>
        <map min="0" max="0">NOT calibrated</map>
        <map>calibrated</map>
      </value>
      <value label="Sound pressure level" unit="dB" size="3" precision="1">
        <input>dB</input>
      </value>
      <separator height="1"/>
      <graph label="Amplitude" labelX="Time" unitX="s" labelY="Amplitude" unitY="dB" partialUpdate="false" history="1">
        <input axis="x">tout</input>
        <input axis="y">dBout</input>
      </graph>
      <graph label="Frequency" labelX="Time" unitX="s" labelY="Frequency" unitY="Hz" partialUpdate="false" history="1">
        <input axis="x">tout</input>
        <input axis="y">fout</input>
      </graph>
            <separator editor:uuid="172" height="1" color="404040">
            </separator>
            <button label="Clear history">
                <input type="empty" />
                <output>dBout</output>
                <input type="empty" />
                <output>tout</output>
                <input type="empty" />
                <output>fout</output>
                <input type="empty" />
                <output>recording_subrange</output>
                <input type="empty" />
                <output>t</output>
                <input type="value">1</input>
                <output>resetTime</output>
            </button>
            <separator height="1"/>
            <info label="For measuring the radiation, use 3 different frequencies and measure the SPL at different angles and distances in front and to the sides of the loudspeaker. Carefully write down the measured SPL at the specific angles to create a graph."/>
    </view>
    <view label="Result">
      <info label="The following graph shows the spectral amplitude of the Loudspeaker."/>
      <separator height="1"/>
      <graph label="Result" labelX="Frequency" unitX="Hz" labelY="Amplitude" unitY="dB" style="dots" partialUpdate="false" history="1" logX="true">
        <input axis="x">fout</input>
        <input axis="y">dBout</input>
      </graph>
    </view>
    <view label="Calibration">
      <info label="This experiment uses a rather naive approach to determine the sound pressure level (SPL). You will need a reference sound with a known amplitude in dB. For example, you could setup a constant noise source and measure its sound pressure level with an external device. Enter the measured level as the reference SPL and push 'calibrate' while the experiment is running."/>
      <separator height="1"/>
      <edit label="Reference SPL" unit="dB">
        <output>target dB</output>
      </edit>
      <button label="Calibrate">
        <input>newCal</input>
        <output>calibration</output>
      </button>
      <value label="Calibration offset" unit="dB">
        <input>calibration</input>
      </value>
      <separator height="1"/>
      <info label="If you have done this before or on an identical device you may just enter the calibration offset from your previous calibration directly and press 'set offset'."/>
      <separator height="1"/>
      <edit label="Custom offset" unit="dB">
        <output>userCalibration</output>
      </edit>
      <button label="Set offset">
        <input>userCalibration</input>
        <output>calibration</output>
      </button>
      <separator height="1"/>
      <info label="Below you can set the number of samples used for the Fourier transform. More samples means slower updates, but higher spectral resolution."/>
      <value label="Samples" precision="0">
        <input>samples</input>
      </value>
      <separator height="0.5"/>
      <button label="2048">
        <input type="value">2048</input>
        <output>samples</output>
      </button>
      <button label="4096">
        <input type="value">4096</input>
        <output>samples</output>
      </button>
      <button label="8192">
        <input type="value">8192</input>
        <output>samples</output>
      </button>
      <button label="16384">
        <input type="value">16384</input>
        <output>samples</output>
      </button>
      <button label="32768">
        <input type="value">32768</input>
        <output>samples</output>
      </button>
    </view>
    <view label="THD">
      <value label="Peak-Frequency" unit="Hz">
        <input>f0</input>
      </value>
      <separator height="1"/>
      <graph label="Fourier Transform" logX="false" logY="false" labelX="Frequency" unitX="Hz" labelY="FFT Mag" unitY="a.u.">
        <input axis="x">halfFrequency</input>
        <input axis="y">fft</input>
      </graph>
      <separator height="1" precision="0"/>
      <value label="Samples used">
        <input>actual_samples</input>
      </value>
      <value label="Period used" unit="ms" precision="2" factor="1000">
        <input>period</input>
      </value>
      <separator height="1"/>
      <info label="For getting the THD, use the magnification function by pressing on the graph. You can use the Choose Dots feature to now drag a line between the two points you want to measure. PhyPhox now shows the magnitude and frequency difference between these two points."/>      
    </view>
    <view label="Raw data">
      <graph label="Recording" labelX="t" unitX="s" labelY="Amplitude" unitY="a.u.">
        <input axis="x">time</input>
        <input axis="y">recording_subrange</input>
      </graph>
    </view>
  </views>
  <analysis sleep="0.05" dynamicSleep="period">
    <timer>
      <output clear="false">now</output>
    </timer>
    <count>
      <input clear="false">recording</input>
      <output>recording_length</output>
    </count>
    <subtract>
      <input>recording_length</input>
      <input clear="false">samples</input>
      <output>subrange_start</output>
    </subtract>
    <subrange>
      <input clear="false" as="from">subrange_start</input>
      <input as="in" clear="false">recording</input>
      <output>recording_subrange</output>
    </subrange>
    <count>
      <input clear="false">recording_subrange</input>
      <output>actual_samples</output>
    </count>
    <add>
      <input clear="false">actual_samples</input>
      <input type="value">1</input>
      <output>actual_samples+1</output>
    </add>
    <divide>
      <input clear="false">actual_samples</input>
      <input type="value">2</input>
      <output>actual_samples/2</output>
    </divide>
    <add>
      <input clear="false">actual_samples/2</input>
      <input type="value">1</input>
      <output>actual_samples/2+1</output>
    </add>
    <divide>
      <input clear="false">actual_samples</input>
      <input clear="false">rate</input>
      <output>period</output>
    </divide>
    <divide>
      <input clear="false">rate</input>
      <input type="value">2</input>
      <output>rate/2</output>
    </divide>
    <ramp>
      <input as="start" type="value">0</input>
      <input as="stop" clear="false">period</input>
      <input as="length" clear="false">actual_samples+1</input>
      <output>time</output>
    </ramp>
    <ramp>
      <input as="start" type="value">0</input>
      <input as="stop" clear="false">rate/2</input>
      <input as="length" clear="false">actual_samples/2+1</input>
      <output>frequency</output>
    </ramp>
    <fft>
      <input clear="false">recording_subrange</input>
      <output as="re">fftX</output>
      <output as="im">fftY</output>
    </fft>
    <subrange>
      <input type="value" as="from">1</input>
      <input clear="false" as="to">actual_samples/2</input>
      <input as="in">frequency</input>
      <input as="in">fftX</input>
      <input as="in">fftY</input>
      <output>halfFrequency</output>
      <output>halfFFTtempX</output>
      <output>halfFFTtempY</output>
    </subrange>
    <formula formula="sqrt([1_]*[1_]+[2_]*[2_])">
      <input>halfFFTtempX</input>
      <input>halfFFTtempY</input>
      <output>fft</output>
    </formula>
    <max>
      <input as="y" clear="false">fft</input>
      <input as="x" clear="false">halfFrequency</input>
      <output as="position" clear="false">f0</output>
    </max>

    <power>
      <input as="base" clear="false">recording_subrange</input>
      <input as="exponent" type="value">2</input>
      <output>recordingSquared</output>
    </power>
    <integrate>
      <input>recordingSquared</input>
      <output>sum</output>
    </integrate>
    <divide>
      <input>sum</input>
      <input clear="false">actual_samples</input>
      <output>mean</output>
    </divide>
    <log>
      <input clear="false">mean</input>
      <output>lnMean</output>
    </log>
    <log>
      <input type="value">10</input>
      <output>ln10</output>
    </log>
    <divide>
      <input clear="false">lnMean</input>
      <input clear="false">ln10</input>
      <input type="value">0.1</input>
      <output>dbUncal</output>
    </divide>
    <add>
      <input clear="false">dbUncal</input>
      <input clear="false">calibration</input>
      <output clear="false">dB</output>
    </add>
    <subtract>
      <input clear="false">target dB</input>
      <input clear="false">dbUncal</input>
      <output>newCal</output>
    </subtract>

    <if equal="true">
        <input clear="false">actual_samples</input>
        <input clear="false">samples</input>
        <input clear="false">t</input>
        <output clear="false">tout</output>
    </if>
    <if equal="true">
        <input clear="false">actual_samples</input>
        <input clear="false">samples</input>
        <input clear="false">f0</input>
        <output clear="false">fout</output>
    </if>
    <if equal="true">
        <input clear="false">actual_samples</input>
        <input clear="false">samples</input>
        <input clear="false">dB</input>
        <output clear="false">dBout</output>
    </if>
    
        <if editor:uuid="150" editor:posx="750" editor:posy="350" less="false" equal="true" greater="false">
            <input as="a" clear="false">resetTime</input>
            <input as="b" type="value">1</input>
            <input as="true" clear="false">now</input>
            <output as="result">t0</output>
        </if>
        <append editor:uuid="151" editor:posx="1000" editor:posy="600">
            <input as="in" type="value">0</input>
            <output as="out">resetTime</output>
        </append>
        <subtract editor:uuid="152" editor:posx="1250" editor:posy="850">
            <input as="minuend" clear="false">now</input>
            <input as="subtrahend" clear="false">t0</input>
            <output as="difference">t</output>
        </subtract>
    
  </analysis>
  <export>
    <set name="Results">
      <data name="Time (s)">tout</data>
      <data name="Frequency (Hz)">fout</data>
      <data name="Absolute Amplitude (a.u.)">dBout</data>
    </set>
    <set name="Calibration">
      <data name="calibration offset (dB)">calibration</data>
    </set>
  </export>
</phyphox>
