Posts Tagged ‘download’

Arduino MIDI Synth Demo Preview (square + noise) [download]

Tuesday, October 30th, 2018

Up to 15 notes at once on an Arduino using no timers! Well, the quality drops a lot as the number of playing notes increases, but still!

[Watch in HD]

This is a demo of a MIDI synth I’m developing for the Arduino. Its sound is currently very basic – it has no concept of different instruments, can only produce square waves and noise, and each MIDI channel can only be at one of 3 different volume levels. It has no fixed sample rate, and is always producing a new sample as quickly as possible, which is slower when more notes play at once (in practise, the sample rate ranges from about 20 KHz down to about 6 KHz).

It supports pitch-bends, modulation, monophonic/polyphonic MIDI channel mode, and some percussive notes. It also recognises some sysex messages, including GM/GS/XG “reset” messages and GS/XG messages to set a MIDI channel’s percussion mode.

To use the code yourself (hardware info):

If you want the Arduino to accept MIDI data from “real” MIDI hardware (through a MIDI socket), you’ll need to build a circuit with an optocoupler and connect that to the Arduino’s serial RX port, and change #define UseRealMIDIPort False to #define UseRealMIDIPort True (this affects the baud rate used). Due to laziness, while testing, I used a program called “Hairless MIDI<->Serial Bridge” and the virtual MIDI cable driver “MIDI Yoke” to send MIDI data straight over the Arduino’s USB serial connection, instead of building the proper circuit.
The code controls one “port” on the Arduino (a group of 8 pins determined by the specific Arduino board model), which connects to an 8-bit DAC (a simple R2R resistor ladder) to give an 8-bit audio output. I’m using port C on the Arduino Mega, because that neatly corresponds to digital pins 37 (LSB) to 30 (MSB), but it may work on other Arduino boards as long as there is a port where all 8 bits are mapped to digital pins, with minimal changes to the code. The output port (PORTAudio and DDRAudio) would need changing to one consisting of 8 usable pins, and the maximum number of playing notes at once (NumSoundChans) could either be reduced (will save CPU time and memory) or, in the case of the Arduino Due, increased.

You can download the code for the current version here (13.2 KB). You will also need the Fast Division library (info). Note that the code includes most of the above hardware info in the form of comments. =)

P.S. The MIDI in the video is being played on MIDITester. I did not make the MIDI, and I don’t know who did. Please, people, at least credit yourself in the metadata ;_;

BaWaMI (revision 135)

Tuesday, June 19th, 2018

This update fixes a bunch of bugs and issues, and improves on what is saved between runs. As always, full details of changes are below, but please make sure that you check the details of which settings are now saved between runs to avoid any surprises, and because it has affected a couple of command line parameters.

You can download this new version here (7.82 MB).

(more…)

BaWaMI (revision 134)

Tuesday, December 5th, 2017

This is a tiny update which simply fixes the checkbox to enable/disable responding to MIDI channel coarse/fine tuning messages, on the “MIDI params” tab of the config window, so that it actually has an effect. Previously, Bawami always responded to those messages even if the checkbox was unticked.

You can grab this fixed version here (7.80 MB).

BaWaMI (revision 133)

Wednesday, November 29th, 2017

This is a big update which fixes a bunch of bugs, especially ones related to the PC speaker, and graphical mistakes. A new internal tuning system means Bawami now supports a big range of tuning messages (their effects can combine together!), plus there are a few new instruments and tweaks to existing ones.

Some of the MIDI Tuning Standard messages are quite advanced, and you’d typically use some other scale-related software to generate the SysEx messages rather than hand-crafting them, but they mean that Bawami can now play with tuning other than equal temperament, or different scales entirely (e.g. Arabic).

You can grab this new version from here (7.80 MB), and view details of all the changed stuff in the full post, below:

(more…)

BinToUTF8 – Public release

Thursday, May 4th, 2017

Because several people have asked for it, I’ve decided to release my program for converting any binary file to a valid UTF-8-encoded text file (and vice-versa). This is the program I made to be able to train the open-source neural network software “torch-rnn” on audio, even though it’s only designed to work with text, in these previous videos.

