Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • ketos ketos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 27
    • Issues 27
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • public_projects
  • ketosketos
  • Merge requests
  • !196

Merged
Created Apr 13, 2021 by Oliver Kirsebom@kirsebomOwner

Spectrogram complex phase

  • Overview 6
  • Commits 10
  • Pipelines 9
  • Changes 8

When creating a MagSpectrogram object from a wav file or a Waveform object, the user can now use the compute_phase argument to specify that the complex phase angle should be computed and stored along with the magnitude spectrogram.

The complex phase angle is a 2d numpy array with precisely the same shape as the magnitude spectrogram. Therefore, to ensure that cropping and segmentation operations are applied equally to both arrays, we store the complex phase angle along with the magnitude spectrogram, as follows,

self.data = np.stack([self.data, phase_angle], axis=2)

Moreover, we add the following two methods to the MagSpectrogram class,

    def get_data(self):
        """ Get magnitude spectrogram data """
        if np.ndim(self.data) == 3: return self.data[:,:,0]
        else: return super().get_data()

    def get_phase_angle(self):
        """ Get magnitude spectrogram complex phase angle, if available """
        if np.ndim(self.data) == 3: return self.data[:,:,1]
        else: return None

The get_data method overwrites the corresponding method from the BaseAudio class.

Edited Jun 18, 2021 by Oliver Kirsebom
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: spec_complex_phase