Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed compact.bin
Binary file not shown.
1 change: 1 addition & 0 deletions dx7core/dx7note.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <iostream>
#endif
#include <math.h>
#include <cstddef>
#include "synth.h"
#include "freqlut.h"
#include "patch.h"
Expand Down
1 change: 1 addition & 0 deletions dx7core/fir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <stdio.h> // for debugging, remove
#include <stdlib.h>
#include <stdint.h>

#include "aligned_buf.h"
#include "fir.h"
Expand Down
1 change: 1 addition & 0 deletions dx7core/fm_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifdef VERBOSE
#include <iostream>
#endif
#include <stddef.h>

#include "synth.h"
#include "fm_op_kernel.h"
Expand Down
2 changes: 1 addition & 1 deletion dx7core/pydx7.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ DL_EXPORT(void) initdx7(void)
{
Py_InitModule("dx7", DX7Methods);
// TODO: this file should go into the package directory from setup.py, but that is a PITA
FILE *f = fopen("/Users/bwhitman/outside/learnfm/compact.bin","rb");
FILE *f = fopen("/Users/joseph/dev/learnfm/compact.bin","rb");
// See how many voices are in the file
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
Expand Down
1 change: 1 addition & 0 deletions dx7core/wavout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

// Create a WAV file
#include <stdint.h>

#include "wavout.h"

Expand Down
20 changes: 12 additions & 8 deletions dx7db.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Takes a directory full of DX7 sysex patches and outputs a compacted unique list of voices
import os, sys, hashlib

import mido
from slugify import slugify


# I got this by paying $2 for https://gumroad.com/dxsysex
def get_all_syx_files():
sysexs = []
for path, directories, files in os.walk('patches'):
Expand Down Expand Up @@ -56,7 +56,7 @@ def sysex_message(patch_number, channel):
lsb = (byte_count % 127) - 1
return [0x43, channel, 0, msb, lsb] + patch_data + [check]

_port = mido.open_output()
#_port = mido.open_output()
def update_voice(patch_number, channel):
sysex = sysex_message(patch_number, channel)
msg = mido.Message('sysex', data=sysex)
Expand Down Expand Up @@ -86,9 +86,9 @@ def parse_all():
p = parse_8208b(data)
else:
cant = cant + 1
for patch in p:
for j, patch in enumerate(p):
total = total + 1
dedup[patch[2]] = patch
dedup[patch[2]] = (patch, f, j)
return dedup

def unpack_packed_patch(p):
Expand Down Expand Up @@ -164,13 +164,17 @@ def main():
compact = open("compact.bin", "wb")
names = open("names.txt", "w")
dedup = parse_all()
for r in dedup.items():
compact.write(r[1][0])
name = r[1][1] # the name will be the first name of this voice we saw
for r, f, num in dedup.values():
compact.write(r[0])
name = r[1] # the name will be the first name of this voice we saw
for i,char in enumerate(name):
# Make sure the name is actually ASCII printable
if(char < 32): name[i] = ' '
if(char > 126): name[i] = ' '
# Keep the original filename and patch number
# in addition to the "internal" name of the patch
# which might have duplicate
name = slugify("%s-%02d-%s" % (f, num, name), lowercase=False)
names.write(name)
names.write('\n')
compact.close()
Expand Down
1 change: 1 addition & 0 deletions get-patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ~/learnfm/ && mkdir patches && cd patches && wget http://bobbyblues.recup.ch/yamaha_dx7/patches/DX7_AllTheWeb.zip && unzip DX7_AllTheWeb.zip && rm DX7_AllTheWeb.zip
Loading