Basically, this takes a MIDI input file (I just googled and grabbed one of Maroon 5's "Animal" – I know, I know) and generates a WAV file.
NOTE: This is the slowest midi rendering program I have ever seen!
Dependencies:
- Pydub (pydub.com)
from pydub import AudioSegment | |
from pydub.generators import Sine, Square, WhiteNoise | |
from pydub.playback import play | |
# From https://gist.github.com/jiaaro/339df443b005e12d6c2a | |
def note_to_freq(note, concert_A=440.0): | |
''' | |
from wikipedia: http://en.wikipedia.org/wiki/MIDI_Tuning_Standard#Frequency_values | |
''' | |
return (2.0 ** ((note - 69) / 12.0)) * concert_A |
# Timings taken on a MacBook Pro (Retina, 15-inch, Mid 2014) | |
# running OS X 10.10.3 | |
In [1]: import sys | |
In [2]: print sys.version | |
2.7.6 (default, Sep 9 2014, 15:04:36) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] | |
In [3]: data = [{str(x): y+z for x in range(10) for y in range(50)} for z in range(500)] | |
In [4]: import json |
from pydub import AudioSegment | |
from pydub.silence import detect_nonsilent | |
seg = AudioSegment.from_file("./ghosts_and_stuff.m4a") | |
# reduce loudness of sounds over 120Hz (focus on bass drum, etc) | |
seg = seg.low_pass_filter(120.0) | |
# we'll call a beat: anything above average loudness | |
beat_loudness = seg.dBFS |
Basically, this takes a MIDI input file (I just googled and grabbed one of Maroon 5's "Animal" – I know, I know) and generates a WAV file.
NOTE: This is the slowest midi rendering program I have ever seen!
Dependencies:
// How to use: | |
// 1. Open "Script Editor" (requires OS X 10.10 Yosemite) | |
// 2. Change the language from "AppleScript" to "JavaScript" | |
// 3. Paste the code below and replace the safari example. | |
// | |
// More info: | |
// https://developer.apple.com/library/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/index.html | |
var sys_events = Application("System Events"); |
Install portaudio using homebrew (or method of your choice)
brew install portaudio
create $HOME/.pydistutils.cfg using the include
and lib
directories of your portaudio install:
[build_ext]
function Event() { | |
this.listeners = []; | |
} | |
Event.prototype.subscribe = function(fn) { | |
this.listeners.push(fn); | |
} | |
Event.prototype.unsubscribe = function(fn) { | |
for (var i = 0; i < this.listeners.length; i++) { | |
if (this.listeners[i] === fn) { | |
this.listeners.splice(i, 1); |
#!/bin/bash | |
INFILE="${1}" | |
LFILE=$(SND="$INFILE" python -c "import os; print '{0}.L{1}'.format(*os.path.splitext(os.environ['SND']))") | |
RFILE=$(SND="$INFILE" python -c "import os; print '{0}.R{1}'.format(*os.path.splitext(os.environ['SND']))") | |
echo "Splitting $INFILE into:" | |
echo " LEFT: $LFILE" | |
echo " RIGHT: $RFILE" | |
echo |
Development time: 3 weeks (15 * 8 == 120 hours) | |
Marketing time: 2 weeks (10 * 8 = 80 hours) | |
hourly: $200 (must pay well enough to justify risk) | |
profit target: $40k (200 hrs * $200) | |
revenue target: $60k (40000 / 0.67, Apple's cut) | |
-------- |