Skip to main content

Wrapper for the SDIF library for audio analysis

Project description

sh-month sh-wheel

SDIF for Python

  • Author: Eduardo Moguillansky

  • Contact: eduardo.moguillansky@gmail.com

This is a python wrapper to IRCAM’s sdif library (http://sourceforge.net/projects/sdif/files/sdif/) to read and write SDIF files. It consists of a core written in Cython and some other utilities written in Python. The SDIF library is included in the package and built together with the python wrapper.

NB: This software is released under the GPL v3 license.


Install

pip install pysdif3

Build from source

git clone https://github.com/gesellkammer/pysdif3
cd pysdif3

python3 setup.py install

Introduction

Sdif files are used to store time-based analysis. A Sdif file consists of time-tagged frames, each frame consisting of one or more matrices.

Read a Sdif file, read only selected matrices

from pysdif import *
sdif = SdifFile("path.sdif")
# get metadata
print(sdif.get_NVTs())
for frame in sdif:
    print(frame.time, frame.signature)
    for matrix in frame:
        if matrix.signature == b'1MAT':
            print(matrix.get_data())

Write a Sdif file modifying a previous one

from pysdif import *
infile = SdifFile("source.sdif")
outfile = SdifFile("out.sdif", "w").clone_definitions(infile)
for inframe in infile:
    if inframe.signature != b'1TRC':
        continue
    with outfile.new_frame(inframe.signature, inframe.time) as outframe:
        for matrix in inframe:
            # 1TRC has columns index, freq, amp, phase
            data = matrix.get_data(copy=True)
            # modify frequency
            data[:,1] *= 2
            outframe.add_matrix(matrix.signature, data)
outfile.close()

Write a SDIF file from scratch

from pysdif import *
import numpy as np

sdif = SdifFile("rbep.sdif", "w")

# Add some metadata. This is optional
sdif.add_NVT({'creator': 'pysdif3'})

# Add any matrix definitions. In this case we add only one definition
# This is a matrix named "RBEP" with 6 columns
# Each row in this matrix represents a breakpoint within a frame
# Index: partial index to which a breakpoint belongs
# Frequency: the freq. of the breakpoint
# Amplitude: the amplitude of the breakpoint
# Phase: the phase
# Bandwidth: the "noisyness" of the breakpoint
# Offset: the time offset in relation to the frame time
sdif.add_matrix_type("RBEP", "Index, Frequency, Amplitude, Phase, Bandwidth, Offset")

# After all matrix types are defined we define the frames. A frame is defined
# in terms of the matrices it accepts.
# Here we define a frame named "RBEP" which takes only matrices of type "RBEP"
sdif.add_frame_type("RBEP", ["RBEP ReassignedBandEnhancedPartials"])

# Now we need to add the data. Since there is just one matrix per frame
# in this sdif we can use the shortcut sdif.new_frame_one_matrix which
# creates a frame and adds a matrix all at once
# The data is just fake data for the sake of an example
data = np.array([
    [1, 440, 0.1, 0, 0, 0],
    [2, 1000, 0.2, 0, 0, 0],
], dtype=float)
sdif.new_frame_one_matrix(frame_sig="RBEP", time=0.5, matrix_sig="RBEP", data=data)

# A second frame
data = np.array([
    [1, 442, 0.1, 0, 0, 0],
    [2, 1100, 0.1, 0, 0, 0]
], dtype=float)
sdif.new_frame_one_matrix(frame_sig="RBEP", time=0.6, matrix_sig="RBEP", data=data)

sdif.close()

Documentation

https://pysdif3.readthedocs.io/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pysdif3-1.0.1-cp312-cp312-win_amd64.whl (472.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

pysdif3-1.0.1-cp312-cp312-win32.whl (443.7 kB view details)

Uploaded CPython 3.12 Windows x86

pysdif3-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pysdif3-1.0.1-cp312-cp312-macosx_11_0_arm64.whl (521.7 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pysdif3-1.0.1-cp312-cp312-macosx_10_9_x86_64.whl (538.2 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pysdif3-1.0.1-cp311-cp311-win_amd64.whl (476.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

pysdif3-1.0.1-cp311-cp311-win32.whl (446.9 kB view details)

Uploaded CPython 3.11 Windows x86

pysdif3-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pysdif3-1.0.1-cp311-cp311-macosx_11_0_arm64.whl (522.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pysdif3-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl (539.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pysdif3-1.0.1-cp310-cp310-win_amd64.whl (476.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

pysdif3-1.0.1-cp310-cp310-win32.whl (446.9 kB view details)

Uploaded CPython 3.10 Windows x86

pysdif3-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pysdif3-1.0.1-cp310-cp310-macosx_11_0_arm64.whl (520.5 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pysdif3-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl (537.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pysdif3-1.0.1-cp39-cp39-win_amd64.whl (476.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

pysdif3-1.0.1-cp39-cp39-win32.whl (180.1 kB view details)

Uploaded CPython 3.9 Windows x86

pysdif3-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pysdif3-1.0.1-cp39-cp39-macosx_11_0_arm64.whl (520.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pysdif3-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl (270.7 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pysdif3-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 472.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cab83773a696ea3165f888d3c4f89e40d94e167c867d39608b22f5568410ad34
MD5 cf2f9b75251a0996dbfd87bc870c0eb5
BLAKE2b-256 2fea012e7200446fc235eabb13039f9310894fd616dc9a9e6a8d5f918a2f6c5f

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 443.7 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 3d55a1d3aa3f15999c04c25c66b2fbebce87e145483cffcd2e58a3b3bc2e9465
MD5 64f5edaccc31fd129137c970831b5cbd
BLAKE2b-256 5e0b5566e434b9f554179733b0fdfe34c317661e6dd3b4e4aeeef492a6d36fab

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e02d161f8a9711b5e516afd38c3bfda536c64f6232dd4ad7bda206809f24c85
MD5 ad750fd7bbadd079e2ba01ccbd958f04
BLAKE2b-256 bb90f1977b8331c3ddcb84ed6acaf031771e9941ab39c2c7e93881ad57976411

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56b36a3de18fdd04b7e7c165fb13035bebe5d486f2149a01490594502384257e
MD5 5aed50a3e9a5bf218a83ab91b0ee160b
BLAKE2b-256 51dc27896bf04c59286c9392502e79af562527dd696c171f35ef60238d64da89

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16971aeac279c58c5f9f83e7c0b8ca1fc7dac7f526cbfd1a61136fb83ce66f75
MD5 242640544bf4530cdec65988a1c7fd97
BLAKE2b-256 91b83197be00a3c9535f3369ab544682b99e7ef3213a1ae79c4449033d92f666

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 476.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ad7cb34a89693059fce3820052722cd5c7acecbf2ac4a5db59b9edf441866769
MD5 fb4e833f43ed65a618022c68194f78de
BLAKE2b-256 1fca4da9bdd185523e89ca21012cd6c74dde57af3c4022b33a5b0f1e0be08eb7

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 446.9 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 e1843fcb2116e07b5a73dd6d949624d700e25c82fc88b5d73c1d08464c687b6f
MD5 0416c6461d79f4ecf3bc91e531a75665
BLAKE2b-256 6b26a5a058a6c10c70e8928a0b2833fb574d89308996c89a336b724f593f6c2e

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55cfb05cea3db37a2d51b64fea9fa9fa69585822363c7d9ad9d1714600d6494d
MD5 2ed05e82e0da7cf322eef491a19e8b24
BLAKE2b-256 10419ea2c36ea4dca08a8c72025b83c88355fbc5bc9969b9b7e75037d520ac57

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e3841e6f2cc6a7dd440be51a382fa764972d254d5c23716e0d978d0d2c78b3f
MD5 ba359c409d44b534b5431b1cfafd7c0e
BLAKE2b-256 a4fde58cd4d4dbfa753f754477b3adb312fa2b0cf2c3acad6e5c60b8e7eb043a

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 085bc799abf62a29c0f5dafdb536a341a35e901560b0ff0941c5368bfaf1fc9f
MD5 a17b7f10fc9dcbd26bcc41cc34a1a962
BLAKE2b-256 6bede85e844df5ce7a9239776a0dd63663e1faaeb659e14f2114219816a41120

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 476.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a32eabfe64b9933f7ad6dc39ed258edd5d577550a11b230c0db6cc50f629d7fa
MD5 c920e1d64af52c5d08566de55304564e
BLAKE2b-256 05a69173983e3e8e71a2d71ba2ca44dc76ac87c3356736c3537dc2cd12852e9a

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 446.9 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 93c55c2ebfd58a0e60402118f4ef822bc88bcf18eb66f70a526a57fcdb2260ff
MD5 52cf94fffaad46d732e5e1ed3d5588be
BLAKE2b-256 dbc34ecc9be8867a034bf64b4500e4b7a1c23ecdf145eb085340cb14c4b9c3c0

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36b178101bef9f5a405f9e070b03a1a3f6bfe55dee02f68b4cf585c193ea638e
MD5 dc4b5d5d1f971f1d38f414f001571cf9
BLAKE2b-256 6dd54582a508b9eec0000f4c1410815590b1a07882eb8fef4d216fee581da154

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8f040158b0682b557deb06e02aae99e6096d7b0cbbc333860ccaa4d4f9d69fe
MD5 f36e3cae878030512215188c85d54f54
BLAKE2b-256 6f084d4aea16debd3590fb43e5d22e16086689c2a2a322ac251269f77c01e175

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 454e8aa0d073dc8dd45ae0926cb48afb6b3e591fd0ebdf3693d4229a4d73e39a
MD5 a6baabd419af4eb08983b970d28884f3
BLAKE2b-256 2c3096057d886fbbc835c5fba6b55028759393d238d7201bac4019f0ab14b60f

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 476.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5ec3d4f9213aef5422fc230f538d791ff877f2a1347e4eb8c3aa1b86e5988e6c
MD5 a683172f1825d50d7202293d01913744
BLAKE2b-256 07066e6410dbda6e5ff5fde1f9a1362dd12321023268c3d78c9948bca316c116

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: pysdif3-1.0.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 180.1 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pysdif3-1.0.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 c44946087f06bec11edbf37ab79a2cf9fd2859d5a242a51470184b583379d7ee
MD5 6cfcf365c506922977f4be92c5a2623a
BLAKE2b-256 b0884540cd1864b7d8a23b75fbc9fdef22b8b5988438612a946306ebf225a531

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd4d275596dbfbdb68312999861141b66b6bedda764eebc32a0c904c5b70ebae
MD5 d40945e6c836680d3a4932fe4ab25842
BLAKE2b-256 2c23fc898c6329eed9800f6b03b72d917aaa1d1d1002a873da11b531a0094154

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e88912570a8b1ee46aae85adf1932be4869ae98230410cdc86d250cd8ed796f
MD5 6071f220f87507815e962512b4f1a255
BLAKE2b-256 831f972518aef8fef3ccdba7ee022d8621d0412d6287bd7986d82fa7a1892627

See more details on using hashes here.

File details

Details for the file pysdif3-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysdif3-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 563a0d4b3dd6e4f0ae6d3be98a1248b73616e0ee35c726e4b8de6215e194a369
MD5 275d75a74e533e3c1812e4468e35ce08
BLAKE2b-256 e517f761dce216bf6d9bc657d49afa5f3a728594d33b42b808830a969c1367a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page