
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Music with Ruby.
Install it directly: gem install diapason
Or put it in your Gemfile: gem 'diapason'
require 'diapason'
# A (La) 440Hz
tonic = Diapason::Note.a440
# Tuning system used for pianos and other keyboard instruments
twelve_tone_equal_temperament = Diapason::Tuning::EqualTemperament.new(12, tonic)
# Generates the 12 notes with their respective frequencies (the chromatic scale)
notes = twelve_tone_equal_temperament.notes
# Builds the C (Do) major scale
# 2 = tone, 1 = semitone
major_scale_intervals = [2, 2, 1, 2, 2, 2, 1]
c_major = notes[3]
c_major_scale = Diapason::Scale.build(notes, major_scale_intervals, c_major)
# Generates sine waves (like those from tunning forks) from each note of the scale
waves = c_major_scale.notes.map do |note|
Diapason::Sound::SineWave.from_note(note)
end
# Since continuous signals (like audio waves) can't be exactly represented by
# digital means (like files) we need to sample it (pick some points of the wave
# to represent it) at some sample rate. 44100Hz is used by CD's.
sample_rate = 44100
# Samples any kind of sinusoidal waves, like sine waves or cosine waves
sampler = Diapason::Sound::SinusoidalWaveSampler.new(sample_rate)
# Builds 1 second worth of samples for each wave (note)
samples = waves.map do |wave|
sampler.samples_for_duration(wave, 1)
end
# Writes wave file
writer = Diapason::Sound::WaveFileWriter.new(sample_rate)
file = writer.write_samples(samples.map(&:to_a).flatten, '/path/to/c_major_scale.wav')
# Plays the file
Diapason::Sound::WaveFilePlayer.new.play(file)
FAQs
Unknown package
We found that diapason demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.