GithubHelp home page GithubHelp logo

liamtoney / sonify Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 2.0 32.46 MB

Sonification of seismic and infrasound signals

Home Page: https://sonify.rtfd.io

License: MIT License

Python 98.31% Shell 1.69%
sonification seismology infrasound

sonify's People

Contributors

liamtoney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sonify's Issues

Spectrogram problems when obtaining data from IRIS for Ecuador Seismic Network

I'm welcome to be excited about this 'sonify' project. But when it comes to seismic networks in the world, the problem is mainly with the EC network ie EC.VCES..HHZ and Its location is --.

As you can see the screen should measure in color based on dB power, but it looks like the background is blue.

vlcsnap-2022-02-23-19h20m55s385

I'm getting a message like this:
WARNING (norm_resp): computed and reported sensitivities differ by more than 5 percent. Execution continuing.

Here's the initial response from the station.

BODE EC VCES HHZ 2012 234T00 00 01

URL: click here.

The code:

from sonify import sonify
from obspy import UTCDateTime

sonify(
    network='EC',
    station='VCES',
    channel='HHZ',
    starttime=UTCDateTime('2022-02-10T14:40:40.430304Z'),
    endtime=UTCDateTime('2022-02-10T16:40:40.430304Z'),
    location='--',
    freqmin=1,
    freqmax=23,
    speed_up_factor=200,
    fps=1,  # Use fps=60 to ~recreate the JHEPC entry (slow to save!)
    spec_win_dur=8,
    db_lim=(-180, -130),
)

It's sensitivity is of 3.14195E8 @ 1.0 Hz (SEED Stage 0)

Implement an audio compression option

Some seismic or infrasound signals have a large dynamic range, which is not ideal for playback at low volumes or on small systems. The default Alaska avalanche signal is a good example of this, where the large-amplitude failure is much, much louder than the precursory seismicity. While applying audio compression (side note — in the field of seismology, automatic gain control does sort of the same thing) to "smooth" the loudness variations would make the mapping from physical amplitude to loudness less clear, it could help make some sonifications easier to hear.

Here's some Python source code for audio compression: https://github.com/jiaaro/pydub/blob/master/pydub/effects.py#L115-L187 — might be overkill?

Make [up/down]sampling more robust

This line

tr_audio.interpolate(sampling_rate=AUDIO_SAMPLE_RATE / speed_up_factor)
peforms interpolation of the input data waveform to ensure that the output audio WAV file has a 44.1 kHz sampling rate. For a typical speed_up_factor value such as sonify's default of 200, the target sampling rate is 44100 Hz / 200 = 220.5 Hz. Since seismoacoustic data sampling rates are generally (but not always!) lower than this, we're usually upsampling.

However, for higher data sampling rates (even, say, 100 Hz) and larger speed_up_factor values (say, 500), the above line is actually downsampling (44100 Hz / 500 = 88.2 Hz < 100 Hz). Therefore, we need to apply an anti-aliasing filter.

Also, we should use a more advanced interpolation method, like lanczos (docs for the interpolate() method of the Trace object are here).

Use `saul` for spectrogram creation?

Leveraging saul as a dependency would simplify this package and reduce redundancy. saul is not versioned, though, and likely never will be... so we'd have to pin to a certain commit.

Improve handling of resolution

Currently we specify a RESOLUTION (e.g. (3840, 2160) for 4K) and DPI (e.g. 500) and use

Figure(figsize=np.array(RESOLUTION) / DPI)

to ensure that the output RESOLUTION is achieved.

A better solution would be to have the user specify the RESOLUTION only and have the DPI be a variable quantity that is altered such that RESOLUTION is achieved for a fixed figsize. In other words, we should ensure that altering the RESOLUTION does not change the size of figure elements — it should only change how pixelated the frames are.

This would open up the door to providing users with a 2K and/or 1080p option along with 4K. This would be useful, since when combined with 60fps, 4K can sometimes produce videos with bitrates high enough to cause playback issues.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.