Monday, July 3, 2023

SOX convert Atari audio files for MPC

 this sox command line does the work on audio sampled on an Atari STe with a Mastersound cartridge:

> sox JOAN100.AVR -r 44100 -b 16 joan100A.wav silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse

sox reads the .avr header, then upscales to 44.1 khz / 16 bits: we also trim silence from start and end.


here it is embedded as an Automator app for OSX Mojave. I'm sure this will be broken in later OS'


for AVRs that come in smaller than 1kb or so, I think that the trimming associated with remove silence trick used here results in an empty file. I'll get to that

Monday, January 3, 2022

MPCMaid and Java versions on Mac - OSX 10.14

 a requirement to run MPCMaid - http://mpcmaid.sourceforge.net/ - on a Mojave Mac.

Originally written for JRE 1.6 and packaged as a .jar file, it still fires up OK but is missing some important items, the prefs menu items to be specific where you can select the type of MPC you want to create programs for. In my case, an MPC500 that I'm using to test some MIDI processing scripts. 

The following process gets you the app in it's old-school fully-functional state:

1. get an old JRE, Java 6 from Apple: https://support.apple.com/kb/dl1572 and install

2. check your available Java versions:

/usr/libexec/java_home -V

you should see output like the following: 

Matching Java Virtual Machines (5):    

    15.0.1, x86_64: "Java SE 15.0.1" /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home   
    1.8.0_312,       6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home


3. I chose a 'most compatible' version: ie. the final one and set it as the default:

export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-468, i386`

4. Test running the  .jar now with:

cd /Applications

java -jar mpcmaid_beta.jar

 - all the old menus are restored and it can open/save/export normally

5. make the choice of default JRE permanent by adding the command in 3. above to your .bash_profile.

Thursday, November 9, 2017

verify JSON files in the shell (npm, bash)

I do most of my mass text-processing in Perl. It's been a wake-up that Perl's JSON libraries & tools are a little eccentric (perhaps that shouldn't be surprising) or 'minimal', rather than warm & fuzzy: that would be the best word.

Anyway. Let's verify a bunch of json files in the shell. This follows a lengthy period of combining &  de-duplicating two (pretty crap & overlapping) datasets into a single json format. 

Install jsonlint from via npm: https://www.npmjs.com/package/jsonlint

This gives you a decent executable json linter which may or may not be the same codebase as the ever-awesome http://jsonlint.com/

and call it from the shell:

for f in *.json 
do 
 echo "Processing $f" 
 jsonlint -cq $f 
done

the q flag prevents json printing to the shell & only shows errors

Sunday, October 13, 2013

console colours on RedHat linux

or, how to turn them off. You need sudo or root:

chmod 000 /etc/profile.d/colorls.*

That's a global disable but honestly, dark blue text on black? It's been bugging me for years. RedHat-derived Linux has been shipping with the ls command aliased to /bin/ls --color=auto for an extremely long time though I don't remember anyone asking me about it.

Alternatively, if you want to customise this kind of thing, this article might be a good starting point.


Saturday, October 12, 2013

Web Design: Responsive Image Sizes

Put this in your CSS:

img {
     max-width: 100%;
     height: auto;
}

- making sure it doesn't get overridden at some point in your more specific CSS classes.

This is a prime technique for sites that have some big feature image, usually on the front page that needs to be there when someone looks at it using a smart phone etc. The image will scale on nearly everything except IE8 - for which webdesignerwall offers a specific solution.

Friday, October 4, 2013

a development process for Max MSP or Max for Live

back on the Max jag again - I am building & re-building a small set of patchers to help me create music/soundtracks for some performance works I've been asked to help out with.

One of these - basically a sample-player which uses soundfile markers to determine playback - has been around since 2006 in various forms. I even wrote a helper app for it using Libsndfile, before Patrick Delges' sfmarkers-v0-4-1 object was around (or before I became aware of it's existence).

I think I just rewrote it for the seventh time - it's definately acting in a more consistent manner now. AIFF only - there just seem to be endless uncommon & weird problems getting markers out of WAV files. I also created an M4L version, which was instructive in the problems that embedding in an Ableton project solves (memorising specific setting per-instance of the patch) - and also the extra problems it brings up (access to presets & automation).

The need to move this patch/instrument between a few different Macs sent me off to finally look at version control for Max.

more on this in a minute...

Tuesday, August 20, 2013

Arduino: Motion sensor, making it work

I had some problems getting this PIR motion sensor, which I'm pretty sure is the same as this working well, connected to either an Arduino Duemillanove or a Teensy 2.0 micro. It seemed to trigger randomly or not at all. Based on a clue from the Sparkfun comments on the item: provide the sensor with it's own or extra power as the micro board might not be providing enough volts to drive it properly.

This approach seems to provide the answer: power the PIR sensor with the positive side of a 9v battery, (disconnecting it from the micro board's power), whilst leaving the rest of the circuit (like this) in place.

In hindsight, I'm assuming the problem I had stemmed from the Arduino itself using up all the juice available from the USB connection to the computer. Powering the board from a DC adapter with current to spare would help too.

With a movement/presence detector like this, adding a big LED or a buzzer to your circuit and sketch, indicating when the sensor detects movement will help a lot when testing.


dual-powered: the PIR sensor connected to a Teensy. 9V battery for the sensor, an old phone charger provides +5v via the Teensy's mini USB connector.