Changes
3 changed files (+4/-4)
-
-
@@ -4,4 +4,4 @@## Get started First, install [Sox](https://sox.sourceforge.net/) and clone this repo. Write some music in `music.scm`. Enjoy your music with `guile --fresh-auto-compile lambeat.scm | play -r 8000 -t s16 -`! For the Python version, use `pypy3 music.py | play -r 44100 -t s16 -` to listen and `pypy3 music.py | sox -r 44100 -t s16 - example.ogg` to save to a file. For the Python version, use `pypy3 music.py | play -r 44100 -t s32 -` to listen and `pypy3 music.py | sox -r 44100 -t s32 - example.ogg` to save to a file.
-
-
-
-
@@ -314,7 +314,7 @@ def at(t):""" Returns the total intensity of music sampled at time t """ i = bisect.bisect(music, (t, 10**9)) i = bisect.bisect(music, (t, 2**31)) # This is actually pretty efficient ngl # Because people usually don't have that many overlapping notes ret = 0
-
@@ -322,9 +322,9 @@ for j in range(max(i - 30, 0), i):m = music[j] # if m[0] + m[1] > t: ret += m[4] * tone(freq(m[2], m[3]), t - m[0]) return int(2**12 * ret) return int(2**28 * ret) # Print out music encoded in s16 to standard output for i in range(0 * bitrate, 84 * bitrate): sys.stdout.buffer.write(struct.pack("h", at(i / bitrate))) sys.stdout.buffer.write(struct.pack("i", at(i / bitrate)))
-