Jump to content


Please note: You can easily log in to MPN using your Facebook account!

Playing math waves via USB midi on the Raspberry Pi


Theo Verelst

Recommended Posts

I've made my BWise (block wise network programming) program create mathematical formulas, representing sound signal flow with various blocks like sine waves, additions, multiplications (in other applications, exponentials and polynomials and FM constructions as well), which are automatically turned into mathematical formulas, simplified properly, and then turned into a polyphonic C+Fortran program with Jack (Linux, though I've made a windows audio version as well) audio output, and midi input. Computations on the audio waves are very accurate (double precision after good factorization) so in practice, depending on the quality and type of the Digital to Analog convertor, the waves coming from this synthesizing setup are very very pure.

 

I've not put the same software, with a simple enough example, from Linux PC on a very cheap and versatile Raspberry Pi computer board, easily available for consumers.

 

[video:youtube]

 

The wave in the video is a trick detune example, it's like additive synthesis, but not just using integer harmonics, but also detuned harmonics. The formula and the example BWise Tcl/Tl scripts to make all this happen on your own RPI are here: .gif image of formula , detune1.zip

 

It's some work to set up the $35 RPI with all the needed programs, but it's fun it recognizes midi-usb, usb-DA-convertors, and can run all these programs, even some real time audio (via jack).

 

T.

Link to comment
Share on other sites



  • Replies 4
  • Created
  • Last Reply

It's some work to set up the $35 RPI with all the needed programs, but it's fun it recognizes midi-usb, usb-DA-convertors, and can run all these programs, even some real time audio (via jack).

 

T.

 

that's really awesome Theo. wish I had a better grip on it like you do. :)

:nopity:
Link to comment
Share on other sites

Fortran? Did you enter that equation with punch cards?

 

Looks pretty cool, actually. In my recent additive synth thread, I was thinking it would be cool to have a formulaic method of generating the basic set of partials - sigma notation with n=1 to whatever number of partials you want.

Dan

 

Acoustic/Electric stringed instruments ranging from 4 to 230 strings, hammered, picked, fingered, slapped, and plucked. Analog and Digital Electronic instruments, reeds, and throat/mouth.

Link to comment
Share on other sites

So Theo, I'm also curious....I'm not familiar with most of east you named in terms of software and even the processor board. To what level did you have yo program and why did you choose what you did? I've got a little experience with a few languages and platforms, but none music related.

 

So using "pseudo code" (to the uninitiated, not specific syntax to a programming language, but basic stuff that 's common to most languages without being correct syntax), I would assume you'd create what you send to the D/A something like:

 

Dim NoteStatus as Bin;

 

Have code to enter partial frequencies and levels

 

X=0 (radians/sec? Deg?)

 

 

DO WHILE NoteStatus=TRUE{

 

Timer....set timer for whatever (48kHz, etc)

 

For n=1 to 50 {

Output= (1/(2*n))*Sine((2*n)*x)

}

X++

}

 

 

Am I on the right track? Does the software you use offer some advantage to this sort of application?

Dan

 

Acoustic/Electric stringed instruments ranging from 4 to 230 strings, hammered, picked, fingered, slapped, and plucked. Analog and Digital Electronic instruments, reeds, and throat/mouth.

Link to comment
Share on other sites

I'll make another video about some of those things, and some of the progress (running a remote X server on an Android pad to control a synthesizer on the RPI, a simple but good mixer DIY example (with excellent parts), another more modest AD/DA convertor for "simple" boards like this, networked audio and possibly midi and a "normal" midi connected to the board, other synthesis types, adding envelopes and more), but essentially Dan, yes it's like adding harmonics up.

 

The board is very little and extremely cheap, and it can run a solid audio program like Linux's Jack, and it can run double precision *time evaluation* formulas like in the .gif example of the above demo. So essentially you write a formula (say in "Maxima", or even "Mathematica" which is on the little board for free !), put that into a decent programming language (C coupled with Fortran, because the midi/sound interrupts are handled by a C program, and Maxima can only write Fortran output thus far), fill in the time 't' parameter, and the function is computed for each point in time (counting in seconds).

 

So 440 Hz sine wave is something like 1*sin(2*PI*t+Phi_0), where the amplitude is fixed, and per voice should be 1/#voices to make the adding up (mixing) work good. The same software runs on a linux (no reason to believe it couldn't run on a Unix Mac either) because all the steps required are programs that also exist on PC-Linux (Fortran/C compilers, Maxima, Jack audio and Alsa midi libraries, Tcl/Tk for my graph construction program), except then the "running" of the modular graph and the compilation, and starting a new program as the result is near-interaction time.

 

There are more and more boards that use ARM-RISC processors, like the Parallella (includes potent FPGA for $99), and recently for instance the stand alone board from NVIDIA Jetson TK1 (4 core very fast ARM cortec-15 like could be in the most powerful pad computers in the near future) with stuff like serial ata connections USB3, etc. The point is thusly it's possible to build powerful synthesizer (for far less than extreme amounts of money) with all kinds of integration possibilities, from accelerated DSP to driving analog electronics and digital controlled analog electronics.

 

The RPI is widely used in education, has good graphics possibilities for user interface interfaces and such, and is a good tryout.

 

T.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...