Skip to content

HackDaysJuly2023

Noah Gibbs edited this page Aug 24, 2023 · 1 revision

Scarpe was expanded hugely for a Shopify Hack Days -- which included some non-Shopify folks too -- back in Feb of 2023.

In July of 2023, there's a sound-and-music-themed Hack Days to expand it again. Woo!

You're not required to do things with sound or music, but we're trying to make sure you can if you want to. Music's fun!

Bloopsaphone

You can read up on Scarpe's Bloopsaphone Support here. It works!

Bloopsaphone is a basic chiptunes synthesizer. You can use it to turn strings of musical notes -- "E D C D E E E" -- into music. That one is "Mary Had a Little Lamb." Except that with simple synthesized instruments, everything sounds like old Nintendo boss fight music. So it's like the start of Mary Had a Little Lamb, except Mary and the lamb are going to be some kind of two-part boss fight, especially once you add another track.

Other Fun Software

Scarpe packages very simple chiptune synthesizer support in the form of Bloopsaphone, but little else. But you can use Scarpe with non-Scarpe software.

FFMPEG

You can install FFMPEG with "brew install ffmpeg" or roughly the same in your package manager of choice. FFMPEG is solid, well-maintained, good for big batches of files and hard to use. Very pro-quality, in good and bad ways.

FFMPEG is awesome for converting audio formats, resampling, recording (if you know the duration you want) and a certain amount of filtering and processing. It's a command-line program, so you'll probably want to write chunks of PCM audio (simple loudness-based waveforms) to disk and then run FFMPEG with system(), backticks, etc.

PortAudio

If Bloops is installed then PortAudio is working. It might make sense to create or grab a PortAudio binding so you can do other PortAudio stuff from Ruby. For instance:

Basic-Pitch

Wouldn't it be cool to get notes from a chunk of sound, so that you could chiptune-ify them with Bloops or pitch-shift them with FFMPEG or whatever? Spotify (no, not Shopify) has a little Python program called basic-pitch that you can install with Pip (Python's most common package manager) that will do that.

You'll need Python 3.10+ if you're using an M1 Mac, and 3.6+ if you're using Intel. So your Python should be recent-ish. Update if needed.

MIDI

You know what's in-theme for sound? MIDI! MIDI files could be Bloopsified! MIDI controllers could be awesome. But we'd need to use FFI-or-something to Ruby-fy MIDI file loaders, libraries, etc., or find bindings people have already made.

Some of those bindings exist, but I don't know yet which ones are good. You could be the one to figure it out!

Background that May Be Helpful

Concept: PCM Audio Format

Humans have been recording sound for quite some time, and analysing it for even longer. That means there are a lot of ways it's been done. One of the most common breakdowns is frequency-based ("that's a middle C note at 256 Hz!") versus amplitude-based ("that middle C note is actually a single long sine wave that goes up and down 256 times per second, and we break each second into 44,100 samples!").

The most common way to encode sound files is by amplitude - so if the sound is loud at a particular time, the number is higher. This is often called Pulse Code Modulation (PCM). So if you see somebody (like FFMPEG) talking about PCM WAV files, they're talking about a raw encoding where they record a series of heights/loudnesses (amplitudes). There are other ways to encode, such as by frequency, which are less common. There's also a long history, which you may mercifully ignore for most purposes.

Clone this wiki locally