My program is a console-mode program, so it has no graphical interface, and it’s an EXE, so it’ll only run on Windows (and maybe Wine). It’s also slow, because I hadn’t had the pressure (from the idea of making it public) to optimize it until I suddenly decided to release it this evening. It comes with pseudocode and a technical description for any programmers who want to remake it to run on other OSes, though (they’re the same text files I linked to in the blog post for my first neural network video).

The download contains BinToUTF8.exe, which you can use yourself on the command prompt (run it from the command prompt without any parameters to see usage instructions). It also contains several batch files, which make it much more convenient to use – you only have to drag a binary or text file onto the batch file on Windows Explorer to automatically launch BinToUTF8.exe with the appropriate command line parameters.

A brief description is below, but make sure you read the included “info.txt” to find out what each batch file does and avoid accidentally overwriting any of your own files!

The program works by assigning a unique Unicode or ASCII character to each of the 256 possible byte values in your binary file. There are 2 modes for this:

  • Byte/Character Lookup (BCL) mode (recommended):

Characters are assigned on a “first-come, first-served” basis, meaning that bytes appearing near the beginning of the file will be assigned ASCII characters, and Chinese Unicode characters will only be used once no more ACSII characters are available. This is done to allow you to pass text from the start of the file to torch-rnn using torch-rnn’s -start_text parameter, which does not support Unicode characters. A utf8.bcl file is made when converting to text and is required when converting back to binary. This file is the lookup table for converting between bytes and Unicode characters which the program made when converting the binary file to text.

  • Non-BCL mode (default, not recommended for torch-rnn):

All bytes are converted to Chinese Unicode characters and none are converted to ASCII. This means the text file will be larger, but more importantly, you won’t be able to use any of this text with torch-rnn’s -start_text parameter. The conversion in this mode may be faster, and no utf8.bcl file is made or required.

Text files made using the BCL mode cannot be converted back to binary using the non-BCL mode, and vice-versa. To convert text back to binary correctly, you must use the same mode that you used when converting the original binary file to text.

You can download BinToUTF8 from here (19 KB). Now, have fun!

(By the way, if training torch-rnn on audio files, you should use an 8-bit audio encoding such as 8-bit PCM, U-law or A-law, to be kind to torch-rnn.)

BaWaMI (revision 132)

Sunday, April 23rd, 2017

This biggest update ever to my MIDI software synth contains dozens of bug- and crash-fixes, improvements to live MIDI input, and a big new feature for instruments called “multi-osc” (explained below), which many instruments now take advantage of! It’s stable when clicking “Apply” to restarting the sound system, which often caused crashes in the past, and there are a couple of new features to do with overriding controls. Also, one particular system file (included since a long time ago) is now correctly checked / set up when Bawami starts, which may fix Bawami not being able to start for some people. All these improvements mean that Bawami has grown to version 0.7!

The new “multi-osc” feature for instrument files allows one note to trigger more than one sound channel, massively improving the sound of some instruments. This opens the door to having a proper Fifths instrument, octave basses, octave-stacked strings, detuned Honkey Tonk, better organs and more! Of course, I updated lots of instruments to take advantage of this, and added new GS instruments whose sounds simply weren’t possible to generate before. Multi-osc is enabled by default, but can be disabled if you want to keep CPU usage as low as possible (if you really hate the new sound, you can replace all instrument files with those from the previous version, or have fun editing them yourself!).

You can grab this shiny new version from here (7.79 MB), and view the full post to see exactly what’s changed, below:

(more…)

BaWaMI (revision 131)

Sunday, April 10th, 2016

This is a small update which fixes OGG file rendering, and a couple of other superficial things.

  • Fixed tabbing order of controls on “Mod shape” tab of the config window.
  • Writing OGG files works again – I accidentally removed a file needed by the OGG encoder in revision 130. Users who extracted revision 130′s folder over revision 129′s would not have experienced the problem.
  • Stopped warning about buggy controls from being displayed on the “MIDI params” tab of the config window, since it’s no longer true.

You can grab the new version from here (7.87 MB)!

BaWaMI (revision 130)

Wednesday, March 2nd, 2016

This update lets Bawami write WAV files in paths containing non-ASCII characters (something long-overdue), and fixes a bunch of complicated interwoven bugs related to the handling of “bad” MIDI files and of percussive notes. There’s also a load of other fixes, including for portamento-related bugs, crashing in /translator mode, and visual fixes, and a couple of new instruments.

You can grab the latest version from here (7.81 MB), and see details of the changes below the page break:

(more…)

BaWaMI (revision 129)

Sunday, January 17th, 2016

This is a nice big bunch of fixes – mostly related to /console-mode, but a couple of more serious things (which affect more people) are fixed, too.

You can grab this latest version from here (7.87 MB), and see details of all the changes below.

General bug fixes

  • Fixed bug where button to browse for a new MIDI file remained disabled after opening a MIDI by dropping it onto the main window.
  • Now recognises when a filename is passed on the command line without speech marks (and without any command line parameters). This fixes the problem of Bawami not opening a path+file containing no spaces if such a file was dragged onto its icon (or if Bawami is associated with .MID files), because Windows does not automatically surround such a path+file with speech marks when passing it to the program.

Fixes for when using /console

  • No longer crashes if you’re redirecting Bawami’s output to a file or other program.
  • When using “/infolevel 2“, log file text is now sent to StdOut instead of (accidentally) to StdErr.
  • “Finished.” is now (always) displayed when shutting down.
  • Key prompts for answers to questions are now sent to StdErr instead of StdOut (as was already being done for the question’s title and message), so that they’re visible on the console even if you’re redirecting Bawami’s StdOut to a file.

Visual-related fixes

  • Green “settings” button’s tooltip is now loaded in the chosen language (instead of having no tooltip) (broken in revision 128).
  • Corrected Z-order of several controls on the config window so that the dotted border that indicates a control that has focus isn’t having one of its horizontal edges cut off unnecessarily.
  • Corrected a reference to how green “settings” button appears in info.txt.

Logging (also affects text shown when using /console /infolevel >=1)

  • No longer shows “Closing MIDI input port” when shutting down, if MIDI-in wasn’t in use.
  • No longer shows “Decoding absolute timings” a few lines after the last track has finished being decoded.

BaWaMI (revision 128)

Monday, December 14th, 2015

This version includes a whole load more bug fixes, plus some serious support for running Bawami from the console (command prompt), which also guarantees to never display message boxes, along with several other fun new command line parameters.  It should also start slightly faster (less writing to log file, and some language files are now only loaded when they’re needed), seeking to a different playback position is easier on the ears, and there’s a bunch of safeguards added to the code related to writing OGG files. A few command line parameters have been renamed to make them less long-winded, they all begin with a slash instead of a hyphen now, and Bawami now lets you know exactly which ones it didn’t understand (if any). But despite a lot of work being focussed on command line parameters, there are several GUI-related bug fixes, too!

NOTE: In order for Bawami to be able to output to the Windows console (command prompt) when using /console option, the EXE file is now compiled as a console-mode program. Annoyingly, this causes a console window to appear for a brief moment before Bawami’s main window appears. However, this doesn’t slow anything down; it’s only for part of the amount of time where, previously, nothing at all was displayed.

You can download the new version here (7.87 MB). Full details on all of the changes and bug fixes are below, but allow me to first introduce a new feature of Bawami:

The /console command line parameter

bawami /console /stdmidi 2020

If you run Bawami from the command line, this option should be very useful, and is highly recommended instead of /invisible. Text is output to “standard output” (meaning you can see what Bawami’s doing in the console), and you can respond to any messages by pressing keys on the console, too. In this mode, Bawami also starts faster and is safe to crash in the middle of playback (nothing is leaked – but for now, make sure that you also kill the OGG encoder if you crash it in the middle of writing an OGG file). Just for fun, you can also view every single raw MIDI message scrolling up in the console as it plays (/stdmidi) , and use /infolevel 1 or 2 to get a more in-depth look at exactly what’s going on internally. Of course, these options which spam text to the console will slow Bawami down a bit. Please check the “COMMAND LINE PARAMETERS” section in info.txt for full details, and see below for an overview of all changes/additions.

View all changes below the page break:
(more…)