Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pitch

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pitch

  • 0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Pitch

Pitch is a Ruby gem that provides a way to generate audio tones, writes them to files, and detects those tones. It can be used in applications that need to test whether audio data is being written properly. For example, it is used in the HD24Dig gem to build a test harness for testing audio extraction from a multitrack digital recorder.

Pitches can be created from scientific pitch notation (SPN), where 'C4' is designated to be middle C. Or from MIDI notation where either the string 'C3' or the value 60 is middle C. Pitches can be converted between various forms, as well as added to or subtracted from. Finally, pitches can be written to files as audio tones, and generated by analyzing files with audio tones.

Usage

require 'pitch'

# make a pitch of C4 (SPN)
pitch = Pitch.new_from_spn('C4')

# make a file containing a tone with the pitch
pitch.write_to_file('tone.wav', rate: 48000, depth: 24)

# read the file to determine the pitch
pitch = Pitch.read_from_file('tone.wav')

Installation

Install as a gem:

gem install pitch

...or add to your Gemfile or .gemspec file as needed.

Requirements

This gem was written to use Ruby 3.3. It should work with versions of Ruby that are close to that.

Under the hood, Pitch uses SoX to generate tones and write audio files, and Aubio to analyze and detect tones from those files. You will need to install the appropriate package in order for the write_to_file and read_from_file methods to work properly. On macOS using Homebrew, that looks like this:

brew install sox
brew install aubio

References

FAQs

Package last updated on 04 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc